Image Segmentation & K‐means Clustering - ECE-180D-WS-2024/Wiki-Knowledge-Base GitHub Wiki

Introduction to Image Processing

Digital image processing is one of the most pivotal technologies developed since the 20th century. Through this, machines are able to analyze and extract important information from visual media such as pictures and videos. Techniques such as Image Segmentation and K-means Clustering paved the way for various practical applications. Using these functionalities, engineers unlocked the ability to develop machine learning algorithms that allow for object recognition, image classification, and environmental understanding.

Image Segmentation

Image segmentation is a computer vision process that breaks an image down into several sections to analyze it in partitions. By segmenting photos into digestible pieces, machines are able to prioritize the more meaningful parts of the image, and disregard the irrelevant ones. Pixels are the smallest unit of information in an image, with properties such as color and location. In image segmentation, pixels with similar visual characteristics are set aside and assigned a unique label. By tagging them with a distinguishing identifier, machines can gain a more precise understanding of what is in the image by comprehending the content and its layout.

This data is then used to train a machine learning model so it can accurately classify an image. The model observes patterns from a database of known classifications. As the library of known classifications grows, the algorithm improves and gains a deeper awareness of the content. Once it is sufficiently mature, the program is then able to classify new information.

For example, if an engineer feeds a program various images of a football, it will become increasingly familiar with that object as it absorbs more and more information. When images of athletes playing sports are later given to the algorithm, it is able to use its understanding of what a football looks like to detect in which photos athletes are playing football, and in which athletes are not.

Image segmentation generally provides computers with the ability to better understand what is being presented to them by allowing for object detection and image classification. For example, in autonomous driving, cars break down their surroundings into regions like the road versus the sidewalk, and objects like other vehicles and pedestrians. This allows for the machine to effectively recognize and react to various elements around them.

K-means Clustering & How It Works

K-means clustering is a widely used unsupervised machine learning algorithm. Unsupervised algorithms mainly draw conclusions from unlabeled datasets. They look for patterns or structures without being explicitly told what to look for. K-means clustering strives to bundle similar data points together into a set number of groups (K) and interpret patterns among these clusters.

Once the number K is specified, the algorithm knows that it is looking to classify the dataset into that many groups. It starts by randomly choosing a centroid – a position denoting the center of the cluster – for each group. It then analyzes each point in the dataset and assigns it to a group based on how close its value is to the centroid. To optimize the centroid positions, our goal is to minimize the objective function below. As more data points are fed into the algorithm, the centroid is able to update itself to become an increasingly accurate average of all the data points in its group. Through this optimization, the within-cluster variance or distance between data points and their assigned centroids, is minimized.

Larger values of K result in more accurate clusters, but there are some disadvantages. Increasing the value of K obviously incurs larger computing time and costs. Additionally, it can cause the algorithm to treat noise or minor variations in the data as separate clusters. These groups are not meaningful, and forming explanations for each of them can be challenging. Often, having a small group of well-defined clusters can be more informative than many clusters with unclear boundaries.

K-means clustering allows for more meaningful image analysis. For example, in medicine, pixels in an MRI brain image can be assigned to a K-cluster based on its visual characteristics and color depth. These clusters are each associated with distinct regions in the brain with different brain tissues. Each region can be color-coded and labeled, allowing doctors to better visualize and inspect specific portions of the brain.

Brain-lesion-segmentation-using-K-means-A-representative-brain-lesion-segmented-using

In another instance, K-means clustering can be used for efficient image compression. With enough K-clusters we are able to group together similar color pixels and produce a mean color value. These mean colors are use to apply a mask representing each cluster in the image. As such, this reduction in color variety requires less data to be transmitted.

As seen above, K-means clustering is an effective method to partition of target sections within an image. Through a bit of alteration in the algorithm, we can extract target portions using the areas mapped by the clusters. As such, this allows us to perform image segmentation using this K-means clustering.

Conclusion

Digital image processing is an essential technology that significantly impacts everyday life. In medical visualization, doctors are able to visualize internal structures and distinguish abnormalities, strengthening their abilities to diagnose and treat patients. In security systems, facial recognition and biometric identification enhance safety measures in financial institutions, government facilities, and more. In autonomous driving, the ability to recognize lanes, traffic lights, objects, and pedestrians in real-time and make informed decisions is integral to vehicle safety for both the drivers in the autonomous cars, as well as others on the road. By combining methodologies like image segmentation and K-means clustering, devices are able to analyze visual data, extract important insights, and make informed decisions. As technology continues to advance, image processing and machine learning will play an increasingly significant role in the world.

References:

https://nanonets.com/blog/machine-learning-image-processing/#what-is-image-processing-and-why-is-it-important https://towardsdatascience.com/understanding-k-means-clustering-in-machine-learning-6a6e67336aa1 https://www.geeksforgeeks.org/image-segmentation-using-k-means-clustering/ https://blogs.nvidia.com/blog/drive-labs-panoptic-segmentation/ https://www.researchgate.net/figure/Brain-lesion-segmentation-using-K-means-A-representative-brain-lesion-segmented-using_fig1_336433841 https://builtin.com/machine-learning/image-segmentation https://linguisticmaz.medium.com/k-means-clustering-clearly-explained-4b61d013ed46 https://towardsdatascience.com/clear-and-visual-explanation-of-the-k-means-algorithm-applied-to-image-compression-b7fdc547e410