Open Access Paper
11 September 2023 Image segmentation algorithm based on multi-granularity clustering
Author Affiliations +
Proceedings Volume 12779, Seventh International Conference on Mechatronics and Intelligent Robotics (ICMIR 2023); 1277924 (2023) https://doi.org/10.1117/12.2688915
Event: Seventh International Conference on Mechatronics and Intelligent Robotics (ICMIR 2023), 2023, Kunming, China
Abstract
This article proposes an image processing algorithm based on multi-scale clustering, which can improve the probability of a classifier correctly classifying an image even after it has been subjected to noise attacks. The algorithm mainly involves performing multi-scale clustering on the pixels of the image based on features such as color space, distance, texture, etc., and then incorporating the clustering results into the training of the classifier. By directly extracting the main feature information from the image for training, the algorithm prevents large classification errors due to changes in certain pixel values, thus reducing the impact of attacks on other pixels in the image and greatly improving the robustness of the image. Therefore, this algorithm is a robust and efficient denoising method.

1.

INTRODUCTION

With the development of information technology, in order to enhance the information processing of images, there is digital image processing 1. It refers to the use of computers or other devices to digitally process image information, including segmentation, restoration, enhancement, exchange, analysis, and description, etc 2. A crucial stage in image processing and computer vision is the pre-processing stage, which involves filtering methods and image denoising techniques. In recent years, clustering algorithms have received a great deal of attention from researchers in image pre-processing techniques 3.

Clustering, as an analysis tool in data mining, is also an important method in image segmentation. From the perspective of clustering, image segmentation can be seen as a process of clustering all pixels based on their gray scale and features 4. Image segmentation is a special image processing method that has been studied for many years without a unified method or judgment standard. Common image segmentation methods in traditional machine learning include region growing, threshold segmentation, and k-means clustering segmentation 5. Image segmentation refers to dividing an image into several mutually exclusive and non-overlapping regions based on meaningful features in the image, Make the pixels in the same image area show consistency or similarity, but there are obvious differences at the boundaries of different areas6. Image segmentation is an important issue in the field of image processing. Effective and reasonable image segmentation can extract useful information for image classification, pattern recognition, and make high-level image understanding possible. n fact, the traditional image segmentation classifies the pixels in the image based on image features such as grayscale, color, and space, feature space clustering methods have broad application prospects in the field of image segmentation7.

After 2012, the convolutional neural network has been greatly developed. At the same time, it is also used in the field of image segmentation. The researchers converted the manually designed features in the traditional image segmentation algorithm into the features learned by the CNN model, and then the model performed feature extraction and downsampling through operations such as convolution and pooling on the features, and further compressed the feature map to extract more accurate images. high level features 8. However, recent studies have shown that convolutional neural networks are vulnerable to adversarial examples9. This phenomenon was first proposed in the field of image classification. By adding small artificially designed perturbations to clean images, convolutional neural networks can be misclassified10. According to the degree of understanding of the internal information of the target model, adversarial attacks can be divided into white-box and black-box attacks. In white-box attacks11, the attacker has all the information of the attacked model. Such attacks are relatively simple, but the actual The scene has great limitation. In the black box attack, the attacker cannot obtain the internal information of the model, but according to whether the model output can be accessed, it can be divided into access attack and migration attack. The gradient to achieve the attack, this attack requires a large number of visits, and its abnormal traffic is easy to be monitored, so it has certain limitations.

In summary, neural networks may suffer from attacks during image recognition, which makes them very unstable and vulnerable to exploitation. Moreover, these attacks only make minimal changes to the image pixels, making them imperceptible to the human eye. To improve the probability of correct image recognition by neural networks under adversarial sample attacks, this paper proposes a preprocessing method that reduces the impact of noise. The main contribution of this paper is summarized as follows: by performing multi-scale clustering on image pixels and then incorporating them into network training, this method can defend against such attacks12.

  • (1) This algorithm proposes a new image segmentation method to improve the robustness of the trained neural network model.

  • (2) This algorithm is effective against most types of noise, reducing the probability of misclassification due to image quality issues in most cases.

  • (3) This algorithm has a significant improvement compared to traditional machine learning clustering segmentation algorithms, as it only requires one parameter to adaptively cluster different types of images.

