Food spoilage detection method and system based on image processing

Through high-resolution image processing and feature extraction technology, combined with fuzzy C-means clustering and generalized regression neural network, it solves the problem of low accuracy in food spoilage detection, achieves accurate identification and classification of food spoilage degree, and provides efficient food Safety and security.

CN118397617BActive Publication Date: 2024-09-10XIHUA UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410832762.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-10
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

The existing food spoilage detection methods based on image processing have low detection accuracy, lack effective multi-factor analysis and comprehensive judgment methods, and are difficult to accurately identify and classify the degree of food spoilage.

Method used

High-resolution image acquisition, differential Laplacian enhancement algorithm is used to enhance image edges and contrast, local binary pattern algorithm is used to extract mildew spots, discoloration and texture roughness features, and features are carried out through fuzzy C-means clustering and generalized regression neural network. Fusion and analysis to generate a visual representation of the degree of food spoilage.

Benefits of technology

It improves the accuracy and efficiency of food spoilage detection, can accurately identify the degree of food spoilage, and provides efficient food safety protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397617B
    Figure CN118397617B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and discloses a method and system for detecting food spoilage based on image processing, which are used to improve the efficiency and accuracy of food spoilage detection based on image processing. The method comprises: performing image edge and contrast enhancement on a multi-angle image set to obtain an enhanced image set corresponding to the multi-angle image set; performing image feature extraction on the enhanced image set to obtain an image texture feature set; performing feature fusion on the image texture feature set to obtain a fused feature vector set; inputting the fused feature vector set into a fuzzy C-means clustering algorithm to perform food multi-factor spoilage probability analysis to obtain the food spoilage probability and food spoilage feature data of each factor; inputting the food spoilage probability and food spoilage feature data of each factor into a generalized regression neural network to perform food spoilage degree analysis to obtain the food spoilage degree, and transmitting the food spoilage degree to a preset data display terminal for data display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a food spoilage detection method and system based on image processing. Background Art

[0002] Existing methods for detecting food spoilage mainly rely on chemical analysis, physical testing, and microbiological testing. These methods usually require professional equipment and personnel to operate, are time-consuming and costly, and are difficult to popularize in daily life. With the development of computer vision and image processing technology, food spoilage detection methods based on image processing have gradually attracted attention, providing a more convenient and efficient solution.

[0003] However, the current food spoilage detection method based on image processing still has some shortcomings. The traditional method is relatively simple in extracting and fusing image features, resulting in low detection accuracy. In addition, the lack of effective multi-factor analysis and comprehensive judgment means makes it difficult to accurately identify and classify the degree of food spoilage. These limit the promotion and effectiveness of this method in practical applications. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and system for detecting food spoilage based on image processing, which are used to improve the efficiency and accuracy of food spoilage detection based on image processing.

[0005] The present invention provides a food spoilage detection method based on image processing, comprising: performing image acquisition processing on a target food through a high-resolution image to obtain a multi-angle image set corresponding to the target food;

[0006] Performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set;

[0007] Extracting image features from the enhanced image set by a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature;

[0008] Performing feature fusion on the image texture feature set to obtain a fused feature vector set;

[0009] Inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor;

[0010] The food spoilage probability of each factor and the food spoilage characteristic data of each factor are input into a generalized regression neural network to analyze the degree of food spoilage, and the degree of food spoilage is obtained, and the degree of food spoilage is transmitted to a preset data display terminal for data display.

[0011] In the present invention, the step of performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set includes:

[0012] Performing grayscale conversion on the multi-angle image set to obtain a grayscale image set corresponding to the multi-angle image set;

[0013] Performing Laplace transform on the grayscale image set to extract edge feature data of each grayscale image in the grayscale image set, wherein the edge feature data is used to represent intensity distribution data around each pixel in the grayscale image;

[0014] Performing edge feature enhancement on the grayscale image set according to edge feature data of each grayscale image in the grayscale image set to obtain a first transformed image set;

[0015] Extracting pixel differences of the first transformed image corresponding to each grayscale image in the grayscale image set and each grayscale image to obtain pixel difference data corresponding to each first transformed image;

[0016] Performing edge feature enhancement on the first transformed image set according to pixel difference data corresponding to each first transformed image to obtain a second transformed image set;

[0017] The second transformed image set is subjected to contrast enhancement processing to obtain an enhanced image set corresponding to the multi-angle image set.

[0018] In the present invention, the step of extracting image features from the enhanced image set by a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: mildew features, discoloration features, and abnormal texture roughness features, comprises:

[0019] Performing a pixel-based neighborhood range analysis on each enhanced image in the enhanced image set by using a local binary pattern algorithm to obtain a neighborhood range of each pixel of each enhanced image;

[0020] Performing grayscale value analysis on the pixels in the neighborhood range of each pixel of each enhanced image to obtain a grayscale value set of the neighborhood pixels corresponding to each pixel;

[0021] Binary encoding is performed on the grayscale value corresponding to each pixel in each enhanced image and the grayscale value set of the neighboring pixels corresponding to each pixel to generate a binary code for each pixel in each enhanced image;

[0022] Construct a local texture feature map corresponding to each enhanced image according to the binary coding of each pixel in each enhanced image;

[0023] Performing a local texture value frequency distribution histogram analysis on the local texture feature map corresponding to each enhanced image, respectively, to obtain a local texture frequency distribution histogram corresponding to each local texture feature map;

[0024] Constructing a local feature vector set corresponding to the enhanced image set according to a local texture frequency distribution histogram corresponding to each local texture feature map;

[0025] Image features are extracted from the enhanced image set according to the local feature vector set to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: mildew features, discoloration features, and abnormal texture roughness features.

[0026] In the present invention, the step of extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set comprises:

[0027] Performing high-frequency pattern vector extraction on the local feature vector set to obtain a high-frequency pattern vector set, and performing mildew spot feature extraction on the high-frequency pattern vector set to obtain the mildew spot feature;

[0028] Performing grayscale feature vector screening on the local feature vector set to obtain a grayscale feature vector set, and matching neighborhood feature vectors corresponding to the grayscale feature vector set to obtain a neighborhood feature vector set;

[0029] Extracting color change features from the grayscale feature vector set and the neighborhood feature vector set to obtain the color change features;

[0030] Extracting vector frequency distribution data from the local feature vector set to obtain vector frequency distribution data;

[0031] Performing frequency dispersion data analysis on the vector frequency distribution data to obtain frequency dispersion data;

[0032] Extracting abnormal texture roughness features from the frequency dispersion data to obtain the abnormal texture roughness features;

[0033] The mold spot feature, the color change feature and the abnormal texture roughness feature are combined into the image texture feature set.

[0034] In the present invention, the step of performing feature fusion on the image texture feature set to obtain a fused feature vector set includes:

[0035] Performing multi-scale decomposition on the mildew spot features to obtain mildew spot detail data and mildew spot global data, and performing mildew spot edge extraction on the mildew spot detail data and the mildew spot global data to obtain mildew spot edge data;

[0036] Performing multi-scale decomposition on the color change feature to obtain color change detail data and color change global data, and performing color change region edge extraction on the color change detail data and the color change global data to obtain color change region edge data;

[0037] Performing multi-scale decomposition on the abnormal texture roughness feature to obtain abnormal texture roughness detail data and abnormal texture roughness global data, and performing multi-scale decomposition on the abnormal texture roughness detail data and the abnormal texture roughness global data;

[0038] The image texture feature set is feature fused according to the mildew edge data, the mildew detail data, the discolored area edge data, the discolored detail data, the abnormal texture roughness global data and the abnormal texture roughness detail data to obtain a fused feature vector set.

[0039] In the present invention, the step of inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor includes:

[0040] Inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform cluster center analysis to obtain multiple initial cluster centers;

