Food detection method and system based on image recognition
By using image processing-guided signals and cross-stage feature fusion technology, the problems of low efficiency and high false detection rate in food defect detection have been solved, achieving high accuracy and high efficiency in food defect detection, and adapting to complex backgrounds and diverse scenarios.
Patent Information
- Application Number
- CN202511085946.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-14
AI Technical Summary
Existing technologies for food defect detection suffer from low efficiency, high false detection rate, difficulty in distinguishing complex backgrounds from defect features, and particularly weak ability to identify subtle defects, making it difficult to meet the detection needs of large-scale production.
By employing image processing guidance signals and cross-stage feature fusion technology, an optimized food testing report is generated by producing image processing guidance signals, stage-optimized feature maps, and cross-stage fusion feature maps, combined with shallow feature extraction and deep feature optimization.
It significantly improves the accuracy and automation of food defect detection, enhances the ability to distinguish subtle defects, reduces errors in human judgment, and improves detection efficiency and adaptability.
Smart Images

Figure CN120953690A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a food detection method and system based on image recognition. Background Technology
[0002] Currently, food is prone to defects such as bruises, cracks, and mold during production, transportation, and storage. These defects directly affect food quality and safety, thus requiring efficient and accurate detection methods. However, food defects are complex and diverse, with significant differences in texture and color characteristics between different types of defects. Furthermore, the same defect can appear differently under different lighting and angles, making accurate identification difficult using only simple image analysis.
[0003] Traditional food defect detection often relies on manual screening or basic image recognition technology. Manual screening depends on the experience of inspectors, who judge whether food has defects by visual observation; basic image recognition technology extracts image features through simple threshold segmentation, edge detection, and other methods to determine the extent of defects.
[0004] Traditional detection methods suffer from significant shortcomings, such as low efficiency of manual screening, susceptibility to fatigue and experience differences leading to high rates of missed and false detections, and inability to meet the detection needs of large-scale production. Basic image recognition technology, lacking in-depth optimization and multi-dimensional fusion of features, cannot effectively distinguish between complex backgrounds and defect features, especially in the recognition of subtle defects, resulting in limited detection accuracy and difficulty in adapting to diverse food defect detection scenarios. Summary of the Invention
[0005] To address the aforementioned problems, this invention provides a food inspection method and system based on image recognition, which employs image processing-guided signals and cross-stage feature fusion to improve the accuracy and automation of food defect detection.
[0006] The above objectives can be achieved through the following approach:
[0007] A food inspection method based on image recognition includes: generating an image processing guidance signal based on a preset image of the food to be inspected, wherein the image processing guidance signal includes a defect degree parameter; extracting and optimizing features from the image of the food to be inspected to generate a stage-optimized feature map, wherein the stage-optimized feature map includes high-frequency edge response features and low-frequency color distribution features; fusing the image processing guidance signal and the stage-optimized feature map to generate a cross-stage fusion feature map; generating an initial inspection result based on the cross-stage fusion feature map; and generating an optimized food inspection report based on the initial inspection result and the image of the food to be inspected.
[0008] Optionally, the generation of the image processing guidance signal includes: scanning the food image to be detected to generate food appearance data, wherein the food appearance data includes local texture distribution parameters and color saturation parameters; fusing the food appearance data and preset food defect feature parameters to generate the image processing guidance signal.
[0009] Optionally, the generation stage optimization feature map includes: performing shallow feature extraction on the food image to be detected to generate a preprocessed image; performing deep feature optimization based on the preprocessed image to generate a feature map for defect suppression and quality enhancement; and generating a stage optimization feature map based on the feature map for defect suppression and quality enhancement.
[0010] Optionally, the generation of the feature map for defect suppression and quality enhancement includes: generating an adjustment bias coefficient based on the image processing guidance signal; and performing convolution calculation on the preprocessed image based on the adjustment bias coefficient to generate the feature map for defect suppression and quality enhancement.
[0011] Optionally, generating the cross-stage fusion feature map includes: performing feature processing on the stage-optimized feature map based on the image processing guidance signal to generate a pre-fusion feature map; and fusing the stage-optimized feature map with the pre-fusion feature map to generate a cross-stage fusion feature map.
[0012] Optionally, generating the pre-fusion feature map includes: generating a high-frequency feature enhancement coefficient and a low-frequency feature retention coefficient based on the defect degree parameter in the image processing guidance signal; and performing feature fusion on the high-frequency edge response features and low-frequency color distribution features in the stage-optimized feature map based on the high-frequency feature enhancement coefficient and the low-frequency feature retention coefficient to generate the pre-fusion feature map.
[0013] Optionally, generating the optimized food inspection report includes: evaluating the initial inspection results to generate simulated inspection results; comparing the simulated inspection results with a preset standard for the image of the food to be inspected to generate an inspection quality loss; and generating an optimized food inspection report based on the inspection quality loss.
[0014] Optionally, generating simulated detection results includes: performing a classification operation based on the initial detection results to simulate manual judgment and generating a judgment result; superimposing the judgment result based on the image processing guidance signal; and performing statistical analysis on the superimposed judgment result to generate simulated detection results.
[0015] Optionally, the generation of detection quality loss includes: generating a defect feature vector based on the simulated detection results; calculating the Euclidean distance between the defect feature vector and a preset standard feature vector to generate a preliminary loss value; and adjusting the preliminary loss value based on the defect degree parameter in the image processing guidance signal to generate a detection quality loss.
[0016] Based on the same inventive concept, this invention also provides a food inspection system based on image recognition, comprising: a defect guidance generation module for generating an image processing guidance signal based on a preset image of the food to be inspected; a dual-frequency optimization engine module for extracting and optimizing features from the image of the food to be inspected to generate a stage-optimized feature map; a cross-modal fusion hub module for fusing the image processing guidance signal and the stage-optimized feature map to generate a cross-stage fusion feature map; an intelligent initial inspection decision module for generating an initial inspection result based on the cross-stage fusion feature map; and a closed-loop report optimization module for generating an optimized food inspection report based on the initial inspection result and the image of the food to be inspected.
[0017] Compared with the prior art, the present invention has the following advantages:
[0018] 1. By fusing image processing guidance signals and stage-optimized feature maps, cross-stage fusion of high-frequency edge response features and low-frequency color distribution features is achieved, which can comprehensively capture the defect features of food and greatly improve the accuracy of food defect detection, especially the ability to distinguish different types of defects such as fine cracks and surface mold.
[0019] 2. By introducing a defect severity parameter to dynamically adjust the feature processing, and generating high-frequency feature enhancement coefficients and low-frequency feature retention coefficients, the feature extraction process becomes more targeted, effectively reducing interference from irrelevant information. Even in complex backgrounds or scenarios with significant differences in food appearance, the method can still maintain stable detection performance, thus improving its adaptability.
[0020] 3. A closed-loop processing mechanism was constructed from initial test results to optimized reports. By evaluating initial results, calculating quality losses, and optimizing the reports, the test reports not only include defect types and parameters, but also reflect the reliability of the tests. This provides a more comprehensive and reliable basis for food quality assessment and reduces errors from human judgment.
[0021] 4. By combining shallow feature extraction with deep feature optimization and applying techniques such as convolution calculation, efficient processing of food image features is achieved, shortening detection time and reducing dependence on massive sample data. This facilitates rapid deployment in actual production and improves the efficiency and practicality of food detection.
[0022] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic flowchart of a food detection method based on image recognition according to an embodiment of the present invention.
[0025] Figure 2 This is a schematic diagram of the influence curve of the image processing guidance signal on the defect location error in an embodiment of the present invention.
[0026] Figure 3 This is a schematic diagram of the dynamic correlation curve between the defect severity parameter and the feature processing coefficient in an embodiment of the present invention.
[0027] Figure 4 This is a schematic diagram of the structure of a food detection system based on image recognition according to an embodiment of the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] Reference Figure 1 One embodiment of the present invention proposes a food detection method based on image recognition, which uses image processing to guide signals and cross-stage feature fusion to improve the accuracy and automation of food defect detection.
[0030] The method described in this embodiment specifically includes:
[0031] Based on a preset image of the food to be inspected, an image processing guidance signal is generated, which includes a defect degree parameter.
[0032] The image of the food to be detected is subjected to feature extraction and optimization to generate a stage-optimized feature map, wherein the stage-optimized feature map includes high-frequency edge response features and low-frequency color distribution features;
[0033] The image processing guidance signal and the stage optimization feature map are fused to generate a cross-stage fused feature map;
[0034] Based on the cross-stage fusion feature map, an initial detection result is generated;
[0035] Based on the initial detection results and the image of the food to be detected, an optimized food detection report is generated.
[0036] Specifically, an image processing guidance signal containing defect severity parameters is generated from a preset image of the food to be inspected. This signal provides directional guidance for subsequent processing. Feature extraction and optimization operations are performed on the image of the food to be inspected, generating a stage-optimized feature map that simultaneously contains high-frequency edge response features and low-frequency color distribution features. The high-frequency features capture surface defect details, while the low-frequency features reflect the overall color distribution. The image processing guidance signal and the stage-optimized feature map are fused across stages. The feature weights are dynamically adjusted based on the defect severity parameter in the signal to generate a cross-stage fused feature map that integrates shallow details and deep information. After generating the initial detection result based on this fused feature map, a secondary optimization is performed in conjunction with the original image of the food to be inspected, and the final food inspection report is output. The guidance signal enables adaptive processing throughout the entire process, significantly improving the accuracy of defect detection. The cross-stage feature map fusion mechanism effectively integrates multi-scale features, enhancing the ability to identify minute defects and resist interference. The secondary optimization combined with the original image ensures that the inspection report has both algorithmic accuracy and visual interpretability, greatly improving the reliability of automated food quality assessment and providing efficient technical support for production quality control.
[0037] Optionally, the generated image processing guidance signal includes:
[0038] Scan the image of the food to be detected to generate food appearance data, wherein the food appearance data includes local texture distribution parameters and color saturation parameters;
[0039] By integrating food appearance data and preset food defect feature parameters, an image processing guidance signal is generated.
[0040] Specifically, the food image to be inspected is scanned to generate food appearance data, which is then fused with preset food defect feature parameters. The scanning operation of the food image employs an image segmentation method, dividing the image into multiple local regions. For each region, a local binary pattern algorithm is applied to extract texture features. This algorithm generates a binary pattern by comparing the grayscale values of each pixel with its neighboring pixels and calculates a pattern histogram as a local texture distribution parameter, which quantifies the texture complexity of the image region. The food image is converted from a red-green-blue color space to a hexagonal pyramidal color space, which contains three components: hue, saturation, and lightness. The saturation component is extracted, and its average value across the entire image is calculated as a color saturation parameter, representing the purity and intensity of the image color. The local texture distribution parameters and color saturation parameters are combined to construct the food appearance data. The food appearance data is then combined with preset food defect feature parameters, which are feature vectors extracted from historical food defect samples. These parameters include texture and color reference values for typical defects such as spots or cracks, and are stored in a database and loaded via query. The fusion process is achieved by calculating a similarity score, using the following formula:
[0041] S = w1·sim T +w2·sim C ,
[0042] Where S is the defect severity parameter, and w1 and w2 are preset weighting coefficients, determined through experimental optimization to balance the influence of texture and color. T It is the cosine similarity between the local texture distribution parameters and the preset texture defect feature parameters, sim C It is the cosine similarity between the color saturation parameter and the preset color defect feature parameter. The cosine similarity function calculates the cosine value of the angle between the two vectors to measure the similarity. This defect degree parameter is a core component of the image processing guidance signal, which is ultimately used to generate the image processing guidance signal.
[0043] This method effectively guides subsequent image processing stages by generating image processing guidance signals containing defect severity parameters, thereby improving the accuracy and robustness of food defect detection, reducing the need for manual intervention, enhancing the reliability of automated food quality control systems, and optimizing resource utilization efficiency.
[0044] Optionally, the feature map optimization during the generation stage includes:
[0045] Shallow feature extraction is performed on the image of the food to be detected to generate a preprocessed image;
[0046] Based on the preprocessed image, deep feature optimization is performed to generate feature maps for defect suppression and quality enhancement.
[0047] Feature maps based on defect suppression and quality enhancement are optimized during the generation stage.
[0048] Optionally, the feature map for generating defect suppression and quality enhancement includes:
[0049] An adjustment bias coefficient is generated based on the image processing guidance signal;
[0050] Based on the adjusted bias coefficient, convolution calculation is performed on the preprocessed image to generate a feature map for defect suppression and quality enhancement.
[0051] Specifically, based on the food image to be detected, the first three layers of a convolutional neural network capture the basic texture and contour information of the image, outputting a preprocessed image that retains the original spatial details. The defect degree parameter is extracted from the image processing guidance signal. For adjusting the bias coefficient β, we have:
[0052] β=k·S,
[0053] Where k is a preset scaling factor, which is determined by regression analysis of the statistical relationship between the degree of defect and the optimal feature optimization weight in historical food testing data; S is the defect degree parameter, such as... Figure 2 The diagram shows the influence of the image processing guidance signal on the defect localization error. Convolution operations are performed using convolutional layers with kernel weights consisting of basic kernel weights, defect suppression kernel weights, and quality enhancement kernel weights. The basic kernel weights are the initial weights of the standard convolutional layers in the pre-defined convolutional neural network. The defect suppression kernel weights are obtained from image samples containing typical food defects, and the quality enhancement kernel weights are obtained from high-quality, defect-free food image samples. For the kernel weights W, we have:
[0054] W = β·W defect +(1-β)·W quality ,
[0055] Among them W defect W represents the convolution kernel weights for defect suppression. quality The convolution kernel weights are used for quality enhancement. Convolution operations are performed on the preprocessed image based on these kernel weights, and the output is the feature map for defect suppression and quality enhancement. High-frequency edge response features and low-frequency color distribution features are separated from the feature map. The high-frequency edge response features are obtained by processing the gradient information of the feature map using the Sobel edge detection operator, reflecting abrupt changes in the food surface contour and texture. The low-frequency color distribution features are obtained by processing the color channels of the feature map using a Gaussian low-pass filter, reflecting the overall color distribution of the food. These two features are combined to form the stage-optimized feature map.
[0056] Optionally, generating the cross-stage fusion feature map includes:
[0057] Based on the image processing guidance signal, feature processing is performed on the stage-optimized feature map to generate a pre-fusion feature map;
[0058] The stage-optimized feature map is fused with the pre-fusion feature map to generate a cross-stage fusion feature map.
[0059] Optionally, the generation of the pre-fusion feature map includes:
[0060] Based on the defect degree parameter in the image processing guidance signal, a high-frequency feature enhancement coefficient and a low-frequency feature retention coefficient are generated.
[0061] Based on the high-frequency feature enhancement coefficient and the low-frequency feature retention coefficient, the high-frequency edge response features and low-frequency color distribution features in the optimized feature map of the stage are fused to generate a pre-fusion feature map.
[0062] Specifically, the defect degree parameter is extracted from the image processing guidance signal. For the high-frequency feature enhancement coefficient γ... h ,have:
[0063] γ h =σ(a·S+b),
[0064] Where S is the defect severity parameter, σ represents the sigmoid activation function, and a and b are preset slope and offset parameters, determined through optimization using historical data. The sigmoid function maps the input to between 0 and 1, ensuring that γ... h It is a positive value and does not exceed 1. For the low-frequency feature retention coefficient γ_l, we have:
[0065] γ l =σ(c·S+d),
[0066] c and d are another set of preset parameters, also determined through optimization using historical data, γ l It is also within the range of 0 to 1. The high-frequency edge response features are enhanced by multiplying the high-frequency feature enhancement coefficient by the high-frequency edge response features, amplifying the feature responses related to edge and texture abrupt changes. The low-frequency color distribution features are preserved by multiplying the low-frequency feature retention coefficient by the low-frequency color distribution features, reducing the intensity of low-frequency components that may contain interfering information. The enhanced high-frequency edge response features and the preserved low-frequency color distribution features are then concatenated to form a pre-fusion feature map, such as... Figure 3 The diagram shows the dynamic correlation curve between the defect severity parameter and the feature processing coefficient. A weighted summation method is used to combine the stage-optimized feature map with the pre-fusion feature map; the fusion formula is as follows:
[0067]
[0068] Where F fused For the output cross-stage fusion feature map, F optimized To optimize the feature map in stages, The first part is the fusion feature map, and α is the fusion weight coefficient.
[0069] This method dynamically controls the fusion ratio of features at different stages by guiding signals, achieving effective complementarity and synergy between shallow detail features and deep semantic features. This enhances the ability of feature representation to distinguish food defects and the fidelity of normal features, providing richer and more interference-resistant feature representations for subsequent detection steps, and significantly improving the robustness and accuracy of the entire food detection system.
[0070] Optionally, generating the optimized food testing report includes:
[0071] The initial detection results are evaluated to generate simulated detection results;
[0072] By comparing the simulated detection results with a preset standard for the image of the food to be detected, a detection quality loss is generated;
[0073] Optimized food testing reports are generated based on the loss of testing quality.
[0074] Optionally, the generation of simulated detection results includes:
[0075] Based on the initial detection results, a classification operation is performed to simulate manual judgment and generate a judgment result;
[0076] The judgment results are superimposed based on the image processing guidance signal;
[0077] Perform statistical analysis on the superimposed judgment results to generate simulated detection results.
[0078] Optionally, the generation of detection quality loss includes:
[0079] A defect feature vector is generated based on the simulated detection results;
[0080] Calculate the Euclidean distance between the defect feature vector and the preset standard feature vector to generate an initial loss value;
[0081] The initial loss value is adjusted based on the defect degree parameter in the image processing guidance signal to generate the detection quality loss.
[0082] Specifically, a pre-trained manual judgment simulation classification model is used to process the initial detection results. This model is a convolutional neural network classifier, trained on a historical dataset of manual inspection records. Its network structure includes fully connected layers and a normalized exponential function. It takes defect features from the initial detection results as input and outputs a multi-dimensional probability vector as the judgment result. Each dimension of this vector corresponds to the confidence probability of a specific defect category, representing the possible defect type judgment given by the human quality inspector, thus generating the judgment result. Defect severity parameters are extracted from the image processing guidance signal. A superposition operation is performed, using the defect severity parameters as weighting coefficients to weight and fuse them with the judgment result.
[0083] R weighted =R judgment ·S,
[0084] Where R judgment For the judgment result, S is the defect severity parameter, and R... weighted To achieve a weighted summation, the multiplication operation is performed element-wise along the feature dimension, scaling the confidence probability of each defect category according to the defect severity. The mean probability of each defect category is calculated as the defect frequency index. Simultaneously, based on the location coordinate information in the initial detection results, the image is divided into grid regions, and the number of defects per unit area is counted as the spatial distribution density index. The defect frequency index and the spatial distribution density index are combined to form the simulated detection result.
[0085] Based on the simulated detection results, a defect frequency index is obtained, and a defect feature vector is generated. The dimensions of this vector are consistent with the preset standard feature vector, with each dimension corresponding to a quantitative index for a specific defect type. The defect-free standard feature vector corresponding to the current food type to be detected is loaded from a preset standard database. This database stores the feature benchmark values of various foods under ideal conditions and is pre-established by collecting statistical features from a large number of defect-free samples. The Euclidean distance between the defect feature vector and the standard feature vector is calculated as the initial loss value. For the initial loss value L... pre ,have:
[0086]
[0087] Where n represents the number of dimensions of the feature vector. and Let L represent the eigenvalues of the two vectors in the i-th dimension, respectively. `sum()` represents summing over all dimensions, and `sqrt()` represents the square root operation. Finally, the defect severity parameter is extracted from the image processing guidance signal, and the detection quality loss is calculated. For the detection quality loss L... quality ,have:
[0088] L quality =L pre ·(1+S),
[0089] S is a defect severity parameter, which is used as an adjustment factor to amplify or reduce the initial loss value. When the value of S is large, it indicates a higher degree of defect, and the quality loss value is increased accordingly.
[0090] Finally, the detected quality loss value is combined with the defect location information in the initial detection results and converted into a structured text description. At the same time, different levels of quality alarm prompts are triggered according to the numerical range of the detected quality loss, forming an optimized food inspection report.
[0091] This method enhances the credibility of test results and corrects errors by simulating human judgment mechanisms and standard comparison processes. It effectively overcomes the limitations of pure algorithm detection, generates reports that better meet actual quality inspection needs, significantly improves the accuracy and operability of food quality assessment, and provides a highly reliable basis for production decisions.
[0092] Based on the same inventive concept, such as Figure 4 As shown, the present invention also provides a food detection system based on image recognition, the system comprising:
[0093] Defect-guided generation module: used to generate image processing guidance signals based on a preset image of the food to be inspected;
[0094] Dual-frequency optimization engine module: used to extract and optimize features from the food image to be detected, and generate a stage-optimized feature map;
[0095] Cross-modal fusion central module: used to fuse the image processing guidance signal and the stage optimization feature map to generate a cross-stage fusion feature map;
[0096] Intelligent initial detection decision module: used to generate initial detection results based on the cross-stage fusion feature map;
[0097] Closed-loop report optimization module: used to generate an optimized food inspection report based on the initial detection results and the image of the food to be inspected.
[0098] Example 1:
[0099] To verify the feasibility of this invention in practice, it was applied to the automated apple sorting production line of a large food processing company, "Xianmei Food Co., Ltd." This company aims to improve the efficiency and accuracy of apple sorting, reducing product quality problems and material waste caused by inconsistent and inefficient manual quality inspection standards. The method and system of this invention are integrated into the image acquisition and processing unit of its high-speed conveyor belt for real-time defect detection and quality grading of apples on the conveyor belt.
[0100] To verify the effectiveness of this invention, this embodiment collected images of apples from different batches on the production line, covering various conditions such as normal and flawless apples, minor scratches, obvious bruises, surface cracks, and mold. The system processed the image of each apple and compared it with the inspection results of experienced human quality inspectors.
[0101] In this embodiment, when an apple with minor bruising (number AP-001) passes through the detection area, the system first generates an image processing guidance signal based on its image. The system scans the apple image, extracts its local texture distribution parameters (texture smoothness changes in the bruised area) and color saturation parameters (the bruised area appears dull), and generates food appearance data. This data is then fused with a preset apple defect feature parameter library (containing reference values for typical defects such as bruises and cracks), calculating the apple's defect severity parameter to be 0.65. This signal indicates a moderate degree of defect and will guide subsequent processing steps.
[0102] Next, the system performs feature extraction and optimization on the image of the Apple AP-001. In the shallow feature extraction stage, the system uses a pre-trained convolutional network to capture the basic contour and color information of the apple, generating a preprocessed image. In the deep feature optimization stage, the system generates an adjustment bias coefficient β based on the defect severity parameter S=0.65, and uses this coefficient to dynamically weight the convolution kernel, making the convolution calculation focus more on defect suppression rather than quality enhancement, thus effectively highlighting the abnormal features of the bruise area in the generated defect suppression and quality enhancement feature map. Finally, high-frequency edge response features (bruise contour) and low-frequency color distribution features (overall color) are separated from this feature map and combined to form a stage-optimized feature map.
[0103] Subsequently, the system fuses the image processing guidance signal and the stage-optimized feature map. Based on the defect severity parameter S=0.65, the system generates a high high-frequency feature enhancement coefficient to sharpen the bruise edges, and a moderate low-frequency feature preservation coefficient. Both are used to process the stage-optimized feature map, generating a pre-fusion feature map. This pre-fusion feature map is then fused with the original stage-optimized feature map using a weighted summation method, generating a more informative cross-stage fusion feature map.
[0104] Based on this cross-stage fusion feature map, the system generated initial detection results, accurately locating the position and approximate extent of the bruise. To generate the final optimized report, the system first evaluated the initial detection results. Using a classification model simulating human judgment, a judgment result was generated, classifying the defect as "moderate bruising." This judgment result was superimposed with the defect severity parameter S=0.65, and after statistical analysis, a simulated detection result was generated. Then, the system calculated the Euclidean distance between this simulated detection result and the preset "Grade 1 Premium Apple" standard feature vector to obtain a preliminary loss value. This loss value was then adjusted using S=0.65, ultimately resulting in a detection quality loss of 87.3. Based on this loss value and the initial detection results, the system generated an optimized food inspection report, classifying apple AP-001 as "Grade 2" and indicating the specific location of the defect.
[0105] Through testing on thousands of samples, this invention demonstrated superior detection performance. When processing an apple with a minor crack (serial number AP-002), the system calculated a low defect severity parameter S = 0.32, thus prioritizing quality enhancement during feature optimization and retaining more low-frequency color information during feature fusion. This resulted in accurate identification of the minor crack without misclassifying the apple's natural spots as defects. For an apple with mold on its surface (serial number AP-003), the system calculated an extremely high defect severity parameter S = 0.91, guiding the system to maximize the enhancement of high-frequency defect features and calculate a high quality loss value, ultimately classifying it as "scrap" and triggering a rejection instruction.
[0106] Data comparison shows that the method of this invention has significant advantages in detection accuracy, robustness, and processing efficiency. Traditional algorithms have a false negative rate of approximately 15% for subtle defects, while this invention, through guiding signals and a cross-stage fusion mechanism, reduces the false negative rate to below 3%. For complex backgrounds or uneven lighting conditions, the adaptive feature optimization capability of this invention improves its accuracy by approximately 18% compared to traditional methods.
[0107] Table 1 Apple Defect Detection Guide Signal Generation Data Table
[0108]
[0109] Table 2. Data on Apple Defect Feature Extraction and Fusion Results
[0110]
[0111]
[0112] Table 3 Apple Inspection Results and Quality Loss Assessment Data
[0113]
[0114] Tables 1-3 above record the actual application data of the present invention in the Apple automated sorting scenario, and show in detail the superior performance of the system in terms of guide signal generation, adaptive feature processing and final quality assessment.
[0115] Table 1 shows that the system can generate a defect severity parameter S that matches the severity of different defects based on their visual characteristics. For example, the S value is as high as 0.91 for the severe defect "surface mold" (AP-003), while the S value is only 0.13 for the "normal and flawless" apple (AP-004), demonstrating the accuracy and discriminative power of the guide signal generation.
[0116] Table 2 clearly illustrates how the guiding signal directs subsequent feature processing. Samples with higher defect severity (e.g., AP-003) exhibit higher adjustment bias coefficients β and high-frequency feature enhancement coefficients, indicating that the system adaptively focuses computational resources on extracting and enhancing defective features. Conversely, for samples with less pronounced defects (e.g., AP-002 and AP-004), the system prioritizes preserving low-frequency features that reflect overall quality, avoiding over-processing of normal textures.
[0117] Table 3 shows that the system's judgment results are highly consistent with those of manual quality inspection, verifying the accuracy and reliability of the entire testing process. The detected quality loss value effectively quantifies product quality deviations, providing a reliable numerical basis for automated grading. For example, the detected quality loss value shows a clear positive correlation with the severity of defects, providing scientific support for setting thresholds for "Grade 1," "Grade 2," and "Residue." These data fully demonstrate that this invention can significantly improve the automation level of food testing and the accuracy of quality control.
[0118] It should be noted that the electrical connections between the various units described above do not necessarily represent direct or indirect connections. Any indirect connection method can be applied to the embodiments of the present invention as long as it achieves the purpose of the present invention. The above descriptions are merely exemplary embodiments of the present invention and should not be construed as limiting the scope of the present invention.
[0119] All equivalent changes and modifications made in accordance with the teachings of this invention are still within the scope of this invention. Those skilled in the art will readily conceive of other embodiments of this invention upon considering the disclosure in this specification. This application is intended to cover any variations, uses, or adaptations of this invention that follow the general principles of this invention and include common knowledge or conventional techniques in the art not described herein.
Claims
1. A food detection method based on image recognition, characterized in that, include: Based on a preset image of the food to be inspected, an image processing guidance signal is generated, which includes a defect degree parameter. The image of the food to be detected is subjected to feature extraction and optimization to generate a stage-optimized feature map, wherein the stage-optimized feature map includes high-frequency edge response features and low-frequency color distribution features; The image processing guidance signal and the stage optimization feature map are fused to generate a cross-stage fused feature map; Based on the cross-stage fusion feature map, an initial detection result is generated; Based on the initial detection results and the image of the food to be detected, an optimized food detection report is generated.
2. The food detection method based on image recognition according to claim 1, characterized in that, The image processing guidance signal includes: Scan the image of the food to be detected to generate food appearance data, wherein the food appearance data includes local texture distribution parameters and color saturation parameters; By integrating food appearance data and preset food defect feature parameters, an image processing guidance signal is generated.
3. The food detection method based on image recognition according to claim 1, characterized in that, The feature map optimization during the generation phase includes: Shallow feature extraction is performed on the image of the food to be detected to generate a preprocessed image; Based on the preprocessed image, deep feature optimization is performed to generate feature maps for defect suppression and quality enhancement. Feature maps based on defect suppression and quality enhancement are optimized during the generation stage.
4. The food detection method based on image recognition according to claim 3, characterized in that, The feature map for defect suppression and quality enhancement includes: An adjustment bias coefficient is generated based on the image processing guidance signal; Based on the adjusted bias coefficient, convolution calculation is performed on the preprocessed image to generate a feature map for defect suppression and quality enhancement.
5. The food detection method based on image recognition according to claim 1, characterized in that, The generation of the cross-stage fusion feature map includes: Based on the image processing guidance signal, feature processing is performed on the stage-optimized feature map to generate a pre-fusion feature map; The stage-optimized feature map is fused with the pre-fusion feature map to generate a cross-stage fusion feature map.
6. The food detection method based on image recognition according to claim 5, characterized in that, The generation of the pre-fusion feature map includes: Based on the defect degree parameter in the image processing guidance signal, a high-frequency feature enhancement coefficient and a low-frequency feature retention coefficient are generated. Based on the high-frequency feature enhancement coefficient and the low-frequency feature retention coefficient, the high-frequency edge response features and low-frequency color distribution features in the optimized feature map of the stage are fused to generate a pre-fusion feature map.
7. The food detection method based on image recognition according to claim 1, characterized in that, The generated optimized food testing report includes: The initial detection results are evaluated to generate simulated detection results; By comparing the simulated detection results with a preset standard for the image of the food to be detected, a detection quality loss is generated; Optimized food testing reports are generated based on the loss of testing quality.
8. The food detection method based on image recognition according to claim 7, characterized in that, The generated simulated detection results include: Based on the initial detection results, a classification operation is performed to simulate manual judgment and generate a judgment result; The judgment results are superimposed based on the image processing guidance signal; Perform statistical analysis on the superimposed judgment results to generate simulated detection results.
9. A food detection method based on image recognition according to claim 7, characterized in that, The generated detection quality loss includes: A defect feature vector is generated based on the simulated detection results; Calculate the Euclidean distance between the defect feature vector and the preset standard feature vector to generate an initial loss value; The initial loss value is adjusted based on the defect degree parameter in the image processing guidance signal to generate the detection quality loss.
10. A food detection system based on image recognition, applied to a food detection method based on image recognition as described in any one of claims 1-9, characterized in that, The system includes: Defect-guided generation module: used to generate image processing guidance signals based on a preset image of the food to be inspected; Dual-frequency optimization engine module: used to extract and optimize features from the food image to be detected, and generate a stage-optimized feature map; Cross-modal fusion central module: used to fuse the image processing guidance signal and the stage optimization feature map to generate a cross-stage fusion feature map; Intelligent initial detection decision module: used to generate initial detection results based on the cross-stage fusion feature map; Closed-loop report optimization module: used to generate an optimized food inspection report based on the initial detection results and the image of the food to be inspected.
Citation Information
Patent Citations
Food safety intelligent management method and system based on big data
CN111879772A
Real-time online detection method and system for fruit appearance defects
CN119845962A
Food freshness evaluation method and system based on image processing
CN119940701A
Untacting intermediation system for direct transaction of used car
KR102638726B1