1616380598

# Image Feature Extraction Using PyTorch

Case Study: Image Clustering using K-Means Algorithm

In summary, this article will show you how to implement a convolutional neural network (CNN) for feature extraction using PyTorch. Also, I will show you how to cluster images based on their features using the K-Means algorithm. Enjoy!

## Introduction

Let’s say you see an image of a cat. In a matter of seconds, you can see a cat inside of it. What if we give the same picture to the computer? Well, the computer cannot recognize it. Maybe we can open the image on the computer but it doesn’t recognize it.

As you know, computers process numbers. What they see are different from us. Therefore, everything that is processed by the computer should be represented as numbers.

How can we represent the image as numbers? Well, the image actually consists of numbers, and each number represents the colors or brightness. Unfortunately, this representation is unsuitable when we want to do some machine learning tasks, for example, image clustering.

Clustering is basically a machine learning task where we group the data based on their features, and each group consists of data similar to each other. When we want to cluster data like an image, we have to change its representation into a one-dimensional vector.

But we cannot just convert the image as the vector directly. Let’s say you have a color image, which has the size of 512x512 pixels and three channels, where each channel represents the color of red, green, and blue.

When we convert the three-dimensional matrix into a one-dimensional vector, the vector will consist of 786.432 values. That’s a huge number!

If we use all of them, it will make our computer slow to process the data. Therefore, we need a method to extract those features, and that’s where the convolutional neural network (CNN) comes in.

### Convolutional Neural Network

A CNN is one of the most popular deep learning models. This model is mostly used for image data. This model will do a convolution process on the image, where it filters the image with a thing called kernel so we can get a pattern from it.

A CNN can catch high, medium, and even low-level features, thanks to its hierarchical structure and various filter size. Also, it can compress the information into a small size by using a mechanism called pooling.

The advantage of the CNN model is that it can catch features regardless of the location. Therefore, this neural network is the perfect type to process the image data, especially for feature extraction [1][2].

### K-Means Algorithm

After we extract the feature vector using CNN, now we can use it based on our purpose. In this case, we want to cluster the image into several groups. How can we group the images?

We can use an algorithm called K-Means. At first, the K-Means will initialize several points called centroid. Centroid is a reference point for data to get into a group. We can initialize centroid as many as we want.

After we initialize the centroid, we will measure the distance of each data to each centroid. If the distance value is the smallest, then the data belongs to the group. It changes over time until the clusters not change significantly.

To measure the distance, we can use a formula called euclidean distance. The formula looks like this,

Now we know the concepts from CNN and K-Means. Let’s get into the implementation!

#data-science #artificial-intelligence #machine-learning #deep-learning #pytorch

1597469369

## Crop and Resize Image Before Upload In Laravel Using with jQuery Copper JS

Crop and resize image size before upload in laravel using jquery copper js. In this post, i will show you how to crop and resize image size in laravel using jQuery copper js in laravel.

This laravel crop image before upload using cropper js looks like:

Laravel crop image before upload tutorial, follow the following steps and learn how to use cropper js to crop image before uploading in laravel app:

• Step 1: Install New Laravel App
• Step 2: Add Database Details
• Step 3: Create Migration & Model
• Step 5: Create Controller By Artisan
• Step 6: Create Blade View
• Step 7: Make Upload Directory
• Step 8: Start Development Server

Live Demo Laravel Crop image Before Upload.

#laravel crop image before upload, #laravel crop and resize image using cropper.js #ajax image upload and crop with jquery and laravel #crop and upload image ajax jquery laravel #crop image while uploading with jquery laravel #image crop and upload using jquery with laravel ajax

1620729846

## Why Use WordPress? What Can You Do With WordPress?

Can you use WordPress for anything other than blogging? To your surprise, yes. WordPress is more than just a blogging tool, and it has helped thousands of websites and web applications to thrive. The use of WordPress powers around 40% of online projects, and today in our blog, we would visit some amazing uses of WordPress other than blogging.
What Is The Use Of WordPress?

WordPress is the most popular website platform in the world. It is the first choice of businesses that want to set a feature-rich and dynamic Content Management System. So, if you ask what WordPress is used for, the answer is – everything. It is a super-flexible, feature-rich and secure platform that offers everything to build unique websites and applications. Let’s start knowing them:

1. Multiple Websites Under A Single Installation
WordPress Multisite allows you to develop multiple sites from a single WordPress installation. You can download WordPress and start building websites you want to launch under a single server. Literally speaking, you can handle hundreds of sites from one single dashboard, which now needs applause.
It is a highly efficient platform that allows you to easily run several websites under the same login credentials. One of the best things about WordPress is the themes it has to offer. You can simply download them and plugin for various sites and save space on sites without losing their speed.