The rest of the paper is organized as follows. Part II provides a detailed introduction to the specific content of granular image clustering, Part III presents the experimental analysis and discussion, and Part IV gives the conclusion.

2.

ALGORITHM OF IMAGE MULTISCALE CLUSTERING PROCESSING

2.1

Multi-Granularity Clustering Theory

Human perception of images has a large-scale priority characteristic. The human brain observes things starting from the big features and moves from the general to the details13. Although the information received is comprehensive, when analyzing these things, people always start with a macroscopic perspective and then delve into the micro level of things14. Just like when people see a selfie, they always first see the outline of the face in the photo, then look at the nose, eyes, and some small features. Based on the granularity theory, this paper proposes the granularity cognition theory15. Currently, granule theory has been applied to rough sets, sampling, classificatio, and has achieved good results. The applicability and authenticity of granule theory have been validated.

Definition 1: Given a data set D ⊆ R^N and D’ ⊆ D (D’ ≠ ∅), the granule ball GB generated is defined as having a center point C, a radius r, and a set of all points in the ball as D’. C is the center of all sampling points in the ball, r is the average distance from all sampling points to the center of the ball. For any point xi∈D’ (i = 1, 2, …, K), where K is the number of data points in the ball.

00116_PSISDG12779_1277924_page_2_1.jpg
00116_PSISDG12779_1277924_page_2_2.jpg

Finally, in the resulting clustering, some points may be isolated into very small spheres between several larger ones. However, according to the granularity cognitive theory, the absence of these points will not affect the overall judgment. These points are equivalent to outliers in the overall sample, and their small number will not affect the results. It is possible to choose better-quality data to replace the entire dataset, as long as the classification boundary is well described at the granularity scale. The points within the sphere do not need to be identical, as sometimes noise needs to be tolerated. Although these points are close during clustering, their actual labels may differ significantly, indicating that they are likely noise points. Therefore, the purity of the sphere needs to be adjusted as required. If these points are too numerous, the sphere will be large, and if the sphere cannot tolerate outliers, it will be small16. If all spheres do not have outliers, the result is the same as that without clustering, and the noise is not processed at all17.

Definition 2: Given a data set D⊆RN and D’⊆D (D’≠∅), the granule GB generated will have its center defined as C, and its point set defined as D’. C is the center of all the sampling points in the sphere, and it is not a real sample. ri is the distance from xi to C. For any point xi∈D’ (i=1,2,…,K), where K is the number of data points in the sphere, |y| represents the number of points where ri<threshold.

00116_PSISDG12779_1277924_page_3_1.jpg

According to the above concepts and theories, the process of forming granules can be obtained. The first step is to randomly generate m balls that cover most of the samples through clustering, as shown in Figure 1(a), where m is the number of balls. The focus is on the second step of classifying the data set. Then, the centers of two granules are determined based on Definition 1. If the purity requirements are not satisfied between two granules, the granules are split further to generate more granules, as shown in Figure 1(b). The granules that meet the purity conditions remain unchanged and stop splitting, while the others continue to split until the purity of all cores meets the requirements, as shown in Figure 1(c). It can be seen that after all the balls are divided, all sample points are successfully clustered together.

Fig.1

granule iterative process.(a)first iteration; (b) intermediate results; (c) Granule clustering complete.

00116_PSISDG12779_1277924_page_3_2.jpg

2.2

Multi-Granularity Image Clustering Algorithm