[0041] The position of each initial cluster center is randomly initialized to obtain multiple target cluster centers;

[0042] Based on the multiple target cluster centers, the membership data of each fused feature vector in the fused feature vector set is calculated by a membership calculation formula, wherein the membership calculation formula is as follows:

[0043] ;

[0044] in, Indicates i The fused feature vector belongs to j The membership data of the clusters, Indicates i The fused feature vectors, Indicates j target cluster centers, m is the fuzzy index,c is the number of cluster centers, For the k target cluster centers, c ;

[0045] The multi-factor food spoilage probability analysis is performed based on the membership data of each fused feature vector to obtain the food spoilage probability of each factor and the food spoilage characteristic data of each factor.

[0046] In the present invention, the step of inputting the food spoilage probability of each factor and the food spoilage characteristic data of each factor into a generalized regression neural network to analyze the degree of food spoilage, obtaining the degree of food spoilage, and transmitting the degree of food spoilage to a preset data display terminal for data display includes:

[0047] The generalized regression neural network comprises: an input layer, a radial basis function layer and an output layer;

[0048] Inputting the food spoilage probability of each factor and the food spoilage characteristic data of each factor into the input layer for probability data fusion to obtain the food spoilage characteristic of each factor;

[0049] Inputting the food spoilage characteristics of each factor into the radial basis function layer to perform food spoilage attribute value analysis to obtain the food spoilage attribute value of each factor;

[0050] The food spoilage attribute value of each factor is input into the output layer to analyze the degree of food spoilage, and the degree of food spoilage is obtained, and the degree of food spoilage is transmitted to a preset data display terminal for data display.

[0051] The present invention also provides a food spoilage detection system based on image processing, comprising:

[0052] An acquisition module is used to perform image acquisition processing on the target food through high-resolution images to obtain a multi-angle image set corresponding to the target food;

[0053] An enhancement module, used for performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set;

[0054] An extraction module, configured to extract image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature;

[0055] A fusion module, used for performing feature fusion on the image texture feature set to obtain a fused feature vector set;

[0056] An analysis module, used for inputting the fused feature vector set into a fuzzy C-means clustering algorithm to perform a multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor;

[0057] The display module is used to input the food spoilage probability of each factor and the food spoilage characteristic data of each factor into a generalized regression neural network to analyze the degree of food spoilage, obtain the degree of food spoilage, and transmit the degree of food spoilage to a preset data display terminal for data display.

[0058] In the technical solution provided by the present invention, multi-angle and multi-spectral image acquisition of the target food is performed by a high-resolution camera, which can fully cover the feature information of the food surface and interior, and ensure the comprehensiveness and detail retention of the image data. Secondly, the differential Laplace enhancement algorithm is used to enhance the image edge and contrast of the multi-angle image set, which effectively improves the clarity and contrast of the image, makes the micro features of the food surface and interior more obvious, and provides high-quality image data for subsequent processing. The enhanced image set is processed by the local binary pattern algorithm, which can accurately capture the mold spot features, discoloration features and abnormal texture roughness features generated during the food spoilage process. The extracted image texture features are feature fused by the multi-scale geometric analysis algorithm, which can effectively process the nonlinear and non-stationary signals in the features, generate a fused feature vector with high expressiveness, and ensure that the features at different angles and spectra can be fully fused. In the multi-factor food spoilage probability analysis, the fuzzy C-means clustering algorithm is used to input the fused feature vector into the model for cluster analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor. Through membership matrix analysis, the specific performance of food at different degrees of deterioration can be identified, such as darkening of color, increase of mold spots, slimy surface and loose structure. Through the generalized regression neural network, the probability and characteristic data of food deterioration of each factor are comprehensively analyzed, and the degree of deterioration of food can be accurately classified, including fresh, slightly deteriorated, moderately deteriorated and severely deteriorated. The test results are intuitively displayed through the preset data display terminal, so that users can easily understand and make decisions. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0060] Figure 1Flow chart of a method for detecting food spoilage based on image processing in an embodiment of the present invention.

[0061] Figure 2 Schematic diagram of a food spoilage detection system based on image processing in an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0064] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0065] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for detecting food spoilage based on image processing according to an embodiment of the present invention. Figure 1 As shown, the following steps are included:

[0066] S101, performing image acquisition and processing on the target food through high-resolution images to obtain a multi-angle image set corresponding to the target food;

[0067] S102, performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set;

[0068] S103, extracting image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature;

[0069] S104, performing feature fusion on the image texture feature set to obtain a fused feature vector set;

[0070] S105, inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor;

[0071] S106: Input the food spoilage probability of each factor and the food spoilage characteristic data of each factor into the generalized regression neural network to analyze the degree of food spoilage, obtain the degree of food spoilage, and transmit the degree of food spoilage to a preset data display terminal for data display.

[0072] It should be noted that the target food is imaged and processed by a high-resolution camera to obtain a set of multi-angle images corresponding to the target food. Specifically, multi-angle image acquisition includes taking food images from different angles (such as the front, side, and top) to ensure that all important features on the surface and inside of the food are covered. At the same time, the collected images include not only visible light images, but also near-infrared spectral images to capture more potential spoilage information. For example, when detecting the spoilage of an apple, a high-resolution camera is used to capture images of different areas on the surface of the apple, and near-infrared spectral images are used to reveal internal decay or moisture changes.

[0073] Subsequently, the image edge and contrast of the multi-angle image set are enhanced using the differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set. The differential Laplace enhancement algorithm first converts the multi-angle image set into a grayscale image set, and then extracts edge feature data by calculating the Laplace transform of each grayscale image. The edge feature of the image is further enhanced by extracting pixel differences between the edge feature data of each grayscale image and the original grayscale image to obtain a first transformed image set. Then, the first transformed image set is subjected to contrast enhancement processing to obtain an enhanced image set corresponding to the multi-angle image set.

[0074] In terms of image feature extraction, the enhanced image set is processed by the Local Binary Pattern (LBP) algorithm to obtain the image texture feature set. The LBP algorithm generates binary codes by comparing the grayscale values ​​of each pixel with its neighboring pixels, thereby extracting the texture features of the image. The specific steps include performing a neighborhood range analysis based on pixels on each enhanced image in the enhanced image set to obtain the neighborhood range of each pixel in each enhanced image; performing a grayscale value analysis on the pixels within the neighborhood range of each pixel to generate the binary code corresponding to each pixel, and constructing a local texture feature map. Then, the local feature vector set of each enhanced image is obtained by analyzing the local texture value frequency distribution histogram. Based on these local feature vector sets, image feature extraction is performed on the enhanced image set to obtain an image texture feature set including mildew features, discoloration features, and abnormal texture roughness features. Next, feature fusion is performed on the image texture feature set to obtain a fused feature vector set. The multiscale geometric analysis (MGA) method is used to extract detail data and global data by multi-scale decomposition of mold features, discoloration features and abnormal texture roughness features, and perform edge extraction and frequency distribution analysis. Finally, based on these processing results, the image texture feature set is fused to generate a fused feature vector set with high expressiveness. This fused feature vector set integrates key information from images of different angles and spectra to ensure the integrity and accuracy of feature expression. For example, through this fusion processing, the mold, discoloration and texture roughness features of different parts of apples can be combined to form a comprehensive feature vector for subsequent deterioration detection.

