Garbage can surface pollution detection method and system based on color features
By using a color feature-based method for detecting surface contamination in trash cans, and employing instance segmentation and an adaptive weight calculation model, the method achieves accurate detection of the surface contamination status of trash cans. This solves the problem of insufficient detection accuracy in existing technologies and improves the efficiency and robustness of urban sanitation management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG PROPHET BIG DATA CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-05-19
AI Technical Summary
Existing methods for detecting surface contamination in trash cans are not accurate enough in complex and diverse pollution scenarios, have a high false positive rate, lack versatility and robustness, and are difficult to meet the actual needs of large-scale urban sanitation management.
A color-feature-based method for detecting surface contamination in trash cans is adopted. The method identifies trash can areas through instance segmentation algorithm, calculates multi-dimensional color anomaly feature parameters, fuses feature parameters using an adaptive weight calculation model, and combines multi-level contamination level threshold judgment to achieve accurate detection of the surface contamination status of trash cans.
It improves detection efficiency and objectivity, enhances adaptability to complex mixed pollution scenarios, and provides a reliable basis for urban sanitation management decisions.
Smart Images

Figure CN122066973A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of facility and equipment management technology, and in particular relates to a method and system for detecting surface contamination of trash cans based on color characteristics. Background Technology
[0002] With the acceleration of urbanization and the improvement of residents' living standards, the management and maintenance of urban sanitation facilities has become an important part of urban management. As a fundamental infrastructure of urban public health facilities, the cleanliness of garbage bins directly affects the city's image and residents' quality of life. Traditional garbage bin cleaning management mainly relies on regular inspections by sanitation workers and manual judgment. This method is not only labor-intensive and inefficient, but also highly subjective and difficult to standardize. With the rapid development of computer vision and artificial intelligence technologies, automated detection methods based on image processing are gradually being applied to the field of urban sanitation management, providing new technological means for the intelligent monitoring of garbage bin cleanliness.
[0003] Currently, existing methods for detecting surface contamination in trash cans mainly employ simple threshold segmentation or single feature extraction. These methods can only detect a single type of contamination and lack the ability to effectively identify diverse contamination patterns that may simultaneously exist on trash can surfaces in real-world applications, such as large stains, small spots, and colored graffiti. Especially in complex mixed contamination scenarios, traditional image processing methods suffer from insufficient detection accuracy and a high false positive rate due to their limited feature extraction dimensions and lack of adaptability to different contamination scenarios. Furthermore, existing methods often require specific parameter adjustments when dealing with trash cans of different colors and materials, lacking universality and robustness, and thus failing to meet the practical needs of large-scale urban sanitation management.
[0004] Therefore, how to accurately detect the pollution status of trash can surfaces in complex and diverse pollution scenarios has become an urgent technical problem to be solved. Summary of the Invention
[0005] In view of the shortcomings of the prior art, the purpose of the invention is to provide a method and system for detecting surface contamination of trash cans based on color features.
[0006] This invention provides a method for detecting surface contamination in trash cans based on color features, comprising: S1. Obtain an image of a trash can, and perform region recognition on the trash can image using an instance segmentation algorithm to obtain region detection results; S2. Based on the region detection results, extract color features from the trash can image, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set. S3. Input multiple feature parameters from the color anomaly feature set into an adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain a multimodal color anomaly index. S4. The multimodal color anomaly index is classified and determined according to the preset pollution level threshold set to obtain the pollution detection results of the trash can surface.
[0007] According to the present invention, a method for detecting surface contamination of a trash can based on color features, step S1 further includes: S11. Acquire the original image of the trash can, and perform noise suppression processing on the original image using a Gaussian filtering algorithm to obtain a smooth image; S12. Input the smoothed image into the Mask R-CNN model, identify the location of the trash can through semantic segmentation, and obtain the region detection result including the bounding box coordinates and the trash can region mask. S13. Quantize and reduce the RGB color value of each pixel in the smoothed image to obtain a quantized color image.
[0008] According to the present invention, a method for detecting surface contamination of a trash can based on color features, step S2 further includes: S21. Based on the bounding box coordinates, the trash can image is divided into multiple sub-blocks using a grid partitioning algorithm. The local color dispersion of the multiple sub-blocks is calculated to obtain the multi-scale color variation index. S22. Construct a color covariance matrix based on the quantized color image, and perform spatial morphology analysis on the color covariance matrix using an eigenvalue decomposition algorithm to obtain the RGB spatial shape complexity. S23. Input the quantized color image into the K-means clustering algorithm, and use the silhouette coefficient evaluation method to optimize the number of different clusters to obtain the number of color clusters; S24. Summarize the multi-scale color variation index, the RGB space shape complexity, and the number of color clusters to form a color anomaly feature set.
[0009] According to the method for detecting surface contamination of a trash can based on color features provided by the present invention, step S21 further includes: S211. Using a grid division method, calculate the boundary coordinates of multiple sub-blocks based on the bounding box coordinates; S212. For each sub-block, calculate the mask and the three-channel color mean of the region to obtain the color variation score of multiple sub-blocks; S213. Compare the color variation scores of multiple sub-blocks with the first judgment threshold, and filter out the stain judgment scores; S214. Calculate the multi-scale color variation index based on the stain determination score and color variation score of all sub-blocks.
[0010] According to the present invention, a method for detecting surface contamination of a trash can based on color features, step S22 further includes: S221. Calculate the variance and covariance of the three-channel colors based on the quantized color image, and construct the color covariance matrix; S222. Perform eigenvalue decomposition on the color covariance matrix, solve the characteristic equation, and obtain multiple eigenvalues; S223. Calculate the shape complexity of the RGB space based on multiple feature values.
[0011] According to the present invention, a method for detecting surface contamination of trash cans based on color features is provided. In step S23, the K-means clustering algorithm is used to perform a traversal test within a range of cluster numbers containing multiple preset numbers. The silhouette coefficient is used as an evaluation index, and the number of color clusters is determined by the number of clusters corresponding to the maximum silhouette coefficient.
[0012] According to the present invention, a method for detecting surface contamination of a trash can based on color features, step S3 further includes: S31. Calculate the feature weight parameters based on the number of color clusters in the color anomaly feature set, and calculate the first weight corresponding to the multi-scale color variation index in the color anomaly feature set and the second weight corresponding to the RGB space shape complexity in the color anomaly feature set respectively. S32. Adaptively weighted and fused the first weight, the second weight, and the corresponding feature parameters to calculate the multimodal color anomaly index.
[0013] According to the present invention, a method for detecting surface contamination of a trash can based on color features, in step S4, the preset set of contamination level thresholds includes a second determination threshold, a third determination threshold, and a fourth determination threshold. Based on the set of pollution level thresholds, the surface pollution detection results of the trash can include: When the multimodal color anomaly index is less than the second judgment threshold, it is judged to be in a clean state; When the multimodal color anomaly index is greater than or equal to the second judgment threshold and less than the third judgment threshold, it is judged as a mild pollution state. When the multimodal color anomaly index is greater than or equal to the third judgment threshold and less than the fourth judgment threshold, it is judged as a moderate pollution state. When the multimodal color anomaly index is greater than or equal to the fourth judgment threshold, it is judged as a heavily polluted state.
[0014] According to the present invention, a method for detecting surface contamination of a trash can based on color features is provided, wherein the second determination threshold is 0.35, the third determination threshold is 0.65, and the fourth determination threshold is 0.85.
[0015] The present invention also provides a color-feature-based system for detecting surface contamination in trash cans, comprising: Recognition module: used to acquire trash can images, perform region recognition on the trash can images using an instance segmentation algorithm, and obtain region detection results; Extraction module: used to extract color features from the trash can image based on the region detection results, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set; Fusion module: used to input multiple feature parameters from the color anomaly feature set into the adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain a multimodal color anomaly index; Judgment module: used to classify and determine the multimodal color anomaly index according to a preset set of pollution level thresholds, and obtain the pollution detection results of the trash can surface.
[0016] This invention provides a method and system for detecting surface contamination in trash cans based on color features. First, it accurately extracts the mask of the trash can area using an instance segmentation algorithm, effectively eliminating background interference and ensuring the accuracy of subsequent feature extraction. Second, by quantizing and reducing the dimensionality of RGB color values, the color channels are compressed, significantly reducing computational complexity while effectively suppressing noise, laying the foundation for subsequent multi-dimensional feature analysis. Furthermore, the multi-dimensional color anomaly feature set constructed in this invention covers three key dimensions: local spatial variation, global morphological distribution, and color richness. Calculating the multi-scale color variation index through grid partitioning accurately captures the spatial distribution characteristics of local stains. Eigenvalue decomposition based on the color covariance matrix reveals the geometric morphological changes of point clouds in RGB space, and the K-means clustering algorithm effectively identifies the main color categories in the image. The three elements work synergistically to comprehensively characterize the contamination status of the trash can surface. Furthermore, this invention innovatively employs an adaptive weighting calculation model based on the number of color clusters. It dynamically adjusts the fusion weights of each feature parameter according to the color type. For simple pollution scenarios with few colors, a linear weighting strategy is used to highlight local variation features. For complex pollution scenarios with multiple colors, square root transformation and cross-enhancement terms are introduced to balance the impact of extreme values and reflect the synergistic effect between features, ensuring reliable comprehensive evaluation results under different pollution scenarios. This invention also establishes a multi-level pollution threshold determination mechanism, which can accurately classify the surface condition of garbage cans into multiple levels, providing clear decision-making basis for urban sanitation management. Compared with traditional manual inspection methods, it significantly improves detection efficiency and objectivity, and compared with simple threshold segmentation methods, it significantly enhances adaptability to complex mixed pollution scenarios. Attached Figure Description
[0017] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. It is obvious that the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings.
[0018] Figure 1 A schematic diagram of a method for detecting surface contamination in a trash can based on color features, provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a system structure for a method for detecting surface contamination in trash cans based on color features, provided in an embodiment of the present invention. Detailed Implementation
[0019] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0020] Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts disclosed in this invention.
[0021] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The terms "installed," "connected," and "linked" should be interpreted broadly; for example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0022] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with some aspects of the invention as detailed in the appended claims.
[0023] The embodiments of the present invention are described below with reference to the figures.
[0024] like Figure 1 As shown, the present invention provides a method for detecting surface contamination of trash cans based on color features, comprising: S1. Obtain an image of the trash can, and perform region recognition on the trash can image using an instance segmentation algorithm to obtain region detection results.
[0025] Step S1 further includes: S11. Acquire the original image of the trash can, and perform noise suppression processing on the original image using a Gaussian filtering algorithm to obtain a smooth image.
[0026] In step S11, the present invention first uses Gaussian filtering to smooth the image of the trash can detected by the camera, aiming to remove noise caused by uneven ambient lighting and shooting equipment, while retaining the edge information of the stains.
[0027] S12. Input the smoothed image into the Mask R-CNN model, identify the location of the trash can through semantic segmentation, and obtain the region detection result including the bounding box coordinates and the trash can region mask.
[0028] In step S12, the present invention first acquires an image of the trash can using a camera, including the coordinates of the box containing the trash can. And the bounding box, and then the trash can area segmented by the Mask R-CNN model. ,in The coordinates of the left vertex of the box. The width of the box. The height of the box.
[0029] S13. Quantize and reduce the RGB color value of each pixel in the smoothed image to obtain a quantized color image.
[0030] In step S13, the present invention sets the RGB coordinates of each pixel. The new color coordinates are obtained by quantization, and the expression is: in, The new color coordinates obtained through quantization processing, These are the pixel coordinates. As a rounding function, this invention quantizes each color channel from 256 levels to 64 levels. Because too many colors will cause noise interference in subsequent color statistical analysis and the computational complexity will be too high, the quantization in step S13 not only reduces the amount of computation, but also plays a further role in noise reduction, while retaining sufficient color discrimination ability.
[0031] S2. Based on the region detection results, extract color features from the trash can image, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set.
[0032] Step S2 further includes: S21. Based on the bounding box coordinates, the trash can image is divided into multiple sub-blocks using a grid partitioning algorithm. The local color dispersion of the multiple sub-blocks is calculated to obtain the multi-scale color variation index.
[0033] Step S21 further includes: S211. Using a grid division method, calculate the boundary coordinates of multiple sub-blocks based on the bounding box coordinates.
[0034] In step S211, the present invention uses a 16x16 grid division method, taking 15 points on the width and height of the box and adding two vertices to divide the entire image into 256 sub-blocks. For any box coordinates... The expression is: in, The number of the sub-block. , .
[0035] S212. For each sub-block, calculate the region determination mask and the three-channel color mean to obtain the color variation score of multiple sub-blocks.
[0036] Next, calculate the color variation score of all pixels within each block on the three RGB color channels, as shown in the expression: in, For the first The score for color variation of each sub-block's frame. For pixels The criteria for determining whether something belongs to a trash can area are based on a score. For the first The red channels in each sub-block are all worth dividing. For the first Each green channel in a sub-block is worth scoring. For the first Each blue channel in a sub-block is worth scoring.
[0037] in, For pixels The criterion score for determining whether an area belongs to a trash can is expressed as follows: The expression for the average score of the red values in the box is: The expression for the average score of the green area within the box is: The expression for the average score of the blue area within the box is: S213. Compare the color variation scores of multiple sub-blocks with the first judgment threshold to filter out the stain judgment scores; S214. Calculate the multi-scale color variation index based on the stain judgment scores and color variation scores of all sub-blocks.
[0038] Furthermore, the expression for the stain determination score is as follows: in, To determine the score for the stain, Using the set first judgment threshold, the color variation score of each image block with stains is calculated by collecting images of trash cans with excessively dirty surfaces and following the method described above. The score is then calculated based on the minimum value of the score distribution. The expression for the multi-scale color variation index is: in, It is a multi-scale color variation index.
[0039] S22. Construct a color covariance matrix based on the quantized color image, and perform spatial morphology analysis on the color covariance matrix using an eigenvalue decomposition algorithm to obtain the RGB spatial shape complexity.
[0040] Step S22 further includes: S221. Calculate the variance and covariance of the three-channel colors based on the quantized color image, and construct the color covariance matrix.
[0041] Furthermore, the expression for obtaining the color covariance matrix of the image is as follows: in, To establish the color covariance matrix, Let Variance be the variance of the red channel. The covariance of the red and green channels, The covariance of the red and blue channels, The covariance of the green and red channels, The variance of the green channel. The covariance of the blue and red channels, The covariance of the blue and green channels, This represents the variance of the blue channel.
[0042] in, The expression for the average value of the red area is: in, The expression for the mean green value of the region is: in, The expression for the average value of the blue area is: In the above formula, the diagonal elements of the matrix represent the variance of each color channel, reflecting the dispersion of the color values of that channel, while the off-diagonal elements represent the covariance between different channels, reflecting the correlation between channels.
[0043] S222. Perform eigenvalue decomposition on the color covariance matrix, solve the characteristic equation, and obtain multiple eigenvalues.
[0044] Furthermore, in step S222, the present invention applies the color covariance matrix... Perform eigenvalue decomposition and solve the characteristic equation: in, For eigenvalues, It is the identity matrix. This refers to determinant operations.
[0045] After solving, three eigenvalues are obtained. ,in For a clean, single-color trash can, the three eigenvalues are close and very small, and the point cloud clusters spherically; for a trash can with multi-color contamination, It will be much greater than and The point clouds are distributed in ellipsoidal or stripe shapes.
[0046] S223. Calculate the shape complexity of the RGB space based on multiple feature values.
[0047] In step S223, the shape complexity of the RGB space is calculated. The expression is: in To prevent the denominator from being 0.
[0048] S23. Input the quantized color image into the K-means clustering algorithm, and optimize the number of different clusters by using the contour coefficient evaluation method to obtain the number of color clusters.
[0049] In step S23, the K-means clustering algorithm is used to traverse and test within a range of cluster numbers containing multiple preset numbers. The silhouette coefficient is used as the evaluation index, and the number of color clusters is determined by the number of clusters corresponding to the maximum silhouette coefficient.
[0050] In step S23, the present invention first uses the K-means clustering algorithm to determine the approximate number of main colors in the image, trying different numbers of clusters between 1 and 8, and then selects the optimal number of clusters using the silhouette coefficient method, finally obtaining the number of color clusters. The range of values is .
[0051] S24. Summarize the multi-scale color variation index, the RGB space shape complexity, and the number of color clusters to form a color anomaly feature set.
[0052] S3. Input multiple feature parameters from the color anomaly feature set into the adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain the multimodal color anomaly index.
[0053] Step S3 further includes: S31. Calculate feature weight parameters based on the number of color clusters in the color anomaly feature set, and calculate the first weight corresponding to the multi-scale color variation index in the color anomaly feature set and the second weight corresponding to the RGB space shape complexity in the color anomaly feature set.
[0054] In step S31, the present invention determines the number of color clusters. Calculate the weighted multiscale color variation index of the other two eigenvalues. The corresponding weights and the shape complexity of the RGB space. The corresponding weights are calculated as follows: in, The weights corresponding to the multi-scale color variation index are the first weights. This represents the weight corresponding to the shape complexity of the RGB space, i.e., the second weight. In the above expression, a small number of clusters indicates a limited variety of colors, in which case local color variations are key to determining contamination. A large number of clusters indicates a rich variety of colors, in which case the geometric complexity of the RGB space better reflects the degree of contamination.
[0055] S32. Adaptively weighted and fused the first weight, the second weight, and the corresponding feature parameters to calculate the multimodal color anomaly index.
[0056] In step S32, the present invention calculates the multimodal color anomaly index based on three feature values and their corresponding weights, expressed as: in, This is the multimodal color anomaly index. In the above expression, for simple pollution scenarios with few colors, this invention uses two parameters kept at their original values and linearly weighted. For complex pollution scenarios with many colors, this invention first... Perform a square root transformation to reduce the impact of extreme values, and introduce a cross-enhancement term. This reflects the synergistic effect of local changes and global form. The cross term coefficient of 0.35 reflects the coupling effect of spatial variation and morphological complexity in multi-color scenes, and is an empirical constant obtained after testing a large amount of data.
[0057] S4. The multimodal color anomaly index is classified and determined according to the preset pollution level threshold set to obtain the pollution detection results of the trash can surface.
[0058] In step S4, the preset set of pollution level thresholds includes a second determination threshold, a third determination threshold, and a fourth determination threshold; the second determination threshold is 0.35, the third determination threshold is 0.65, and the fourth determination threshold is 0.85.
[0059] According to the set of pollution level thresholds, the surface pollution detection results of the trash can include: when the multimodal color anomaly index is less than the second judgment threshold, it is determined to be in a clean state; when the multimodal color anomaly index is greater than or equal to the second judgment threshold and less than the third judgment threshold, it is determined to be in a lightly polluted state; when the multimodal color anomaly index is greater than or equal to the third judgment threshold and less than the fourth judgment threshold, it is determined to be in a moderately polluted state; and when the multimodal color anomaly index is greater than or equal to the fourth judgment threshold, it is determined to be in a heavily polluted state.
[0060] In step S4, based on statistical analysis of a large number of labeled samples, the present invention sets three thresholds and classifies the surface condition of trash cans into four levels: clean: Below the second judgment threshold (0.35) indicates that the surface is basically free of stains and requires no cleaning; lightly contaminated: Second judgment threshold and the third judgment threshold A value between 0.35 and 0.65 indicates minor stains or light dust; cleaning within 24 hours is recommended. Moderate contamination: In the third judgment threshold and the fourth judgment threshold A value between 0.65 and 0.85 indicates a noticeable stain or a large area, and cleaning within 12 hours is recommended; heavily soiled: Higher than the fourth judgment threshold (0.85) indicates that the stain is severe and affects the environment; immediate cleaning is recommended.
[0061] like Figure 2 As shown, the present invention also provides a color-feature-based trash can surface contamination detection system, comprising: Recognition module 100: used to acquire trash can images, perform region recognition on the trash can images using an instance segmentation algorithm, and obtain region detection results; Extraction module 200: used to extract color features from the trash can image based on the region detection results, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set; Fusion module 300: is used to input multiple feature parameters from the color anomaly feature set into an adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain a multimodal color anomaly index; Judgment module 400: is used to classify and determine the multimodal color anomaly index according to a preset set of pollution level thresholds, and obtain the pollution detection results of the trash can surface.
[0062] This invention accurately extracts trash can areas using an instance segmentation algorithm and performs color quantization, effectively reducing computational complexity and suppressing noise interference. Secondly, the constructed multi-dimensional color anomaly feature set comprehensively depicts the pollution status from three dimensions: local spatial variation, global morphological distribution, and color richness. Furthermore, it employs an adaptive weight fusion mechanism based on the number of color clusters to dynamically adjust feature weights for different pollution scenarios. Simultaneously, it achieves accurate classification of pollution levels through multi-level threshold determination. Compared to traditional methods, this significantly improves the detection accuracy and robustness in complex mixed pollution scenarios, providing reliable technical support for intelligent urban sanitation management.
[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the protection scope of the present invention.
Claims
1. A method for detecting surface contamination in trash cans based on color features, characterized in that, include: S1. Obtain an image of a trash can, and perform region recognition on the trash can image using an instance segmentation algorithm to obtain region detection results; S2. Based on the region detection results, extract color features from the trash can image, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set. S3. Input multiple feature parameters from the color anomaly feature set into an adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain a multimodal color anomaly index. S4. The multimodal color anomaly index is classified and determined according to the preset pollution level threshold set to obtain the pollution detection results of the trash can surface.
2. The method for detecting surface contamination of a trash can based on color features according to claim 1, characterized in that, Step S1 further includes: S11. Acquire the original image of the trash can, and perform noise suppression processing on the original image using a Gaussian filtering algorithm to obtain a smooth image; S12. Input the smoothed image into the Mask R-CNN model, identify the location of the trash can through semantic segmentation, and obtain the region detection result including the bounding box coordinates and the trash can region mask. S13. Quantize and reduce the RGB color value of each pixel in the smoothed image to obtain a quantized color image.
3. The method for detecting surface contamination of a trash can based on color features according to claim 2, characterized in that, Step S2 further includes: S21. Based on the bounding box coordinates, the trash can image is divided into multiple sub-blocks using a grid partitioning algorithm. The local color dispersion of the multiple sub-blocks is calculated to obtain the multi-scale color variation index. S22. Construct a color covariance matrix based on the quantized color image, and perform spatial morphology analysis on the color covariance matrix using an eigenvalue decomposition algorithm to obtain the RGB spatial shape complexity. S23. Input the quantized color image into the K-means clustering algorithm, and use the silhouette coefficient evaluation method to optimize the number of different clusters to obtain the number of color clusters; S24. Summarize the multi-scale color variation index, the RGB space shape complexity, and the number of color clusters to form a color anomaly feature set.
4. The method for detecting surface contamination of a trash can based on color features according to claim 3, characterized in that, Step S21 further includes: S211. Using a grid division method, calculate the boundary coordinates of multiple sub-blocks based on the bounding box coordinates; S212. For each sub-block, calculate the mask and the three-channel color mean of the region to obtain the color variation score of multiple sub-blocks; S213. Compare the color variation scores of multiple sub-blocks with the first judgment threshold, and filter out the stain judgment scores; S214. Calculate the multi-scale color variation index based on the stain determination score and color variation score of all sub-blocks.
5. The method for detecting surface contamination of a trash can based on color features according to claim 3, characterized in that, Step S22 further includes: S221. Calculate the variance and covariance of the three-channel colors based on the quantized color image, and construct the color covariance matrix; S222. Perform eigenvalue decomposition on the color covariance matrix, solve the characteristic equation, and obtain multiple eigenvalues; S223. Calculate the shape complexity of the RGB space based on multiple feature values.
6. The method for detecting surface contamination of a trash can based on color features according to claim 3, characterized in that, In step S23, the K-means clustering algorithm is used to traverse and test within a range of cluster numbers containing multiple preset numbers. The silhouette coefficient is used as the evaluation index, and the number of color clusters is determined by the number of clusters corresponding to the maximum silhouette coefficient.
7. The method for detecting surface contamination of a trash can based on color features according to claim 1, characterized in that, Step S3 further includes: S31. Calculate the feature weight parameters based on the number of color clusters in the color anomaly feature set, and calculate the first weight corresponding to the multi-scale color variation index in the color anomaly feature set and the second weight corresponding to the RGB space shape complexity in the color anomaly feature set respectively. S32. Adaptively weighted and fused the first weight, the second weight, and the corresponding feature parameters to calculate the multimodal color anomaly index.
8. The method for detecting surface contamination of a trash can based on color features according to claim 1, characterized in that, In step S4, the preset set of pollution level thresholds includes a second judgment threshold, a third judgment threshold, and a fourth judgment threshold. Based on the set of pollution level thresholds, the surface pollution detection results of the trash can include: When the multimodal color anomaly index is less than the second judgment threshold, it is judged to be in a clean state; When the multimodal color anomaly index is greater than or equal to the second judgment threshold and less than the third judgment threshold, it is judged as a mild pollution state. When the multimodal color anomaly index is greater than or equal to the third judgment threshold and less than the fourth judgment threshold, it is judged as a moderate pollution state. When the multimodal color anomaly index is greater than or equal to the fourth judgment threshold, it is judged as a heavily polluted state.
9. A method for detecting surface contamination of a trash can based on color features according to claim 8, characterized in that, The second determination threshold is 0.35, the third determination threshold is 0.65, and the fourth determination threshold is 0.
85.
10. A color-feature-based system for detecting surface contamination in trash cans, characterized in that, include: Recognition module: used to acquire trash can images, perform region recognition on the trash can images using an instance segmentation algorithm, and obtain region detection results; Extraction module: used to extract color features from the trash can image based on the region detection results, calculate multi-dimensional color anomaly feature parameters, and obtain a color anomaly feature set; Fusion module: used to input multiple feature parameters from the color anomaly feature set into the adaptive weight calculation model, and fuse the multiple feature parameters through a dynamic weighting algorithm to obtain a multimodal color anomaly index; Judgment module: used to classify and determine the multimodal color anomaly index according to a preset set of pollution level thresholds, and obtain the pollution detection results of the trash can surface.