The main idea of the granular ball image clustering algorithm is shown in Figure 2(a). Figure 2(a) shows the distribution of each pixel in the feature space, which is represented in two-dimensional space, but in reality, it may be multidimensional due to the RGB channels and spatial coordinate information of the image. In Figure 2(b), all the points are clustered into spheres represented by Bi (i=1,2,…,n). These spheres can be treated as a whole, represented by their centers. After obtaining these spheres, the algorithm calculates the purity of each sphere through the similarity measure in the sphere, if the sphere purity does not meet the conditions, continue to split the sphere through 2-means, as shown in Figure 2(c). In the end, all the spheres are clustered successfully, and the data points not in the spheres are noise points, which need to be removed, as shown in Figure 2(d). As shown in Figure 2(e), there is no more noise in the final data.

Fig. 2.

The splitting process of granules in the dataset (a) The original data set;(b) granule initial disintegration; (c) Granular iterative clustering; (d) Remove noise points in the ball; (e) get final data.

00116_PSISDG12779_1277924_page_4_1.jpg

2.3

Analysis of denoising in granular image clustering

The particle clustering algorithm is described as Algorithm 1 above. The multi-scale clustering denoising algorithm for image data mainly consists of three parts: image pixel sample generation, sample multi-scale clustering, and clustering result processing. In Step 2, the image is first converted into a two-dimensional data format, where the image of size (h, w, 3) is transformed into (w*h, 3), with each pixel’s feature being its RGB value. The second step is to cluster all samples. Here, the entire data set is initially treated as a large sphere, and then, in Steps 6 to 18, the algorithm iteratively clusters the data until the number of spheres no longer changes, indicating the clustering has become stable. In Steps 7 to 17, the algorithm first performs purity analysis on a sphere, comparing the data points in the sphere to its center, and identifying the number of noisy data points that are farther than the given threshold from the sphere center. If the number of noisy points is greater than the given purity value, the algorithm then performs a 2-kmeans clustering on that sphere (Bi). In this way, the size and number of sphere divisions are determined based on the threshold and purity, where the threshold is typically fixed, but the purity can be designed for different scenarios.

Algorithm 1:

Generate image pixel samples

00116_PSISDG12779_1277924_page_5_1.jpg

3.

EXPERIMENT

This section mainly presents the effectiveness of the granule image clustering algorithm from two aspects: the visual effect of the image obtained by different image clustering processing algorithms and the accuracy of the image after processing in the face of noise interference.

The dataset used in the experiment mainly comes from the CIFAR-10 dataset, and the noise addition algorithm mainly uses FGSM. The image processing algorithm in this part mainly shows the effect through some large images, comparing the results with different thresholds and purities, and comparing the effects of processed images with those without processing.

3.1

Comparison of image results at different purities

First, a normal image is used and its pixels are converted into different sample points for clustering. The purity can be set to a fixed value, and the number of final images can be viewed by adjusting the threshold. Alternatively, the threshold can be fixed, and the purity can be adjusted to observe the effect of the image and the number of particles. The following results show the difference between the images obtained by basic k-means clustering and those obtained by multi-scale clustering. The specific effect is shown in Figure 3.

Fig. 3.

K-means algorithm image segmentation results

00116_PSISDG12779_1277924_page_6_1.jpg

These three images show the results of k-means clustering with k=2, k=10, and k=50, respectively. It can be clearly seen that as the number of clusters increases, the colors in the image become more diverse. The specific effect is shown in Figure 4.

Fig. 4.

The image processing result of this algorithm

00116_PSISDG12779_1277924_page_6_2.jpg

These three images show the cases where the difference between the gray value of the points inside the ball and the gray value of the center point is within 40, 20, and 10, respectively.

Compared with the results obtained by k-means clustering, the images processed by the multi-scale clustering algorithm show significant improvements in the color difference on both sides of the edges. This is because the value of k in k-means is fixed, which may cause even pixels with similar colors to be classified into different clusters, leading to a significant difference in colors on the edges or even the edges being clustered with the colors on both sides. Such differences can have a significant impact on image classification, which requires more details from the images. Therefore, k-means is not suitable for image processing before image classification.