[0075] Then, the fused feature vector set is input into the Fuzzy C-Means Clustering (FCM) algorithm for multi-factor food spoilage probability analysis. The FCM algorithm divides samples into different clusters by fuzzy clustering, and assigns membership to each sample to reflect the probability of belonging to each cluster. The specific steps include inputting the fused feature vector set into the model for cluster center analysis to obtain multiple initial cluster centers, and obtaining multiple target cluster centers by random position initialization. Based on these target cluster centers, the membership data of each fused feature vector is calculated by the membership calculation formula, and the multi-factor food spoilage probability analysis is performed based on these data to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor. For example, through this analysis, the spoilage probability of the mold spot area on the apple surface, the spoilage probability of the color change area, and the spoilage probability of the texture roughness area can be determined, providing specific spoilage feature data.

[0076] Finally, the food spoilage probability of each factor and the food spoilage characteristic data of each factor are input into the generalized regression neural network (GRNN) for food spoilage degree analysis to obtain the food spoilage degree, and the food spoilage degree is transmitted to the preset data display terminal for data display. GRNN is a neural network model based on radial basis function network, which has fast training and highly nonlinear approximation capabilities. The specific implementation includes inputting the food spoilage probability and characteristic data of each factor into the input layer of GRNN, performing probability data fusion, and obtaining the food spoilage characteristics of each factor; then, inputting these characteristics into the radial basis function layer for food spoilage attribute value analysis to obtain the food spoilage attribute value of each factor; finally, inputting these attribute values ​​into the output layer for food spoilage degree analysis to obtain the food spoilage degree label, and intuitively displaying it to the user through the data display terminal. For example, in this way, the degree of spoilage of apples can be accurately classified, such as fresh, slightly spoiled, moderately spoiled, and severely spoiled, and the detection results can be displayed on the user interface to facilitate user understanding and decision-making. Through this method, the present invention can realize rapid and accurate food spoilage detection and provide efficient food safety guarantee.

[0077] By executing the above steps, the target food is collected by multi-angle and multi-spectral images through a high-resolution camera, which can fully cover the feature information of the food surface and interior, ensuring the comprehensiveness and detail retention of the image data. Secondly, the differential Laplace enhancement algorithm is used to enhance the image edge and contrast of the multi-angle image set, which effectively improves the clarity and contrast of the image, making the tiny features on the surface and inside of the food more obvious, providing high-quality image data for subsequent processing. The enhanced image set is processed by the local binary pattern algorithm, which can accurately capture the mold spot features, discoloration features and abnormal texture roughness features generated during food spoilage. The extracted image texture features are fused by the multi-scale geometric analysis algorithm, which can effectively process the nonlinear and non-stationary signals in the features, generate a fused feature vector with high expressiveness, and ensure that the features at different angles and spectra can be fully fused. In the multi-factor food spoilage probability analysis, the fuzzy C-means clustering algorithm is used to input the fused feature vector into the model for clustering analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor. Through membership matrix analysis, the specific performance of food at different degrees of deterioration can be identified, such as darkening of color, increase of mold spots, slimy surface and loose structure. Through the generalized regression neural network, the probability and characteristic data of food deterioration of each factor are comprehensively analyzed, and the degree of deterioration of food can be accurately classified, including fresh, slightly deteriorated, moderately deteriorated and severely deteriorated. The test results are intuitively displayed through the preset data display terminal, so that users can easily understand and make decisions.

[0078] In a specific embodiment, the process of executing step S102 may specifically include the following steps:

[0079] (1) Perform grayscale conversion on the multi-angle image set to obtain the grayscale image set corresponding to the multi-angle image set;

[0080] (2) performing Laplace transform on the grayscale image set to extract edge feature data of each grayscale image in the grayscale image set, wherein the edge feature data is used to represent intensity distribution data around each pixel in the grayscale image;

[0081] (3) performing edge feature enhancement on the grayscale image set according to the edge feature data of each grayscale image in the grayscale image set to obtain a first transformed image set;

[0082] (4) extracting pixel differences from the first transformed image corresponding to each grayscale image in the grayscale image set and from each grayscale image to obtain pixel difference data corresponding to each first transformed image;

[0083] (5) performing edge feature enhancement on the first transformed image set according to the pixel difference data corresponding to each first transformed image to obtain a second transformed image set;

[0084] (6) Perform contrast enhancement processing on the second transformed image set to obtain an enhanced image set corresponding to the multi-angle image set.

[0085] Specifically, a high-resolution camera is used to collect multi-angle images of the target food to obtain a multi-angle image set. These images include not only visible light images of the food surface, but also near-infrared spectrum images to capture more potential spoilage information. In order to ensure the uniformity of image processing and simplify the computational complexity, the multi-angle image set is first converted into a grayscale image set. Grayscale conversion is to convert the RGB value of a color image into a single grayscale value, so that the grayscale value of each pixel can more intuitively reflect its brightness information, thereby facilitating subsequent image processing.

[0086] After obtaining the grayscale image set, Laplace transform is performed to extract the edge feature data of each grayscale image. Laplace transform is a second-order derivative transform. By calculating the second-order derivative of each pixel in the image, the edge of the image can be effectively detected. The edge feature data represents the intensity distribution around each pixel in the grayscale image and is an important indicator reflecting the change of the image structure. For example, when detecting the deterioration of an apple, Laplace transform can highlight the fine spots and texture changes on the surface of the apple, thereby providing key edge feature data. Next, according to the edge feature data of each grayscale image in the grayscale image set, the grayscale image set is enhanced to obtain the first transformed image set. Edge feature enhancement is to enhance the edge contrast of the image to make the edge feature more obvious. This step mainly strengthens the edge area in the image by comparing the edge feature data with the original grayscale image. For example, through this edge feature enhancement, the fine spots and discolored areas on the surface of the apple can be made more prominent, improving the detail expression of the image.

[0087] After obtaining the first transformed image set, pixel difference extraction is performed. Pixel difference extraction is to generate pixel difference data corresponding to each first transformed image by comparing the pixel value difference between the grayscale image and the first transformed image. These data reflect the degree of change of pixel values ​​in the image and are the basis for judging the important change areas in the image. For example, through pixel difference extraction, the area where the apple surface changes from bright to dark, and the area where the pixel value suddenly changes due to mold spots can be identified. According to the pixel difference data corresponding to each first transformed image, the first transformed image set is further enhanced for edge features to obtain the second transformed image set. This step is to make the deterioration features in the image more obvious by reinforcing the areas with large pixel differences. For example, through this processing, the mold spots and discolored areas on the apple surface can be more clearly displayed, thereby providing clearer image data for subsequent feature extraction.

[0088] Finally, the second transformed image set is subjected to contrast enhancement processing to obtain an enhanced image set corresponding to the multi-angle image set. Contrast enhancement is to adjust the grayscale value range of the image and increase the contrast between the bright and dark parts of the image to make the overall visual effect of the image better. This step can be achieved by performing histogram equalization or adaptive histogram equalization on the image. For example, through contrast enhancement, the details on the surface of the apple can be made clearer, and the mold spots and discolored areas can be more prominent in the image, providing a better visual effect.

[0089] In summary, through the above series of processing steps, the differential Laplace enhancement algorithm can effectively improve the edge features and contrast of the multi-angle image set, making the spoilage features in the image more obvious and easy to identify. For example, through these processing, the mold features, discoloration features, and abnormal texture roughness features on the apple surface can be extracted from multi-angle and multi-spectral images. These enhanced images provide a high-quality data foundation for subsequent image feature extraction and feature fusion, ensuring the accuracy and reliability of the food spoilage detection process.

[0090] Based on these enhanced images, feature extraction and fusion are performed through local binary pattern algorithm and multi-scale geometric analysis method, which can accurately identify the deterioration of food, and multi-factor analysis and comprehensive judgment are performed through fuzzy C-means clustering and generalized regression neural network to obtain the degree of deterioration of food and display the results to users. This method not only improves the accuracy and efficiency of detection, but also provides effective protection for food safety. For example, through this method, users can quickly and accurately judge the degree of deterioration of apples and make corresponding processing decisions, such as continuing to store, eating as soon as possible, or discarding spoiled apples.