2. WordPress Social Network
WordPress can be used for high-end projects such as Social Media Network. If you don’t have the money and patience to hire a coder and invest months in building a feature-rich social media site, go for WordPress. It is one of the most amazing uses of WordPress. Its stunning CMS is unbeatable. And you can build sites as good as Facebook or Reddit etc. It can just make the process a lot easier.
To set up a social media network, you would have to download a WordPress Plugin called BuddyPress. It would allow you to connect a community page with ease and would provide all the necessary features of a community or social media. It has direct messaging, activity stream, user groups, extended profiles, and so much more. You just have to download and configure it.
If BuddyPress doesn’t meet all your needs, don’t give up on your dreams. You can try out WP Symposium or PeepSo. There are also several themes you can use to build a social network.

3. Create A Forum For Your Brand’s Community
Communities are very important for your business. They help you stay in constant connection with your users and consumers. And allow you to turn them into a loyal customer base. Meanwhile, there are many good technologies that can be used for building a community page – the good old WordPress is still the best.
It is the best community development technology. If you want to build your online community, you need to consider all the amazing features you get with WordPress. Plugins such as BB Press is an open-source, template-driven PHP/ MySQL forum software. It is very simple and doesn’t hamper the experience of the website.
Other tools such as wpFoRo and Asgaros Forum are equally good for creating a community blog. They are lightweight tools that are easy to manage and integrate with your WordPress site easily. However, there is only one tiny problem; you need to have some technical knowledge to build a WordPress Community blog page.

4. Shortcodes
Since we gave you a problem in the previous section, we would also give you a perfect solution for it. You might not know to code, but you have shortcodes. Shortcodes help you execute functions without having to code. It is an easy way to build an amazing website, add new features, customize plugins easily. They are short lines of code, and rather than memorizing multiple lines; you can have zero technical knowledge and start building a feature-rich website or application.
There are also plugins like Shortcoder, Shortcodes Ultimate, and the Basics available on WordPress that can be used, and you would not even have to remember the shortcodes.

5. Build Online Stores
If you still think about why to use WordPress, use it to build an online store. You can start selling your goods online and start selling. It is an affordable technology that helps you build a feature-rich eCommerce store with WordPress.
WooCommerce is an extension of WordPress and is one of the most used eCommerce solutions. WooCommerce holds a 28% share of the global market and is one of the best ways to set up an online store. It allows you to build user-friendly and professional online stores and has thousands of free and paid extensions. Moreover as an open-source platform, and you don’t have to pay for the license.
Apart from WooCommerce, there are Easy Digital Downloads, iThemes Exchange, Shopify eCommerce plugin, and so much more available.

6. Security Features
WordPress takes security very seriously. It offers tons of external solutions that help you in safeguarding your WordPress site. While there is no way to ensure 100% security, it provides regular updates with security patches and provides several plugins to help with backups, two-factor authorization, and more.
By choosing hosting providers like WP Engine, you can improve the security of the website. It helps in threat detection, manage patching and updates, and internal security audits for the customers, and so much more.

#use of wordpress #use wordpress for business website #use wordpress for website #what is use of wordpress #why use wordpress #why use wordpress to build a website

1597565398

## Laravel 7/6 Image Validation

In this image validation in laravel 7/6, i will share with you how validate image and image file mime type like like jpeg, png, bmp, gif, svg, or webp before uploading image into database and server folder in laravel app.

https://www.tutsmake.com/image-validation-in-laravel/

#laravel image validation #image validation in laravel 7 #laravel image size validation #laravel image upload #laravel image validation max #laravel 6 image validation

1620200340

## how to integrate CKEditor in Django

Welcome to my Blog, in this article we learn about how to integrate CKEditor in Django and inside this, we enable the image upload button to add an image in the blog from local. When I add a CKEditor first time in my project then it was very difficult for me but now I can easily implement it in my project so you can learn and implement CKEditor in your project easily.

1597563325

## Laravel 7/6 Image Upload Example Tutorial

Laravel image upload example tutorial. Here, i will show you how to upload image in laravel 7/6 with preview and validation.

Before store image into db and folder, you can validate uploaded image by using laravel validation rules. as well as you can show preview of uploaded image in laravel.

### Image Upload In Laravel 7/6 with Validation

Image upload in laravel 7/6 with preview and validation. And storage image into folder and MySQL database by using the below steps:

Install Laravel Fresh App
Setup Database Details
Generate Image Migration & Model