In the multi-scale clustering algorithm, the splitting conditions for the particles involved in image classification, namely the threshold and purity, actually only need to adjust one of them during actual use. The purity is mainly based on the quality of the image. If the quality is not good, the purity can be reduced to prevent interference. The threshold adjustment scenario is based on whether the colors in the image are rich or not. If the colors in the image are monotonous, the threshold can be reduced to retain more details. However, in the case of rich colors, unnecessary features can be reduced to prevent them from interfering with the classification results.

3.2

Image performance under noise attack

This experiment uses Gaussian noise to add noise to MNIST data, and this experiment mainly uses Resnet as a classifier, and then uses this algorithm to process the image after adding noise, and compares the results with the original results. The results are shown in Table 1:

Table 1.

Effect of neutrophil processing on images under Gaussian noise.

GAUSSIAN AMPLITUDEGRANULOCYTE PROCESSINGUNPROCESSED
189.7590.39
584.5877.43
1063.0849.35

It can be seen from the results that the prediction accuracy of the classification model continues to decline rapidly under the condition that the Gaussian noise intensity of the image without multi-granularity processing is continuously strengthened. However, after the image is processed, it can be seen that the prediction accuracy of the image disturbed by noise in the classifier decreases slower.

Gaussian noise is just a common natural noise. The threat to classifiers is adversarial example attacks. Adversarial example attacks can specifically perturb a model, causing it to be misclassified. Therefore, the following will use FGSM to attack the image, and then test whether the algorithm can resist the attack. Since the adversarial example attack is best used for color images, the data set used in this experiment is CIFAR10, and the attack results are shown in Table 2:

Table 2.

Effect of neutrophil processing on images under FGSM

EPSGRANULOCYTE PROCESSINGUNPROCESSED
095.0395.18
0.273.6068.53

4.

CONCLUSION

Image preprocessing technology has undergone long-term development, and many mature algorithms have been produced in this field, and because of the excellent effect of these algorithms, they have been applied to many fields. In this paper, the multi-granularity clustering algorithm and the image segmentation algorithm are combined, and a new image preprocessing algorithm is proposed, and then the effect of the algorithm is verified by experiments. The multi-granularity clustering algorithm is used to replace the traditional clustering algorithm to process the image, and its implementation details are improved to better match the image processing. Compared with the traditional algorithm, this algorithm can better preserve the edge information and quality of the image, and has higher efficiency. This algorithm proposes to use image preprocessing to defend against noise attacks in image classification. Since the image data is easily attacked by noise during the classification process, this will cause the prediction accuracy of the classifier to be affected. Therefore, this paper proposes preprocessing the noisy data to reduce the impact of these noise attacks.

REFERENCES

[1] 

Currie, G., Hawk, K. E., Rohren, E., Vial, A., Klein, R., “Machine learning and deep learning in medical imaging: intelligent imaging,” Journal of medical imaging and radiation sciences, 50 (4), 477 –487 (2019). https://doi.org/10.1016/j.jmir.2019.09.005 Google Scholar

[2] 

Minaee, S., Boykov, Y., Porikli, F., Plaza, A., Kehtarnavaz, N., Terzopoulos, D., “Image segmentation using deep learning: A survey,” IEEE transactions on pattern analysis and machine intelligence, 44 (7), 3523 –3542 (2021). Google Scholar

[3] 

Fan, L., Zhang, F., Fan, H., Zhang, C., “Brief review of image denoising techniques,” Visual Computing for Industry, Biomedicine, and Art, 2 (1), 1 –12 (2019). https://doi.org/10.1186/s42492-019-0016-7 Google Scholar

[4] 

Minaee, S., Boykov, Y., Porikli, F., Plaza, A., Kehtarnavaz, N., Terzopoulos, D., “Image segmentation using deep learning: A survey,” IEEE transactions on pattern analysis and machine intelligence, 44 (7), 3523 –3542 (2021). Google Scholar

[5] 