[0091] In a specific embodiment, the process of executing step S103 may specifically include the following steps:

[0092] (1) Performing pixel-based neighborhood range analysis on each enhanced image in the enhanced image set using a local binary pattern algorithm to obtain the neighborhood range of each pixel in each enhanced image;

[0093] (2) Analyze the grayscale values ​​of the pixels in the neighborhood of each pixel of each enhanced image to obtain the grayscale value set of the neighborhood pixels corresponding to each pixel;

[0094] (3) Binary encoding is performed on the grayscale value corresponding to each pixel in each enhanced image and the grayscale value set of the neighboring pixels corresponding to each pixel to generate a binary code for each pixel in each enhanced image;

[0095] (4) Constructing a local texture feature map corresponding to each enhanced image based on the binary encoding of each pixel in each enhanced image;

[0096] (5) performing a local texture value frequency distribution histogram analysis on the local texture feature map corresponding to each enhanced image, and obtaining a local texture frequency distribution histogram corresponding to each local texture feature map;

[0097] (6) constructing a local feature vector set corresponding to the enhanced image set according to the local texture frequency distribution histogram corresponding to each local texture feature map;

[0098] (7) Extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature.

[0099] Specifically, for each enhanced image in the enhanced image set, a neighborhood range analysis based on pixels is performed. Specifically, for each pixel, the pixels within a certain range around it are determined as the neighborhood. Usually, a 3x3 window is selected, that is, each pixel has 8 neighborhood pixels. The purpose of this is to capture the local texture information around each pixel, so as to more accurately reflect the detail changes in the image. For example, when detecting the deterioration of the surface of an apple, the neighborhood pixels around each pixel can be clearly identified through the neighborhood range analysis, thereby laying the foundation for subsequent gray value analysis and binary encoding. Next, the gray value analysis is performed on the pixels within the neighborhood range of each pixel of each enhanced image to obtain the gray value set of the neighborhood pixels corresponding to each pixel. Gray value analysis is to compare the gray value of each neighborhood pixel with the gray value of the central pixel, so as to extract the local features of each pixel. For example, through this gray value analysis, the gray value change of a certain spot area on the surface of an apple can be determined, so as to identify the mold spot characteristics of the area.

[0100] Subsequently, the grayscale value corresponding to each pixel in each enhanced image and the grayscale value set of the neighboring pixels corresponding to each pixel are binary coded to generate a binary code for each pixel in each enhanced image. Specifically, if the grayscale value of the neighboring pixel is greater than or equal to the grayscale value of the central pixel, the position of the neighboring pixel is marked as 1; otherwise, it is marked as 0. In this way, each pixel generates an 8-bit binary number, which is converted into a decimal number to obtain the LBP value of the pixel. According to the binary code of each pixel in each enhanced image, a local texture feature map corresponding to each enhanced image is constructed. The local texture feature map is formed by combining the LBP values ​​of each pixel to form an image reflecting the local texture features of the image. Next, the local texture value frequency distribution histogram analysis is performed on the local texture feature map corresponding to each enhanced image to obtain the local texture frequency distribution histogram corresponding to each local texture feature map. The frequency distribution histogram is a histogram that reflects the distribution of image texture features by counting the frequency of occurrence of different LBP values ​​in the local texture feature map.

[0101] According to the local texture frequency distribution histogram corresponding to each local texture feature map, a local feature vector set corresponding to the enhanced image set is constructed. The local feature vector set is formed by splicing the frequency distribution histogram of each enhanced image to form a vector set that comprehensively reflects the texture features of the enhanced image set. For example, through this feature vector set, the texture features of different areas on the surface of an apple can be comprehensively reflected, providing data support for subsequent feature fusion and deterioration detection.

[0102] Finally, the image features of the enhanced image set are extracted according to the local feature vector set to obtain the image texture feature set. These texture features include mold features, discoloration features, and abnormal texture roughness features. For example, through this feature extraction, the mold area on the surface of the apple can be identified, whose features are expressed as high-frequency pattern vectors; the discoloration area, whose features are expressed as changes in grayscale feature vectors and neighborhood feature vectors; and the area with increased texture roughness, whose features are expressed as the frequency dispersion analysis results of vector frequency distribution data.

[0103] For example, when detecting the deterioration of a batch of apples, first, a high-resolution camera is used to collect apple images from multiple angles. After grayscale conversion, Laplace transform and edge feature enhancement, an enhanced image set is generated. Then, the neighborhood range of each enhanced image is analyzed by the local binary pattern algorithm to obtain the neighborhood pixel grayscale value set of each pixel. Next, the LBP value of each pixel is generated by binary coding, and a local texture feature map is constructed. Through the local texture value frequency distribution histogram analysis, a local feature vector set is generated, and image features are extracted from the enhanced image set to identify mold features, discoloration features and abnormal texture roughness features. These features are analyzed by fuzzy C-means clustering and generalized regression neural network, and the degree of deterioration of each apple is finally determined, including fresh, slightly deteriorated, moderately deteriorated and severely deteriorated, and are intuitively displayed to users through the data display terminal.

[0104] In a specific embodiment, the process of performing the step of extracting image features from the enhanced image set according to the local feature vector set may specifically include the following steps:

[0105] (1) extracting high-frequency pattern vectors from the local feature vector set to obtain a high-frequency pattern vector set, and extracting mildew features from the high-frequency pattern vector set to obtain mildew features;

[0106] (2) Screening the local feature vector set for grayscale feature vectors to obtain a grayscale feature vector set, and matching the neighborhood feature vectors corresponding to the grayscale feature vector set to obtain a neighborhood feature vector set;

[0107] (3) Extracting color-changing features from the grayscale feature vector set and the neighborhood feature vector set to obtain color-changing features;

[0108] (4) Extracting vector frequency distribution data from the local feature vector set to obtain vector frequency distribution data;

[0109] (5) Perform frequency dispersion data analysis on the vector frequency distribution data to obtain frequency dispersion data;

[0110] (6) Extracting abnormal texture roughness features from the frequency dispersion data to obtain abnormal texture roughness features;

[0111] (7) The mold spot features, discoloration features and abnormal texture roughness features are combined into an image texture feature set.

[0112] Specifically, a high-frequency pattern vector is extracted from the local feature vector set to obtain a high-frequency pattern vector set. High-frequency pattern vector extraction is to capture subtle changes on the surface of food, such as the formation of mold spots, by analyzing the high-frequency components in the image. High-frequency components are usually manifested as fast-changing areas in the image, which have higher frequencies in frequency domain analysis. High-frequency pattern vectors reflecting the characteristics of mold spots in the image can be extracted. For example, when detecting an apple, through high-frequency pattern vector extraction, small spots and texture changes on the surface of the apple due to mold spots can be identified, thereby providing basic data for subsequent mold spot feature extraction. Next, mold spot feature extraction is performed on the high-frequency pattern vector set to obtain mold spot features. Mold spot feature extraction is to identify the characteristics of the mold spot area in the image by analyzing the specific patterns and distribution in the high-frequency pattern vectors. These features are usually manifested as high-frequency noise and local intensity changes in the image. In this way, the feature information of the mold spot area on the apple surface can be accurately located and extracted. For example, through mold spot feature extraction, it is possible to determine which areas on the apple surface have mold spots and calculate the mold spot feature values ​​of these areas, thereby providing an important basis for deterioration detection.

[0113] Then, the local feature vector set is subjected to grayscale feature vector screening to obtain a grayscale feature vector set. Grayscale feature vector screening is to extract feature vectors reflecting changes in image brightness by analyzing changes in grayscale values ​​in an image. These grayscale feature vectors can reflect areas in an image that change from bright to dark or change in color. For example, when detecting the discoloration of an apple surface, grayscale feature vector screening can identify which areas on the apple surface have darkened or changed color due to deterioration, thereby providing basic data for subsequent color change feature extraction. After obtaining the grayscale feature vector set, the neighborhood feature vectors corresponding to the grayscale feature vector set are matched to obtain a neighborhood feature vector set. The neighborhood feature vector is a vector set that extracts features reflecting changes in local area features of an image by analyzing each feature vector in the grayscale feature vector set and the feature vectors of its surrounding neighborhoods. In this way, subtle local changes and patterns in an image can be captured. For example, by matching neighborhood feature vectors, it can be determined which areas on the apple surface have color change features caused by neighborhood changes, thereby extracting color change features more accurately.

[0114] Next, the color change feature extraction is performed on the grayscale feature vector set and the neighborhood feature vector set to obtain the color change feature. Color change feature extraction is to identify the characteristics of the color change area in the image by analyzing the change pattern in the grayscale feature vector and the neighborhood feature vector. These features are usually manifested as changes in brightness and color distribution in the image. In this way, the feature information of the color change area on the surface of the apple can be accurately located and extracted. For example, through color change feature extraction, it is possible to determine which areas on the surface of the apple have changed color due to deterioration, and calculate the color change feature values ​​of these areas, thereby providing an important basis for deterioration detection.

[0115] Then, vector frequency distribution data is extracted from the local feature vector set to obtain vector frequency distribution data. Vector frequency distribution data extraction is to extract the distribution of different frequency components in the image by analyzing the frequency distribution in the local feature vector set. These data can reveal the texture roughness and uniformity changes in the image. For example, when detecting the texture roughness of the apple surface, through vector frequency distribution data extraction, it is possible to identify which areas of the apple surface have increased texture roughness, thereby providing basic data for subsequent frequency dispersion data analysis.

[0116] After obtaining the vector frequency distribution data, frequency dispersion data analysis is performed on it to obtain frequency dispersion data. Frequency dispersion data analysis is to extract the dispersion of different frequency components in the image by analyzing the distribution breadth and density in the vector frequency distribution data. These data can reveal the characteristics of abnormal texture roughness in the image. For example, through frequency dispersion data analysis, it is possible to identify which areas of the apple surface have abnormal texture roughness, thereby providing basic data for subsequent abnormal texture roughness feature extraction.

[0117] Finally, the frequency dispersion data is subjected to abnormal texture roughness feature extraction to obtain abnormal texture roughness features. Abnormal texture roughness feature extraction is to identify areas with abnormal texture roughness in the image by analyzing the abnormal distribution pattern in the frequency dispersion data. These features are usually manifested as high-frequency noise and irregular texture changes in local areas of the image. In this way, the characteristic information of the abnormal texture roughness area on the apple surface can be accurately located and extracted. For example, through abnormal texture roughness feature extraction, it is possible to determine which areas on the apple surface have abnormal texture roughness due to deterioration, and calculate the abnormal texture roughness feature values ​​of these areas, thereby providing an important basis for deterioration detection.

[0118] In summary, through the above series of processing steps, the image texture feature set including mold spot features, discoloration features and abnormal texture roughness features can be effectively extracted. These features provide reliable basic data for subsequent feature fusion and deterioration detection. For example, in one case, it is necessary to detect the deterioration of a batch of apples. First, multi-angle apple images are collected by a high-resolution camera, and an enhanced image set is generated after grayscale conversion, Laplace transform and edge feature enhancement. Then, the local binary pattern algorithm is used to extract features from each enhanced image to obtain mold spot features, discoloration features and abnormal texture roughness features. Through the steps of high-frequency pattern vector extraction, grayscale feature vector screening, neighborhood feature vector matching, vector frequency distribution data extraction and frequency dispersion data analysis, a complete image texture feature set is finally generated. These features are finally judged by fuzzy C-means clustering and generalized regression neural network analysis to determine the degree of deterioration of each apple, including fresh, slightly deteriorated, moderately deteriorated and severely deteriorated, and are intuitively displayed to users through the data display terminal.

[0119] In a specific embodiment, the process of executing step S104 may specifically include the following steps:

[0120] (1) Perform multi-scale decomposition on the features of the mildew spots to obtain mildew spot detail data and mildew spot global data, and extract the mildew spot edges from the mildew spot detail data and mildew spot global data to obtain mildew spot edge data;

[0121] (2) Perform multi-scale decomposition on the color change features to obtain color change detail data and color change global data, and perform color change region edge extraction on the color change detail data and the color change global data to obtain color change region edge data;

[0122] (3) Perform multi-scale decomposition on the abnormal texture roughness features to obtain abnormal texture roughness detail data and abnormal texture roughness global data, and perform multi-scale decomposition on the abnormal texture roughness detail data and abnormal texture roughness global data;

[0123] (4) Based on the mildew spot edge data, mildew spot detail data, discoloration area edge data, discoloration detail data, abnormal texture roughness global data and abnormal texture roughness detail data, the image texture feature set is fused to obtain a fused feature vector set.

[0124] Specifically, the mold spot features are decomposed at multiple scales to extract mold spot detail data and mold spot global data at different scales. Multiscale decomposition is to decompose different frequency components of the image into different scales by performing multiscale analysis on the image. In this way, both detail features and global features in the image can be captured. For example, for the mold spots on the surface of an apple, the detail data of small mold spots and the global data of large-area mold spots can be identified through multiscale decomposition. These data can not only reflect the specific morphology of the mold spots, but also describe the distribution of the mold spots in the entire image. The mold spot edge is extracted from the mold spot detail data and the mold spot global data to obtain the mold spot edge data. The mold spot edge extraction is to detect the edge of the mold spot area in the image to make the mold spot feature more obvious. Edge extraction is usually achieved by calculating the gradient value of the pixel points in the image or using an edge detection algorithm (such as Canny edge detection). For example, by performing edge extraction on the mold spot detail data on the surface of the apple, the edge of the mold spot can be accurately located and the shape and boundary of the mold spot can be clearly displayed; by performing edge extraction on the mold spot global data, the outer contour and overall distribution of the large-area mold spot can be reflected.

[0125] Then, the color change features are decomposed at multiple scales to obtain color change detail data and color change global data. Similar to the mold spot features, multi-scale decomposition can separate the details and global information of the color change area in the image. For example, through multi-scale decomposition, the small color changes (detail data) and large-area color changes (global data) caused by deterioration on the apple surface can be identified. These data help to fully understand the color change characteristics of the apple surface. The color change area edge extraction is performed on the color change detail data and the color change global data to obtain the color change area edge data. Color change area edge extraction makes the color change features more prominent by detecting the edges of the color change area in the image. The purpose of edge extraction is to clarify the scope and shape of the color change area. For example, by performing edge extraction on the color change detail data on the apple surface, the boundaries of the small color change area can be accurately identified; by performing edge extraction on the color change global data, the scope and overall distribution of large-area color changes can be reflected.

[0126] Next, the abnormal texture roughness features are decomposed at multiple scales to obtain abnormal texture roughness detail data and abnormal texture roughness global data. Multiscale decomposition can separate the details and overall information of texture roughness in an image. For example, through multiscale decomposition, the small texture roughness changes (detail data) and large-area roughness changes (global data) due to deterioration of the apple surface can be identified. These data help to fully understand the texture roughness characteristics of the apple surface.

[0127] By analyzing the abnormal texture roughness detail data and the abnormal texture roughness global data, characteristic information reflecting the texture roughness change can be extracted. For example, by analyzing the detail data, small roughness change areas can be identified; by analyzing the global data, the overall roughness change trend can be reflected.