Nixon, M., Aguado, A., “Feature extraction and image processing for computer vision,” Academic press(2019). Google Scholar

[6] 

Huang, H., Meng, F., Zhou, S., Jiang, F., Manogaran, G., “Brain image segmentation based on FCM clustering algorithm and rough set,” IEEE Access, 7 12386 –12396 (2019). https://doi.org/10.1109/Access.6287639 Google Scholar

[7] 

Bhandari, A. K., Singh, A., Kumar, I. V., “Spatial context energy curve-based multilevel 3-D Otsu algorithm for image segmentation,” IEEE Transactions on Systems, Man, and Cybernetics: Systems, 51 (5), 2760 –2773 (2019). https://doi.org/10.1109/TSMC.2019.2916876 Google Scholar

[8] 

Li, Z., Liu, F., Yang, W., Peng, S., Zhou, J., “A survey of convolutional neural networks: analysis, applications, and prospects,” IEEE transactions on neural networks and learning systems, (2021). Google Scholar

[9] 

Tramer, F., Carlini, N., Brendel, W., Madry, A., “On adaptive attacks to adversarial example defenses,” Advances in neural information processing systems, 33 1633 –1645 (2020). Google Scholar

[10] 

Yefet, N., Alon, U., Yahav, E., “Adversarial examples for models of code[J],” in Proceedings of the ACM on Programming Languages, 1 –30 (2020). Google Scholar

[11] 

Li, Y., Li, L., Wang, L., Zhang, T., Gong, B., “Nattack: Learning the distributions of adversarial examples for an improved black-box attack on deep neural networks,” in In International Conference on Machine Learning, 3866 –3876 (2019). Google Scholar

[12] 

Huang, J., Wang, T., Zheng, D., He, Y., “Nucleus segmentation of cervical cytology images based on multi-scale fuzzy clustering algorithm,” Bioengineered, 11 (1), 484 –501 (2020). https://doi.org/10.1080/21655979.2020.1747834 Google Scholar

[13] 

Xia, S., Wang, G., Chen, Z., Duan, Y., “Complete random forest based class noise filtering learning for improving the generalizability of classifiers,” IEEE Transactions on Knowledge and Data Engineering, 31 (11), 2063 –2078 (2018). https://doi.org/10.1109/TKDE.69 Google Scholar

[14] 

Gao, W., Wang, L., Zhou, Z. H., “Risk minimization in the presence of label noise,” in In Proceedings of the AAAI Conference on Artificial Intelligence, (2016). Google Scholar

[15] 

Xia, S. Y., Zhang, H., Li, W., Wang, G., Giem, E., Chen, Z., “GBNRS: A novel rough set algorithm for fast adaptive attribute reduction in classification,” IEEE Transactions on Knowledge and Data Engineering, 34 (3), 1231 –1242 (2020). https://doi.org/10.1109/TKDE.2020.2997039 Google Scholar

[16] 

Xia, S. Y., et al., “Granular ball sampling for noisy label classification or imbalanced classification,” IEEE Transactions on Neural Networks and Learning Systems, (2021). Google Scholar

[17] 

Xia, S. Y., et al., “Granular ball computing classifiers for efficient, scalable and robust learning,” Information Sciences, 483 136 –152 (2019). https://doi.org/10.1016/j.ins.2019.01.010 Google Scholar
© (2023) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
Shuyin Xia, Cenjun Xia, Dawei Dai, and Jinyuan Ni "Image segmentation algorithm based on multi-granularity clustering", Proc. SPIE 12779, Seventh International Conference on Mechatronics and Intelligent Robotics (ICMIR 2023), 1277924 (11 September 2023); https://doi.org/10.1117/12.2688915
Advertisement
Advertisement
RIGHTS & PERMISSIONS
Get copyright permission  Get copyright permission on Copyright Marketplace
KEYWORDS
Image processing

Image segmentation

Optical spheres

Image processing algorithms and systems

Image classification

Image quality

Education and training

Back to Top