[0128] Finally, the image texture feature set is fused according to the mold spot edge data, mold spot detail data, discoloration area edge data, discoloration detail data, abnormal texture roughness global data and abnormal texture roughness detail data to obtain a fused feature vector set. Feature fusion is to combine multiple feature data together to form a unified feature vector, which is convenient for subsequent classification and detection. For example, when detecting the deterioration of a batch of apples, through feature fusion, the mold spot features, discoloration features and texture roughness features of each apple can be combined to form a complete feature vector. These feature vectors can accurately reflect the deterioration of each apple and provide basic data for subsequent fuzzy C-means clustering and generalized regression neural network analysis.

[0129] For example, suppose a batch of apples needs to be inspected for spoilage. First, a high-resolution camera is used to capture apple images from multiple angles, and these images are subjected to grayscale conversion, Laplace transform, and edge feature enhancement to generate an enhanced image set. Then, the local binary pattern algorithm is used to extract features from each enhanced image to obtain mold features, discoloration features, and abnormal texture roughness features. Next, these features are subjected to multi-scale decomposition and edge extraction to obtain mold detail data, mold global data, discoloration detail data, discoloration global data, abnormal texture roughness detail data, and abnormal texture roughness global data, respectively. These data are combined together through feature fusion to form a complete feature vector. Finally, the degree of spoilage of each apple is determined through fuzzy C-means clustering and generalized regression neural network analysis, and is intuitively displayed to the user through the data display terminal.

[0130] In a specific embodiment, the process of executing step S105 may specifically include the following steps:

[0131] (1) Input the fused feature vector set into the fuzzy C-means clustering algorithm for cluster center analysis to obtain multiple initial cluster centers;

[0132] (2) Randomly initialize the position of each initial cluster center to obtain multiple target cluster centers;

[0133] (3) Based on multiple target cluster centers, the membership data of each fused feature vector in the fused feature vector set is calculated by the membership calculation formula, where the membership calculation formula is as follows:

[0134] ;

[0135] in, Indicates i The fused feature vector belongs to j The membership data of the clusters, Indicates i The fused feature vectors, Indicates j target cluster centers, m is the fuzzy index, c is the number of cluster centers, is the kth target cluster center, c ;

[0136] (4) Based on the membership data of each fused feature vector, the multi-factor food spoilage probability analysis is performed to obtain the food spoilage probability of each factor and the food spoilage characteristic data of each factor.

[0137] Specifically, the fused feature vector set obtained by the aforementioned multi-scale decomposition and edge extraction is input into the fuzzy C-means clustering algorithm for cluster center analysis. The determination of the initial cluster center is an important part of the fuzzy C-means clustering algorithm. Usually, multiple initial cluster centers are selected to represent the potential center positions of different categories. For example, when detecting the deterioration of a batch of apples, three initial cluster centers can be selected, corresponding to the fresh, slightly deteriorated and severely deteriorated apple states. The selection of these initial cluster centers can be based on prior knowledge or random selection to ensure coverage of different degrees of deterioration. Then, the position of each initial cluster center is randomly initialized to obtain multiple target cluster centers. Random initialization is to randomly adjust the position of the initial cluster center on the basis of the initial cluster center to make it closer to the actual data distribution. The purpose of this is to increase the diversity of cluster centers and improve the robustness and accuracy of clustering results. For example, through random initialization, it can be ensured that each cluster center can better represent the fused feature vector around it, thereby improving the clustering effect.

[0138] After determining the target cluster center, the membership data of each fused feature vector in the fused feature vector set is calculated by the membership calculation formula. Membership is an important concept in the fuzzy C-means clustering algorithm, which represents the probability that each fused feature vector belongs to each cluster. Specifically, the membership is calculated based on the distance from the fused feature vector to each target cluster center. The closer the distance, the higher the membership. For example, for a specific apple fused feature vector, if it is closest to the slightly spoiled cluster center, then its membership will be higher in the slightly spoiled cluster, and lower in the fresh and severely spoiled clusters.

[0139] After calculating the membership data of each fused feature vector, the probability analysis of multi-factor food deterioration is performed based on these data. By analyzing the membership data, the probability of each fused feature vector belonging to different clusters can be determined, so as to further infer the deterioration of the food. For example, by analyzing the membership of the mold spot characteristics, color change characteristics, and abnormal texture roughness characteristics on the apple surface, the probability distribution of apples in fresh, slightly deteriorated, and severely deteriorated states can be obtained. These probability distributions reflect the degree of deterioration and characteristic performance of apples, and are an important basis for food deterioration detection.

[0140] When conducting a multi-factor probability analysis of food spoilage, the specific performance of each factor needs to be considered. For example, a high membership of the mold spot feature may indicate that there are obvious mold spots on the surface of the apple, while a high membership of the color change feature and the texture roughness feature may indicate that the apple has entered a moderate or severe spoilage state. By combining the membership data of these factors, the degree of food spoilage can be accurately judged. For example, in a specific case, through the analysis of the fused feature vector, it is found that the mold spot feature of a certain apple has a high membership, and the color change feature and the texture roughness feature have a medium membership, so it can be inferred that the apple is in a slightly spoiled state. On the contrary, if the mold spot feature, color change feature, and texture roughness feature of a certain apple have high membership, it can be judged that the apple is in a severely spoiled state.

[0141] Through the above process, the probability of food spoilage for each factor and the food spoilage characteristic data of each factor can be obtained. These data can not only be used to judge the degree of food spoilage, but also provide a basis for subsequent processing and decision-making. For example, in a practical application, the food spoilage detected by this method can help food processing companies to deal with spoiled food in a timely manner to avoid health risks to consumers, and can also help consumers make more informed choices when purchasing.

[0142] In summary, by inputting the fused feature vector set into the fuzzy C-means clustering algorithm for cluster center analysis, randomly initializing the target cluster center, calculating the membership data, and performing a multi-factor deterioration probability analysis of food, the degree of deterioration of food can be accurately determined. For example, when detecting the deterioration of a batch of apples, a fused feature vector set is generated by multi-scale decomposition and edge extraction of mold spot features, discoloration features, and abnormal texture roughness features. Then, these feature vectors are clustered by the fuzzy C-means clustering algorithm, the membership data is calculated, and a multi-factor deterioration probability analysis is performed to finally determine the degree of deterioration of each apple. This method not only improves the accuracy and efficiency of food deterioration detection, but also provides effective protection for food safety. For example, the test results can show that some apples have been seriously deteriorated and need to be processed immediately, while other apples may still be in a slightly deteriorated state and can be sold or processed as soon as possible. Through this method, the scientificity and reliability of food deterioration detection can be greatly improved, ensuring that consumers can obtain safe and healthy food.

[0143] In a specific embodiment, the process of performing the image processing step may specifically include the following steps:

[0144] (1) The generalized regression neural network includes: input layer, radial basis function layer and output layer;

[0145] (2) The food spoilage probability of each factor and the food spoilage characteristic data of each factor are input into the probability data fusion layer to obtain the food spoilage characteristics of each factor;

[0146] (3) Input the food spoilage characteristics of each factor into the radial basis function layer to analyze the food spoilage attribute value, and obtain the food spoilage attribute value of each factor;

[0147] (4) The food spoilage attribute value of each factor is input into the output layer to analyze the degree of food spoilage, and the degree of food spoilage is obtained. The degree of food spoilage is then transmitted to a preset data display terminal for data display.

[0148] It should be noted that the food spoilage probability of each factor and the food spoilage feature data of each factor are input into the input layer of GRNN for probabilistic data fusion. The function of the input layer is to receive and process the input data, integrate the spoilage probability and feature data of different factors, and form a unified feature input vector. For example, when detecting the spoilage of apples, the input data received by the input layer include the spoilage probability and feature data of mold features, discoloration features, and texture roughness features. Through probabilistic data fusion, these multi-dimensional data can be synthesized into a comprehensive feature vector, which contains all relevant spoilage information and provides a basis for subsequent analysis. Then, the food spoilage features of each factor processed by the input layer are input into the radial basis function layer for food spoilage attribute value analysis. The radial basis function layer is the core part of GRNN. It maps the input feature vector to a high-dimensional space through the radial basis function (RBF) to realize the analysis and processing of nonlinear data. In this process, each feature vector is processed by multiple radial basis functions to generate corresponding spoilage attribute values. These spoilage attribute values ​​reflect the specific performance of food at different degrees of spoilage. For example, through the processing of the RBF layer, the attribute values ​​of the apple's mold spot characteristics, color change characteristics, and texture roughness characteristics in different deterioration states can be obtained. These attribute values ​​can fully reflect the deterioration of the apple.

[0149] Then, the food spoilage attribute value of each factor is input into the output layer of GRNN for food spoilage degree analysis. The function of the output layer is to perform final classification and judgment based on the input spoilage attribute value, and output a specific spoilage degree label. The output layer converts the input high-dimensional spoilage attribute value into a specific spoilage degree, such as fresh, slightly spoiled, moderately spoiled, and severely spoiled, through the calculation of a series of weights and activation functions. For example, in the spoilage detection of apples, the output layer comprehensively judges the spoilage degree of apples based on the attribute values ​​of the input mold spot feature, color change feature, and texture roughness feature, and outputs a specific spoilage label. After obtaining the food spoilage degree, this information is transmitted to the preset data display terminal for data display. The function of the data display terminal is to display the test results to the user in an intuitive way, so that the user can easily understand and make decisions. The display terminal can be a computer screen, a mobile device, etc., which displays the food spoilage degree and related feature information in the form of charts, text, etc. For example, through the data display terminal, users can see the deterioration of a batch of apples, including which apples are fresh, which apples are slightly deteriorated, and which apples are seriously deteriorated. The specific deterioration characteristics of each apple can also be displayed in detail.

[0150] For example, suppose a batch of apples needs to be inspected for spoilage. First, multi-angle apple images are collected by a high-resolution camera. After grayscale conversion, Laplace transform and edge feature enhancement, an enhanced image set is generated. Then, the local binary pattern algorithm is used to extract the features of each enhanced image to obtain mold features, discoloration features and abnormal texture roughness features. Next, these features are multi-scale decomposed and edge extracted to obtain mold detail data, mold global data, discoloration detail data, discoloration global data, abnormal texture roughness detail data and abnormal texture roughness global data. Through feature fusion, these data are combined to form a complete feature vector. Then, the fuzzy C-means clustering algorithm is used to perform cluster analysis on these feature vectors, calculate the membership data, and perform multi-factor spoilage probability analysis to finally determine the degree of spoilage of each apple. After that, the spoilage probability and feature data of each factor are input into the input layer of GRNN, and probability data fusion is performed to form a comprehensive feature vector. The input layer receives these comprehensive feature vectors and passes them to the radial basis function layer for nonlinear analysis. The radial basis function layer maps the comprehensive feature vector to a high-dimensional space through RBF to generate food spoilage attribute values. These attribute values ​​reflect the specific spoilage of the apple. Subsequently, the output layer performs final classification based on these spoilage attribute values ​​and outputs specific spoilage degree labels, such as fresh, slightly spoiled, moderately spoiled, and severely spoiled. Finally, these spoilage degree information is transmitted to the data display terminal, and users can intuitively view the spoilage status and related feature information of each apple through the terminal interface.

[0151] The embodiment of the present invention also provides a food spoilage detection system based on image processing, such as Figure 2 As shown, the food spoilage detection system based on image processing specifically includes:

[0152] The acquisition module 201 is used to perform image acquisition processing on the target food through high-resolution images to obtain a multi-angle image set corresponding to the target food;

[0153] An enhancement module 202 is used to perform image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set;

[0154] The extraction module 203 is used to extract image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold feature, a discoloration feature, and an abnormal texture roughness feature;

[0155] A fusion module 204 is used to perform feature fusion on the image texture feature set to obtain a fused feature vector set;

[0156] An analysis module 205 is used to input the fused feature vector set into a fuzzy C-means clustering algorithm to perform a multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor;

[0157] The display module 206 is used to input the food spoilage probability of each factor and the food spoilage characteristic data of each factor into the generalized regression neural network to analyze the degree of food spoilage, obtain the degree of food spoilage, and transmit the degree of food spoilage to a preset data display terminal for data display.

[0158] Through the collaborative work of the above modules, the high-resolution camera can collect multi-angle and multi-spectral images of the target food, which can fully cover the feature information of the food surface and interior, ensuring the comprehensiveness and detail retention of the image data. Secondly, the differential Laplace enhancement algorithm is used to enhance the edge and contrast of the multi-angle image set, which effectively improves the clarity and contrast of the image, making the tiny features on the surface and inside of the food more obvious, providing high-quality image data for subsequent processing. The enhanced image set is processed by the local binary pattern algorithm, which can accurately capture the mold features, discoloration features and abnormal texture roughness features generated during the food spoilage process. The extracted image texture features are fused by the multi-scale geometric analysis algorithm, which can effectively process the nonlinear and non-stationary signals in the features, generate a fused feature vector with high expressiveness, and ensure that the features at different angles and spectra can be fully fused. In the multi-factor food spoilage probability analysis, the fuzzy C-means clustering algorithm is used to input the fused feature vector into the model for clustering analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor. Through membership matrix analysis, the specific performance of food at different degrees of deterioration can be identified, such as darkening of color, increase of mold spots, slimy surface and loose structure. Through the generalized regression neural network, the probability and characteristic data of food deterioration of each factor are comprehensively analyzed, and the degree of deterioration of food can be accurately classified, including fresh, slightly deteriorated, moderately deteriorated and severely deteriorated. The test results are intuitively displayed through the preset data display terminal, so that users can easily understand and make decisions.

[0159] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the embodiments, a person skilled in the art should understand that the specific implementation modes of the present invention can still be modified or replaced by equivalents, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A method for detecting food spoilage based on image processing, characterized in that: include: Performing image acquisition and processing on the target food through high-resolution images to obtain a multi-angle image set corresponding to the target food; Performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set; Extracting image features from the enhanced image set by a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature; The step of extracting image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature, comprises: Performing a pixel-based neighborhood range analysis on each enhanced image in the enhanced image set by using a local binary pattern algorithm to obtain a neighborhood range of each pixel of each enhanced image; Performing grayscale value analysis on the pixels in the neighborhood range of each pixel of each enhanced image to obtain a grayscale value set of the neighborhood pixels corresponding to each pixel; Binary encoding is performed on the grayscale value corresponding to each pixel in each enhanced image and the grayscale value set of the neighboring pixels corresponding to each pixel to generate a binary code for each pixel in each enhanced image; Construct a local texture feature map corresponding to each enhanced image according to the binary coding of each pixel in each enhanced image; Performing a local texture value frequency distribution histogram analysis on the local texture feature map corresponding to each enhanced image, respectively, to obtain a local texture frequency distribution histogram corresponding to each local texture feature map; Constructing a local feature vector set corresponding to the enhanced image set according to a local texture frequency distribution histogram corresponding to each local texture feature map; Extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature; The step of extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set comprises: Performing high-frequency pattern vector extraction on the local feature vector set to obtain a high-frequency pattern vector set, and performing mildew spot feature extraction on the high-frequency pattern vector set to obtain the mildew spot feature; Performing grayscale feature vector screening on the local feature vector set to obtain a grayscale feature vector set, and matching neighborhood feature vectors corresponding to the grayscale feature vector set to obtain a neighborhood feature vector set; Extracting color change features from the grayscale feature vector set and the neighborhood feature vector set to obtain the color change features; Extracting vector frequency distribution data from the local feature vector set to obtain vector frequency distribution data; Performing frequency dispersion data analysis on the vector frequency distribution data to obtain frequency dispersion data; Extracting abnormal texture roughness features from the frequency dispersion data to obtain the abnormal texture roughness features; Combining the mold spot feature, the discoloration feature and the abnormal texture roughness feature into the image texture feature set; Performing feature fusion on the image texture feature set to obtain a fused feature vector set; Inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor; The food spoilage probability of each factor and the food spoilage characteristic data of each factor are input into a generalized regression neural network to analyze the degree of food spoilage, and the degree of food spoilage is obtained, and the degree of food spoilage is transmitted to a preset data display terminal for data display.

2. The method for detecting food spoilage based on image processing according to claim 1, characterized in that: The step of performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set includes: Performing grayscale conversion on the multi-angle image set to obtain a grayscale image set corresponding to the multi-angle image set; Performing Laplace transform on the grayscale image set to extract edge feature data of each grayscale image in the grayscale image set, wherein the edge feature data is used to represent intensity distribution data around each pixel in the grayscale image; Performing edge feature enhancement on the grayscale image set according to edge feature data of each grayscale image in the grayscale image set to obtain a first transformed image set; Extracting pixel differences of the first transformed image corresponding to each grayscale image in the grayscale image set and each grayscale image to obtain pixel difference data corresponding to each first transformed image; Performing edge feature enhancement on the first transformed image set according to pixel difference data corresponding to each first transformed image to obtain a second transformed image set; The second transformed image set is subjected to contrast enhancement processing to obtain an enhanced image set corresponding to the multi-angle image set.

3. The method for detecting food spoilage based on image processing according to claim 1, characterized in that: The step of fusing the image texture feature set to obtain a fused feature vector set comprises: Performing multi-scale decomposition on the mildew spot features to obtain mildew spot detail data and mildew spot global data, and performing mildew spot edge extraction on the mildew spot detail data and the mildew spot global data to obtain mildew spot edge data; Performing multi-scale decomposition on the color change feature to obtain color change detail data and color change global data, and performing color change region edge extraction on the color change detail data and the color change global data to obtain color change region edge data; Performing multi-scale decomposition on the abnormal texture roughness feature to obtain abnormal texture roughness detail data and abnormal texture roughness global data, and performing multi-scale decomposition on the abnormal texture roughness detail data and the abnormal texture roughness global data; The image texture feature set is feature fused according to the mildew edge data, the mildew detail data, the discolored area edge data, the discolored detail data, the abnormal texture roughness global data and the abnormal texture roughness detail data to obtain a fused feature vector set.

4. The method for detecting food spoilage based on image processing according to claim 3, characterized in that: The step of inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor includes: Inputting the fused feature vector set into the fuzzy C-means clustering algorithm to perform cluster center analysis to obtain multiple initial cluster centers; The position of each initial cluster center is randomly initialized to obtain multiple target cluster centers; Based on the multiple target cluster centers, the membership data of each fused feature vector in the fused feature vector set is calculated by a membership calculation formula, wherein the membership calculation formula is as follows: ; in, Indicates that the i-th fused feature vector belongs to the j The membership data of the clusters, Indicates i The fused feature vectors, Indicates j target cluster centers, m is the fuzzy index, c is the number of cluster centers, For the k target cluster centers, c ; The multi-factor food spoilage probability analysis is performed based on the membership data of each fused feature vector to obtain the food spoilage probability of each factor and the food spoilage characteristic data of each factor.

5. The method for detecting food spoilage based on image processing according to claim 4, characterized in that: The step of inputting the food spoilage probability of each factor and the food spoilage characteristic data of each factor into a generalized regression neural network to analyze the degree of food spoilage, obtaining the degree of food spoilage, and transmitting the degree of food spoilage to a preset data display terminal for data display includes: The generalized regression neural network comprises: an input layer, a radial basis function layer and an output layer; Inputting the food spoilage probability of each factor and the food spoilage characteristic data of each factor into the input layer for probability data fusion to obtain the food spoilage characteristic of each factor; Inputting the food spoilage characteristics of each factor into the radial basis function layer to perform food spoilage attribute value analysis to obtain the food spoilage attribute value of each factor; The food spoilage attribute value of each factor is input into the output layer to analyze the degree of food spoilage, and the degree of food spoilage is obtained, and the degree of food spoilage is transmitted to a preset data display terminal for data display.

6. A food spoilage detection system based on image processing, used to execute the food spoilage detection method based on image processing as claimed in any one of claims 1 to 5, characterized in that: include: An acquisition module is used to perform image acquisition processing on the target food through high-resolution images to obtain a multi-angle image set corresponding to the target food; An enhancement module, used for performing image edge and contrast enhancement on the multi-angle image set by using a differential Laplace enhancement algorithm to obtain an enhanced image set corresponding to the multi-angle image set; An extraction module, configured to extract image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature; The step of extracting image features from the enhanced image set by using a local binary pattern algorithm to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature, comprises: Performing a pixel-based neighborhood range analysis on each enhanced image in the enhanced image set by using a local binary pattern algorithm to obtain a neighborhood range of each pixel of each enhanced image; Performing grayscale value analysis on the pixels in the neighborhood range of each pixel of each enhanced image to obtain a grayscale value set of the neighborhood pixels corresponding to each pixel; Binary encoding is performed on the grayscale value corresponding to each pixel in each enhanced image and the grayscale value set of the neighboring pixels corresponding to each pixel to generate a binary code for each pixel in each enhanced image; Construct a local texture feature map corresponding to each enhanced image according to the binary coding of each pixel in each enhanced image; Performing a local texture value frequency distribution histogram analysis on the local texture feature map corresponding to each enhanced image, respectively, to obtain a local texture frequency distribution histogram corresponding to each local texture feature map; Constructing a local feature vector set corresponding to the enhanced image set according to a local texture frequency distribution histogram corresponding to each local texture feature map; Extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set, wherein the image texture feature set includes one or more of the following: a mold spot feature, a discoloration feature, and an abnormal texture roughness feature; The step of extracting image features from the enhanced image set according to the local feature vector set to obtain an image texture feature set comprises: Performing high-frequency pattern vector extraction on the local feature vector set to obtain a high-frequency pattern vector set, and performing mildew spot feature extraction on the high-frequency pattern vector set to obtain the mildew spot feature; Performing grayscale feature vector screening on the local feature vector set to obtain a grayscale feature vector set, and matching neighborhood feature vectors corresponding to the grayscale feature vector set to obtain a neighborhood feature vector set; Extracting color change features from the grayscale feature vector set and the neighborhood feature vector set to obtain the color change features; Extracting vector frequency distribution data from the local feature vector set to obtain vector frequency distribution data; Performing frequency dispersion data analysis on the vector frequency distribution data to obtain frequency dispersion data; Extracting abnormal texture roughness features from the frequency dispersion data to obtain the abnormal texture roughness features; Combining the mold spot feature, the discoloration feature and the abnormal texture roughness feature into the image texture feature set; A fusion module, used for performing feature fusion on the image texture feature set to obtain a fused feature vector set; An analysis module, used for inputting the fused feature vector set into a fuzzy C-means clustering algorithm to perform a multi-factor food spoilage probability analysis to obtain the food spoilage probability of each factor and the food spoilage feature data of each factor; The display module is used to input the food spoilage probability of each factor and the food spoilage characteristic data of each factor into a generalized regression neural network to analyze the degree of food spoilage, obtain the degree of food spoilage, and transmit the degree of food spoilage to a preset data display terminal for data display.