Wolfberry quality safety intelligent detection method and system

Through the combination of color segmentation algorithm and convolutional neural network, the moldy characteristics of wolfberry are intelligently identified and graded and processed, solving the problems of low detection efficiency and high misjudgment rate in the existing technology, and achieving high-precision and low-risk wolfberry quality and safety detection.

CN119887665APending Publication Date: 2025-04-25NINGXIA INST OF AGRI PROD QUALITY STANDARDS & TESTING TECH (NINGXIA AGRI PROD QUALITY MONITORING CENT)
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411941929.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

When detecting the moldy conditions on the surface of wolfberry, the algorithm analysis time setting is too short, resulting in a slight or insignificant moldy characteristic being misjudged as qualified, which may lead to moldy wolfberry flowing into the market, affecting consumer health and causing food safety accidents.

Method used

The color segmentation algorithm is used to distinguish between normal and abnormal color areas, and combined with the pre-trained convolutional neural network to intelligently identify mold characteristics, quickly locate potential mold areas, and assign different algorithm analysis time according to the mold risk level.

Benefits of technology

It significantly improves the accuracy of mold detection, reduces the risk of missed inspection or misjudgment, optimizes detection efficiency, reduces the invalid treatment of normal areas, ensures sufficient detection of high-risk areas, and prevents food safety accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887665A_ABST
    Figure CN119887665A_ABST
Patent Text Reader

Abstract

The invention discloses a wolfberry quality safety intelligent detection method and system, and relates to the technical field of wolfberry quality detection.The wolfberry quality safety intelligent detection method comprises the following steps that a high-definition camera or an industrial camera is used for shooting the surfaces of wolfberries so as to capture high-resolution images; the collected original image is subjected to image preprocessing, the image quality is optimized, and the definition is improved; and aiming at each frame of image. According to the method, the wolfberry regions with normal colors and abnormal colors are accurately distinguished through the color segmentation algorithm, the mildewing features are intelligently identified in allusion to the abnormal color regions in combination with the pre-trained convolutional neural network, the potential mildewing regions are quickly positioned, and redundancy processing on the whole image is avoided. And the mildewed area is subjected to stage treatment, so that intelligent management of detection resources is realized. In this way, it is ensured that a high-risk area is fully detected, excessive calculation of a low-risk area is avoided, the omission ratio of mildewed Chinese wolfberry fruits is reduced, the product quality is improved, and food safety accidents are prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of wolfberry quality detection, and in particular to a wolfberry quality safety intelligent detection method and system. Background Art

[0002] Intelligent detection of wolfberry quality and safety refers to the use of advanced technical means, such as sensors, image processing and machine learning, to monitor and analyze the appearance, composition and quality of wolfberries in real time to ensure their safety and compliance. This detection system can automatically identify indicators such as the color, size, water content and impurities of wolfberries, so as to quickly determine whether they meet food safety standards. This intelligent detection method not only improves detection efficiency, but also effectively reduces human errors, ensuring that consumers can obtain high-quality wolfberry products.

[0003] When testing the quality of wolfberries, image processing technology is usually used to detect mold on the surface of wolfberries. Mold on wolfberries usually manifests as abnormal color or spots. Image processing technology can quickly and accurately detect these abnormalities and determine whether there is mold contamination. This technology greatly improves detection efficiency and avoids errors caused by human visual detection, helping to ensure the safety and quality of wolfberries and prevent substandard products from entering the market.

[0004] The prior art has the following deficiencies:

[0005] In the prior art, when image processing technology is used to detect the mold on the surface of wolfberries, in order to improve detection efficiency, the algorithm analysis time is usually set to be shorter. However, when the degree of mold on the surface of wolfberries is relatively light or not obvious, the shorter algorithm analysis time may cause the image processing algorithm to be unable to fully extract these subtle mold features, and then misjudge the moldy wolfberries as qualified products. Once these missed wolfberries enter the market, the moldy wolfberries may continue to mold during subsequent storage or transportation, seriously affecting the health of consumers, and even causing food safety accidents, leading to major health risks such as food poisoning.

[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention

[0007] The purpose of the present invention is to provide a method and system for intelligent detection of wolfberry quality and safety, which accurately distinguishes wolfberry areas with normal colors and abnormal colors through a color segmentation algorithm, and intelligently identifies moldy features in abnormal color areas in combination with a pre-trained convolutional neural network, quickly locates potential moldy areas, and avoids redundant processing of the entire image. By concentrating resources and computing power to conduct in-depth analysis of abnormal color areas, the accuracy of moldy detection is significantly improved, the risk of missed detection or misjudgment is reduced, and the ineffective processing of normal areas is reduced, and the overall detection efficiency is optimized. By performing graded processing on the moldy areas, different algorithm analysis times are allocated to slight, moderate and severe moldy areas, and intelligent management of detection resources is achieved. This ensures that high-risk areas are fully detected, and avoids excessive calculation of low-risk areas, further reduces the missed detection rate of moldy wolfberries, improves product quality, and prevents the occurrence of food safety accidents, so as to solve the problems in the above-mentioned background technology.

[0008] In order to achieve the above object, the present invention provides the following technical solution: a wolfberry quality and safety intelligent detection method, comprising the following steps:

[0009] Use a high-definition camera or industrial camera to photograph the surface of wolfberry to capture high-resolution images;

[0010] Perform image preprocessing on the collected original images to optimize image quality and improve clarity;

[0011] For each frame of image, the normal color wolfberry area and abnormal color wolfberry area in the image are distinguished by color segmentation algorithm;

[0012] After identifying the wolfberry area with abnormal color, the wolfberry area with abnormal color is marked, and the potential moldy features of the marked area are extracted. The extracted moldy features are input into a pre-trained convolutional neural network, and the marked area with moldy abnormalities is identified by analyzing the extracted features.

[0013] For the moldy areas identified by the convolutional neural network, the risk level of mold is further determined and divided into three levels: mild mold, moderate mold and severe mold. According to the mold risk level, different algorithm analysis times are allocated to different levels of mold.

[0014] Preferably, the normal color wolfberry area and the abnormal color wolfberry area in the image are distinguished by a color segmentation algorithm, and the specific steps are as follows:

[0015] Convert the original image from RGB color space to a space suitable for color segmentation;

[0016] Set the segmentation threshold according to the color characteristics of wolfberry;

[0017] According to the set color threshold, the region is segmented and the pixels in the image are classified into "normal color wolfberry region" and "abnormal color wolfberry region" using binarization. In the binarization process, all pixels that meet the color threshold are marked as "1", indicating the normal color wolfberry region, and pixels that do not meet the threshold are marked as "0", indicating the abnormal color wolfberry region;

[0018] After completing the color segmentation, the binary image is post-processed to remove noise and small irrelevant areas, and large connected areas. The contour detection algorithm is used to further analyze the regional shape to ensure that the large connected areas are consistent with the actual moldy areas.

[0019] Preferably, after identifying the wolfberry region with abnormal color, the marking method includes:

[0020] Add borders or outlines to abnormal areas in the image and use different colors to highlight abnormal areas;

[0021] Alternatively, change the pixel values ​​of the abnormal area to pseudo-color;

[0022] Optionally, add numbered labels to each anomalous region.

[0023] Preferably, potential mildew features of the marked area are extracted, and the extracted features include the density of small spots on the surface of wolfberry and the change in smoothness of the surface of wolfberry. After analyzing the density of small spots on the surface of wolfberry and the change in smoothness of the surface of wolfberry, a spot density index and a smoothness change index are generated respectively, and the potential mildew situation of wolfberry is intelligently perceived through the spot density index and the smoothness change index; after obtaining the spot density index and the smoothness change index generated by the analysis of wolfberry in the marked area, the spot density index and the smoothness change index are input into a pre-trained convolutional neural network, and a potential mildew coefficient is generated by analyzing the extracted features, and the marked area with mildew abnormality is identified through the potential mildew coefficient.

[0024] Preferably, the potential mildew coefficient generated after analyzing the wolfberries in the marked area through a convolutional neural network is compared and analyzed with a pre-set potential mildew coefficient reference threshold to identify the marked area with moldy abnormalities. The specific identification steps are: if the potential mildew coefficient is greater than or equal to the potential mildew coefficient reference threshold, the marked area is divided into a moldy area; if the potential mildew coefficient is less than the potential mildew coefficient reference threshold, the marked area is divided into a normal area.

[0025] Preferably, the specific steps of generating the spot density index by analyzing the density of small spots on the surface of wolfberry are as follows:

[0026] The wolfberry surface image is segmented to identify the spot area. The image processing technology is used to extract the small spot area in the image using a texture and color-based segmentation algorithm. Specifically, a spot detection function D(x, y) is set, where x and y are the pixel coordinates of the image, D(x, y) = 1, indicating that there is a spot at the pixel, and D(x, y) = 0, indicating that there is no spot;

[0027] After the spots are identified, the geometric features of each spot are calculated. For each spot area, a geometric complexity function is defined. The geometric complexity function is expressed by the ratio of the perimeter of the spot to the area of ​​the spot. The formula is:

[0028] ,

[0029] Among them, C i is the shape complexity of the i-th spot, P i is the perimeter of the i-th spot, A i is the area of ​​the i-th spot;

[0030] Considering the number and distribution density of spots comprehensively, the spot density index is generated in the entire wolfberry surface area. Let the total number of spots be n and the total area of ​​the image be A. total , define the spot density ρ as: Combined spot geometric complexity C i and spot density ρ, calculate the spot density index, the calculation expression is:

[0031] ,

[0032] In the formula, I density represents the spot density index, and k is the adjustment coefficient, which is used to adjust the influence of spot shape complexity on the result according to the different spot densities.

[0033] Preferably, the specific steps of generating a smoothness change index by analyzing the smoothness change of the wolfberry surface are as follows:

[0034] The smoothness feature of the wolfberry surface is extracted using the image gradient calculation method. The smoothness feature reflects the brightness change of each pixel in the image. By calculating the gradient of the image in different directions, the degree of change of the surface texture is determined. The specific calculation formula is: Among them, G(x, y) represents the gradient intensity at the pixel (x, y), I(x, y) is the gray value of the image at the pixel point (x, y), and are the brightness change rates along the horizontal and vertical directions respectively;

[0035] The local curvature analysis is performed on the results of the gradient calculation to quantify the subtle changes in the surface structure. The local curvature can reflect the changing trend of the surface smoothness and roughness. The change in smoothness is evaluated by calculating the curvature change in the area. The calculation expression is:

[0036] ,

[0037] Where C(x, y) represents the local curvature change at the pixel point (x, y), ∈ is a constant used to prevent the denominator from being zero;

[0038] After obtaining the local curvature change value, the smoothness change index is generated by normalizing and weighting the entire image. The smoothness change index is used to quantify the overall change of the smoothness of the entire wolfberry surface. The specific calculation expression is:

[0039] ,

[0040] In the formula, S mooth Represents the final smoothness change index, M and N are the width and height of the image respectively, W(x, y) is the weight of the pixel (x, y), which is assigned based on the degree of difference between the point and the surrounding area, D(x, y) is the density factor of the area, and λ is the adjustment factor.

[0041] Preferably, for the moldy area identified by the convolutional neural network, the risk level of the moldy area is further determined, and the specific steps are as follows:

[0042] The potential mildew coefficient generated by analyzing the wolfberry in the marked area through the convolutional neural network is compared with the first gradient reference threshold θ1 and the second gradient reference threshold θ2, where θ2>θ1>θ 参考 , where θ 参考 is the reference threshold of the potential mildew coefficient, and the mildew is divided into three levels: slight mildew, moderate mildew and severe mildew. The classification expression is: ψ mildew Indicates the potential mildew coefficient;

[0043] According to the mold level, different algorithm analysis times are allocated to different levels of mold areas. The time allocation formula is as follows: T a =δ·ψ mildew +T min , where T a is the algorithm analysis time allocated to the moldy area, δ is the time growth factor, which determines the influence of the potential mold coefficient on the time, T min The duration of the basic analysis;

[0044] The analysis time is dynamically adjusted according to the mold characteristics found in the actual detection process. The specific expression for dynamically adjusting the analysis time is: Among them, T final is the final analysis time, ΔC m is the change range of mildew characteristics, C ref is the expected reference change value.

[0045] An intelligent detection system for wolfberry quality and safety, comprising an image acquisition module, an image preprocessing module, a color segmentation module, an abnormal area marking module, a moldy area identification module, a moldy risk classification determination module, and an algorithm analysis time allocation module;

[0046] An image acquisition module uses a high-definition camera or an industrial camera to shoot the surface of wolfberry to capture high-resolution images;

[0047] Image preprocessing module, which performs image preprocessing on the collected original images to optimize image quality and improve clarity;

[0048] Color segmentation module, for each frame of image, distinguishes the normal color wolfberry area from the abnormal color wolfberry area in the image through color segmentation algorithm;

[0049] The abnormal region marking module marks the wolfberry region with abnormal color after identifying the wolfberry region with abnormal color;

[0050] The moldy area recognition module extracts the potential moldy features of the marked area, inputs the extracted moldy features into a pre-trained convolutional neural network, and identifies the marked area with moldy abnormalities by analyzing the extracted features;

[0051] The mold risk grading module further determines the mold risk level of the mold area identified by the convolutional neural network, and divides the mold into three levels: slight mold, moderate mold, and severe mold;

[0052] The algorithm analysis time allocation module allocates different algorithm analysis times to different levels of mold risk levels.

[0053] In the above technical solution, the technical effects and advantages provided by the present invention are:

[0054] The present invention uses a color segmentation algorithm to accurately distinguish between normal and abnormal color wolfberry areas. For abnormal color areas, it combines a pre-trained convolutional neural network to intelligently identify moldy features, quickly locate potential moldy areas, and avoid redundant processing of the entire image. By concentrating resources and computing power to conduct in-depth analysis of abnormal color areas, the accuracy of mold detection is significantly improved, the risk of missed detection or misjudgment is reduced, and at the same time, the ineffective processing of normal areas is reduced, optimizing the overall detection efficiency.

[0055] The present invention achieves intelligent management of detection resources by classifying moldy areas and allocating different algorithm analysis durations for mild, moderate and severe moldy areas. This ensures that high-risk areas are fully detected and avoids over-calculation of low-risk areas, further reducing the missed detection rate of moldy wolfberries, improving product quality and preventing food safety accidents. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0057] Figure 1 The present invention is a method flow chart of an intelligent method for detecting wolfberry quality and safety.

[0058] Figure 2 The present invention is a module schematic diagram of an intelligent detection system for wolfberry quality and safety. DETAILED DESCRIPTION

[0059] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present disclosure will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art.

[0060] The present invention provides Figure 1 The method for intelligent detection of wolfberry quality and safety shown in the figure comprises the following steps:

[0061] Use a high-definition camera or industrial camera to photograph the surface of wolfberry to capture high-resolution images;

[0062] These camera devices can clearly present the details of the wolfberry surface, including color, texture and appearance characteristics. To ensure the stability and consistency of the image, the autofocus and light source adjustment functions can be used to obtain high-quality image data under different lighting conditions. The accuracy of image acquisition directly affects the subsequent detection accuracy, so it is necessary to ensure the high sensitivity and reliability of the equipment.

[0063] Perform image preprocessing on the collected original images to optimize image quality and improve clarity;

[0064] Preprocessing includes operations such as denoising, color correction and image enhancement, which can optimize image quality and improve clarity. Specifically, filtering algorithms such as Gaussian filtering or median filtering are used to remove noise, and white balance and brightness are adjusted according to actual lighting conditions to ensure that the color and texture information of wolfberries in the image are clear and accurate. The preprocessed image provides a more reliable data basis for subsequent algorithms.

[0065] For each frame of the image, a normal color wolfberry area and an abnormal color wolfberry area in the image are distinguished by a color segmentation algorithm (such as segmentation based on RGB or HSV color space);

[0066] The RGB color space directly reflects the three primary colors of the image, while the HSV color space is more suitable for distinguishing changes in hue, saturation, and brightness. Color segmentation can quickly identify wolfberry areas with abnormal colors, which may be potential risk areas for mold. This process can significantly narrow the detection range, concentrate resources on areas where there may be problems, and improve detection efficiency.

[0067] The process of distinguishing the normal color wolfberry area and the abnormal color wolfberry area in the image through the color segmentation algorithm can be divided into the following four specific steps:

[0068] Step 1: Image color space conversion

[0069] First, the original image is converted from the RGB color space to a space suitable for color segmentation. Although RGB can be used directly for color segmentation, it is sensitive to changes in lighting, so in some cases it is necessary to convert the image to other color spaces, such as HSV (hue-saturation-value) or Lab (brightness-color contrast) space. HSV is particularly suitable for distinguishing hue and saturation, while Lab can reduce the impact of brightness changes and make color segmentation more robust. The converted color space can effectively enhance the color contrast of the wolfberry area, which is convenient for subsequent segmentation.

[0070] Step 2: Color Threshold Setting

[0071] Next, set the segmentation threshold according to the color characteristics of wolfberry. Wolfberry usually presents a specific red or orange-red color, so the upper and lower thresholds of the red area can be determined by analyzing the color range of normal wolfberry. For the RGB color space, a higher threshold can be set for the red channel, and lower thresholds for the green and blue channels. For the HSV color space, the appropriate threshold range is mainly set based on hue and saturation. The accuracy of threshold setting directly affects the effect of color segmentation. A reasonable threshold can effectively distinguish normal wolfberry from abnormal color areas.

[0072] Step 3: Color region segmentation

[0073] The region is segmented according to the set color threshold, and the pixels in the image are classified into "normal color wolfberry region" and "abnormal color wolfberry region" using binarization. In the binarization process, all pixels that meet the color threshold are marked as "1", indicating the normal color wolfberry region, and pixels that do not meet the threshold are marked as "0", indicating the abnormal color wolfberry region. This segmentation result usually generates a binary image, in which the normal color wolfberry region is displayed in white and the abnormal color wolfberry region is displayed in black. In this way, the areas in the image that may be moldy can be quickly isolated.

[0074] Step 4: Post-processing and noise removal

[0075] After color segmentation, the binary image is post-processed to remove noise and small irrelevant areas. Morphological operations (such as erosion and dilation) can be used to smooth edges and remove small speckle noise, which can improve the accuracy of segmentation. For larger connected areas, contour detection algorithms can be used to further analyze the shape of the area to ensure that these areas are consistent with the actual moldy areas. After post-processing, the system will generate cleaner and more accurate color segmentation results, laying the foundation for subsequent mold feature extraction.

[0076] Through these optimization steps, the color segmentation process can not only quickly identify abnormal areas of wolfberry, but also ensure the accuracy of the results, providing reliable data support for mold detection.

[0077] After identifying the wolfberry area with abnormal color, the wolfberry area with abnormal color is marked, and the potential moldy features of the marked area are extracted. The extracted moldy features are input into a pre-trained convolutional neural network, and the marked area with moldy abnormalities is identified by analyzing the extracted features.

[0078] After identifying the wolfberry areas with abnormal colors, marking can be done in a variety of ways. Common ways include: adding borders or outlines to the abnormal areas in the image, usually using different colors (such as red) to highlight the abnormal areas; or changing the pixel values ​​of the abnormal areas to specific pseudo colors, such as rendering the abnormal parts in blue or green, so that they can be visually distinguished in the image. In addition, it is also possible to add numbered labels to each abnormal area to facilitate subsequent classification and processing. Each marking method is designed to clearly point out the areas with abnormal colors to ensure that these parts can be accurately processed in subsequent steps.

[0079] The potential mold features of the marked area are extracted, including the density of small spots on the surface of wolfberries and the change in smoothness of the surface of wolfberries. After analyzing the density of small spots on the surface of wolfberries and the change in smoothness of the surface of wolfberries, a spot density index and a smoothness change index are generated respectively. The potential mold condition of wolfberries is intelligently perceived through the spot density index and the smoothness change index.

[0080] After obtaining the spot density index and smoothness change index generated by the wolfberry analysis of the marked area, the spot density index and smoothness change index are input into a pre-trained convolutional neural network, and the potential mildew coefficient is generated by analyzing the extracted features. The marked area with moldy abnormalities is identified by the potential mildew coefficient.

[0081] The pre-trained convolutional neural network (CNN) is a deep learning model that is particularly good at processing image data. CNN automatically extracts high-dimensional features from the input data through a series of convolutional layers, pooling layers, and fully connected layers. The convolutional layer extracts local features in the input data through convolution operations, such as the density and smoothness changes of small spots on the surface of wolfberries, while the pooling layer is used to downsample the data, retaining key features while reducing the amount of calculation. The convolutional neural network can adaptively adjust its weights and bias parameters to learn how to effectively distinguish moldy areas from normal areas from a large amount of training data. This structure enables it to excel in complex image analysis tasks, especially when detecting subtle moldy features, and can automatically identify details that are difficult to capture through traditional methods.

[0082] In the scenario of wolfberry mold detection, a pre-trained CNN refers to a model that has been trained with a large amount of sample data (such as images containing moldy and non-moldy wolfberry areas). This training process includes forward propagation and back propagation, and the model maximizes its ability to accurately recognize training samples by continuously updating its parameters. After training, the model can effectively identify new input image data and extract potential mold features based on the input spot density index and smoothness change index, thereby generating a "potential mold coefficient." Through the potential mold coefficient, CNN can intelligently determine whether the marked area has mold abnormalities. The advantage of this model is that it can automatically learn features without human intervention, which greatly improves detection accuracy and efficiency.

[0083] A high density of small spots on the surface of wolfberries usually indicates potential mold growth in wolfberries. The early stages of mold growth often appear as fine surface spots, which are small changes caused by mold growth on the wolfberry surface. As the mold grows, these spots gradually increase in number and form a dense distribution. The high density of small spots reflects the expansion of the moldy area, indicating that the wolfberries are deeply infected by mold. In addition, mold growth is often accompanied by changes in surface color, texture, and moisture content, so an increase in spot density not only represents an early sign of mold growth, but may also be a signal of the spread of mold growth. Therefore, monitoring changes in the density of small spots can be used as an important indicator to determine the mold growth of wolfberries.

[0084] The specific steps for generating the spot density index by analyzing the density of small spots on the surface of wolfberry are as follows:

[0085] The wolfberry surface image is segmented to identify the spot area. The image processing technology is used to extract the small spot area in the image using a texture and color-based segmentation algorithm. A spot detection function D(x, y) is set, where x and y are the pixel coordinates of the image. D(x, y) = 1 indicates that there is a spot at the pixel, and D(x, y) = 0 indicates that there is no spot.

[0086] With this function, spots can be marked in the entire image area.

[0087] After the spots are identified, the geometric features of each spot, such as area, perimeter and shape complexity, are calculated. For each spot area, its geometric complexity function is defined, which is expressed by the ratio of the perimeter of the spot to the area of ​​the spot, and the formula is:

[0088]

[0089] , where C i is the shape complexity of the i-th spot, P i is the perimeter of the i-th spot, A i is the area of ​​the i-th spot;

[0090] The shape complexity indicates the irregularity of the spot shape. The higher the shape complexity, the more irregular the spot shape is, which may be a sign of mold spread. In this way, the complexity information of each spot can be obtained.

[0091] Considering the number and distribution density of spots comprehensively, the spot density index is generated in the entire wolfberry surface area. Let the total number of spots be n and the total area of ​​the image be A. total , define the spot density ρ as: Combined spot geometric complexity C i and spot density ρ, calculate the spot density index, the calculation expression is:

[0092] ,

[0093] In the formula, I density represents the spot density index, k is the adjustment coefficient, which is used to adjust the influence of spot shape complexity on the result according to the different spot densities;

[0094] This step combines the shape complexity and density of the spots, not just relying on the number, but also considering the distribution and geometric characteristics of the spots, to more accurately reflect the severity of potential mildew.

[0095] It can be seen from the spot density index that the larger the performance value of the spot density index generated by analyzing the density of small spots on the surface of wolfberry, the greater the risk of mold on the surface of wolfberry. The spot density index combines the number, distribution density and geometric complexity characteristics of the spots on the surface of wolfberry. Therefore, when the spot density index is high, it means that there are more spots on the surface and the spot shapes are more complex, which are usually early signs of mold spread. Conversely, when the spot density index is low, it means that there are fewer spots on the surface of wolfberry and the distribution is sparse, and the potential risk of mold is smaller. Therefore, the higher the spot density index, the greater the risk of mold; the lower it is, the smaller the risk.

[0096] A high degree of smoothness variation on the surface of wolfberries usually indicates potential mold. This is because mold often causes a change in the texture of the wolfberry surface, which may change from smooth to rough or uneven. When mold attacks the surface of the wolfberry, it causes localized water evaporation, tissue decomposition, or spots, which in turn affect the surface structure of the wolfberry. Although this change is difficult to detect with the naked eye, image processing technology can accurately detect subtle differences in smoothness. Large smoothness changes usually mean that traces of mold or other microbial growth are beginning to form on the surface of the wolfberry, and are therefore an early warning sign of mold. Through intelligent analysis of smoothness changes, the system can effectively sense the potential mold risk of wolfberries.

[0097] The specific steps for generating the smoothness change index by analyzing the smoothness change of the wolfberry surface are as follows:

[0098] The smoothness feature of the wolfberry surface is extracted using the image gradient calculation method. The smoothness feature reflects the brightness change of each pixel in the image. By calculating the gradient of the image in different directions, the degree of change of the surface texture can be determined. The specific calculation formula is: Among them, G(x, y) represents the gradient intensity at the pixel (x, y), I(x, y) is the gray value of the image at the pixel point (x, y), and are the brightness change rates along the horizontal and vertical directions respectively;

[0099] The greater the gradient intensity, the more obvious the change in the smoothness of the wolfberry surface.

[0100] The local curvature analysis is performed on the results of the gradient calculation to quantify the subtle changes in the surface structure. The local curvature can reflect the changing trend of the surface smoothness and roughness. The change in smoothness is evaluated by calculating the curvature change in the area. The calculation expression is:

[0101] ,

[0102] Where C(x, y) represents the local curvature change at the pixel point (x, y), and ∈ is a small constant used to prevent the denominator from being zero;

[0103] The greater the change in local curvature, the higher the unevenness of the wolfberry surface, which is usually associated with moldy conditions.

[0104] After obtaining the local curvature change value, the smoothness change index is generated by normalizing and weighting the entire image. The smoothness change index is used to quantify the overall change of the smoothness of the entire wolfberry surface. The specific calculation expression is:

[0105] ,

[0106] In the formula, S mooth represents the final smoothness change index, M and N are the width and height of the image respectively, W(x, y) is the weight of the pixel (x, y), which is assigned based on the degree of difference between the point and the surrounding area (if the point is more different from the surrounding pixels, its weight may be higher, indicating that the point is more important in the analysis process. This weight value helps to highlight the feature changes in a specific area when processing the image. For example, areas with large smoothness changes can be used to more accurately evaluate abnormal phenomena such as mildew), D(x, y) is the density factor of the area, and λ is an adjustment factor used to adjust the influence of extreme values;

[0107] The density factor refers to the pixel distribution density in the local area where the pixel is located. The density factor reflects the degree of aggregation or sparseness between pixels in the area. Generally, areas with higher density mean smaller differences between pixels and smoother changes, while areas with lower density may have larger structural changes or anomalies. When setting the density factor, it can be calculated based on the grayscale or color changes in the neighborhood of the pixel point. If the pixel value changes in the neighborhood are small, set a higher density factor, and if the changes are large, set a lower density factor. This can more accurately reflect the details of each area in the image, especially when detecting small features such as mildew, which helps improve accuracy.

[0108] The higher the smoothness change index, the more drastic the change in the smoothness of the wolfberry surface, which may indicate a greater potential risk of mold.

[0109] It can be seen from the smoothness change index that the larger the performance value of the smoothness change index generated after analyzing the smoothness change of the wolfberry surface, it usually means that the smoothness change of the wolfberry surface is more drastic. This drastic change is often related to the increase in the unevenness of the texture of the wolfberry surface, which is usually an early manifestation of mildew. Therefore, the larger the smoothness change index, the greater the risk of mildew in the wolfberry; on the contrary, when the smoothness change index is small, it indicates that the surface smoothness is more uniform, the texture is relatively normal, and the risk of mildew is smaller. Therefore, by analyzing the smoothness change index, the risk of mildew in wolfberry can be intelligently assessed.

[0110] The convolutional neural network is not specifically limited here, and can realize the spot density index I generated after analyzing the wolfberry in the marked area density and smoothness variation index S mooth Comprehensive analysis is performed to generate the potential mildew coefficient ψ mildew In order to realize the technical solution of the present invention, the present invention provides a specific implementation method; the potential mildew coefficient ψ mildew The resulting calculation formula is:

[0111] ,

[0112] Where d1 and d2 are the spot density index I density and smoothness variation index S mooth The preset proportional coefficient, and d1 and d2 are both greater than 0.

[0113] It can be seen from the potential mildew coefficient that the greater the expression value of the spot density index generated by analyzing the density of small spots on the surface of wolfberry, the greater the expression value of the smoothness change index generated after analyzing the smoothness change of the wolfberry surface. That is, the greater the expression value of the potential mildew coefficient generated after analyzing the wolfberry in the marked area through the convolutional neural network, the greater the potential risk of mildew in wolfberry, and vice versa.

[0114] The potential mildew coefficient generated after analyzing the wolfberry in the marked area through the convolutional neural network is compared and analyzed with the pre-set potential mildew coefficient reference threshold to identify the marked area with mold abnormalities. The specific identification steps are: if the potential mildew coefficient is greater than or equal to the potential mildew coefficient reference threshold, it indicates that the potential mildew risk of the marked area is very high, and the marked area is divided into a moldy area; if the potential mildew coefficient is less than the potential mildew coefficient reference threshold, it indicates that the potential mildew risk of the marked area is very small, and the marked area is divided into a normal area.

[0115] For the moldy areas identified by the convolutional neural network, the risk level of mold is further determined, and the mold is divided into three levels: slight mold, moderate mold, and severe mold. Different algorithm analysis times are allocated to different levels of mold risk levels.

[0116] For the moldy areas identified by the convolutional neural network, the risk level of moldy is further determined. The specific steps are as follows:

[0117] The potential mildew coefficient generated by analyzing the wolfberry in the marked area through the convolutional neural network is compared with the first gradient reference threshold θ1 and the second gradient reference threshold θ2, where θ2>θ1>θ 参考 , where θ 参考 is the reference threshold of the potential mildew coefficient, and the mildew is divided into three levels: slight mildew, moderate mildew and severe mildew. The classification expression is: ψ mildew Indicates the potential mildew coefficient;

[0118] According to the mold level, different algorithm analysis times are allocated to different levels of mold areas. For mild mold areas, due to the lower risk, a shorter analysis time can be used, while moderate and severe mold areas require more detailed analysis and longer time allocation. The time allocation formula is as follows: T a =δ·ψ mildew +T min , where T a is the algorithm analysis time allocated to the moldy area, δ is the time growth factor, which determines the influence of the potential mold coefficient on the time, T min The duration of the basic analysis;

[0119] The higher the potential mold factor, the longer the analysis time allocated to ensure that high-risk areas are tested more thoroughly.

[0120] In order to further optimize the detection efficiency, the analysis time is dynamically adjusted according to the mold characteristics found in the actual detection process. If the characteristics of the moldy area are found to have changed significantly in the preliminary analysis, the time can be extended for more in-depth detection. The specific expression for dynamically adjusting the analysis time is: Among them, T final is the final analysis time, ΔC m is the change range of the mildew characteristics, reflecting whether the characteristics of the area are significantly different from the expected ones during the detection process. ref is the expected reference change value;

[0121] When ΔC m When it is larger, it means the complexity of mold has increased, and the system will automatically extend the analysis time to ensure accuracy.

[0122] Further determination of the mold risk level of the moldy areas identified by the convolutional neural network, and the moldy areas are divided into three levels: slight moldy, moderate moldy and severe moldy, can significantly improve the accuracy and efficiency of moldy detection. The main function of this grading system is to make the detection process more flexible and adopt differentiated processing strategies for moldy areas of different degrees. For example, although there are preliminary signs of moldy areas in the slight moldy areas, the risk is low. By allocating a shorter analysis time, the detection can be completed quickly, saving processing time. For moderate and severe moldy areas, because they have higher moldy risks, more computing resources and time need to be allocated for in-depth analysis to ensure that the moldy features are fully captured and accurately judged. The advantage of this method is that it can reasonably allocate computing resources and time according to different risks, avoiding excessive processing of slight moldy areas and ensuring sufficient detection of high-risk areas, achieving a balance between efficiency and accuracy. In addition, this mechanism of dynamically adjusting the analysis time can also make adaptive adjustments based on data feedback in the actual detection process, further optimize the detection process, and reduce unnecessary computing burden. At the same time, it also helps to reduce the occurrence of missed detection and false detection, and improve the reliability of the entire detection system.

[0123] Ultimately, this combination of graded analysis and time allocation can realize an intelligent testing process, ensuring that production efficiency is maximized while ensuring product quality, and providing strong technical support for actual industrial testing, food safety testing and other fields.

[0124] The present invention uses a color segmentation algorithm to accurately distinguish between normal and abnormal color wolfberry areas. For abnormal color areas, it combines a pre-trained convolutional neural network to intelligently identify moldy features, quickly locate potential moldy areas, and avoid redundant processing of the entire image. By concentrating resources and computing power to conduct in-depth analysis of abnormal color areas, the accuracy of mold detection is significantly improved, the risk of missed detection or misjudgment is reduced, and at the same time, the ineffective processing of normal areas is reduced, optimizing the overall detection efficiency.

[0125] The present invention achieves intelligent management of detection resources by classifying moldy areas and allocating different algorithm analysis durations for mild, moderate and severe moldy areas. This ensures that high-risk areas are fully detected and avoids over-calculation of low-risk areas, further reducing the missed detection rate of moldy wolfberries, improving product quality and preventing food safety accidents.

[0126] The present invention provides Figure 2 The wolfberry quality and safety intelligent detection system shown includes an image acquisition module, an image preprocessing module, a color segmentation module, an abnormal area marking module, a moldy area identification module, a moldy risk classification determination module, and an algorithm analysis time allocation module;

[0127] An image acquisition module uses a high-definition camera or an industrial camera to shoot the surface of wolfberry to capture high-resolution images;

[0128] Image preprocessing module, which performs image preprocessing on the collected original images to optimize image quality and improve clarity;

[0129] Color segmentation module, for each frame of image, distinguishes the normal color wolfberry area from the abnormal color wolfberry area in the image through color segmentation algorithm;

[0130] The abnormal region marking module marks the wolfberry region with abnormal color after identifying the wolfberry region with abnormal color;

[0131] The moldy area recognition module extracts the potential moldy features of the marked area, inputs the extracted moldy features into a pre-trained convolutional neural network, and identifies the marked area with moldy abnormalities by analyzing the extracted features;

[0132] The mold risk grading module further determines the mold risk level of the mold area identified by the convolutional neural network, and divides the mold into three levels: slight mold, moderate mold, and severe mold;

[0133] The algorithm analysis time allocation module allocates different algorithm analysis times to different levels of mold risk levels.

[0134] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.

[0135] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0136] The above description is only by way of illustration of certain exemplary embodiments of the present invention. It is undoubted that those skilled in the art can modify the described embodiments in various ways without departing from the spirit and scope of the present invention. Therefore, the above drawings and descriptions are illustrative in nature and should not be construed as limiting the scope of protection of the claims of the present invention.

Claims

1. An intelligent detection method for wolfberry quality and safety, characterized in that: The following steps are involved: Use a high-definition camera or industrial camera to photograph the surface of wolfberry to capture high-resolution images; Perform image preprocessing on the collected original images to optimize image quality and improve clarity; For each frame of image, the normal color wolfberry area and abnormal color wolfberry area in the image are distinguished by color segmentation algorithm; After identifying the wolfberry area with abnormal color, the wolfberry area with abnormal color is marked, and the potential moldy features of the marked area are extracted. The extracted moldy features are input into a pre-trained convolutional neural network, and the marked area with moldy abnormalities is identified by analyzing the extracted features. For the moldy areas identified by the convolutional neural network, the risk level of mold is further determined and divided into three levels: mild mold, moderate mold and severe mold. According to the mold risk level, different algorithm analysis times are allocated to different levels of mold.

2. The method for intelligent detection of wolfberry quality and safety according to claim 1, characterized in that: The normal color wolfberry area and abnormal color wolfberry area in the image are distinguished by color segmentation algorithm. The specific steps are as follows: Convert the original image from RGB color space to a space suitable for color segmentation; Set the segmentation threshold according to the color characteristics of wolfberry; The region is segmented according to the set color threshold, and the pixels in the image are classified into "normal color wolfberry region" and "abnormal color wolfberry region" using binarization. In the binarization process, all pixels that meet the color threshold are marked as "1", indicating the normal color wolfberry region, and pixels that do not meet the threshold are marked as "0", indicating the abnormal color wolfberry region; After completing the color segmentation, the binary image is post-processed to remove noise and small irrelevant areas, and large connected areas. The contour detection algorithm is used to further analyze the regional shape to ensure that the large connected areas are consistent with the actual moldy areas.

3. The method for intelligent detection of wolfberry quality and safety according to claim 1, characterized in that: After identifying the areas of wolfberry with abnormal color, marking methods include: Add borders or outlines to abnormal areas in the image and use different colors to highlight abnormal areas; Alternatively, change the pixel values ​​of the abnormal area to pseudo-color; Optionally, add numbered labels to each anomalous region.

4. The method for intelligent detection of wolfberry quality and safety according to claim 1, characterized in that: The potential mildew features of the marked area are extracted, and the extracted features include the density of small spots on the surface of wolfberry and the smoothness change of the surface of wolfberry. After analyzing the density of small spots on the surface of wolfberry and the smoothness change of the surface of wolfberry, a spot density index and a smoothness change index are generated respectively, and the potential mildew situation of wolfberry is intelligently perceived through the spot density index and the smoothness change index; after obtaining the spot density index and the smoothness change index generated by the analysis of wolfberry in the marked area, the spot density index and the smoothness change index are input into a pre-trained convolutional neural network, and a potential mildew coefficient is generated by analyzing the extracted features, and the marked area with moldy abnormality is identified through the potential mildew coefficient.

5. The method for intelligent detection of wolfberry quality and safety according to claim 4, characterized in that: The potential mildew coefficient generated by analyzing the wolfberry in the marked area through the convolutional neural network is compared and analyzed with the pre-set potential mildew coefficient reference threshold to identify the marked area with moldy abnormalities. The specific identification steps are: if the potential mildew coefficient is greater than or equal to the potential mildew coefficient reference threshold, the marked area is divided into a moldy area; if the potential mildew coefficient is less than the potential mildew coefficient reference threshold, the marked area is divided into a normal area.

6. The method for intelligent detection of wolfberry quality and safety according to claim 4, characterized in that: The specific steps for generating the spot density index by analyzing the density of small spots on the surface of wolfberry are as follows: The wolfberry surface image is segmented to identify the spot area. The image processing technology is used to extract the small spot area in the image using a texture and color-based segmentation algorithm. Specifically, a spot detection function D(x, y) is set, where x and y are the pixel coordinates of the image, D(x, y) = 1, indicating that there is a spot at the pixel, and D(x, y) = 0, indicating that there is no spot; After the spots are identified, the geometric features of each spot are calculated. For each spot area, a geometric complexity function is defined. The geometric complexity function is expressed by the ratio of the perimeter of the spot to the area of ​​the spot. The formula is: , where C i is the shape complexity of the i-th spot, P i is the perimeter of the i-th spot, A i is the area of ​​the i-th spot; Considering the number and distribution density of spots comprehensively, the spot density index is generated in the entire wolfberry surface area. Let the total number of spots be n and the total area of ​​the image be A. total , define the spot density ρ as: Combined spot geometric complexity C i and spot density ρ, calculate the spot density index, the calculation expression is: , where I density represents the spot density index, and k is the adjustment coefficient, which is used to adjust the influence of spot shape complexity on the result according to the different spot densities.

7. The method for intelligent detection of wolfberry quality and safety according to claim 4, characterized in that: The specific steps for generating the smoothness change index by analyzing the smoothness change of the wolfberry surface are as follows: The smoothness feature of the wolfberry surface is extracted using the image gradient calculation method. The smoothness feature reflects the brightness change of each pixel in the image. By calculating the gradient of the image in different directions, the degree of change of the surface texture is determined. The specific calculation formula is: Among them, G(x, y) represents the gradient intensity at the pixel (x, y), I(x, y) is the gray value of the image at the pixel point (x, y), and are the brightness change rates along the horizontal and vertical directions respectively; The local curvature analysis is performed on the results of the gradient calculation to quantify the subtle changes in the surface structure. The local curvature can reflect the changing trend of the surface smoothness and roughness. The change in smoothness is evaluated by calculating the curvature change in the area. The calculation expression is: , Where C(x, y) represents the local curvature change at the pixel point (x, y), ∈ is a constant used to prevent the denominator from being zero; After obtaining the local curvature change value, the smoothness change index is generated by normalizing and weighting the entire image. The smoothness change index is used to quantify the overall change of the smoothness of the entire wolfberry surface. The specific calculation expression is: , where S mooth Represents the final smoothness change index, M and N are the width and height of the image respectively, W(x, y) is the weight of the pixel (x, y), which is assigned based on the degree of difference between the point and the surrounding area, D(x, y) is the density factor of the area, and λ is the adjustment factor.

8. The method for intelligent detection of wolfberry quality and safety according to claim 7, characterized in that: For the moldy areas identified by the convolutional neural network, the risk level of moldy is further determined. The specific steps are as follows: The potential mildew coefficient generated by analyzing the wolfberry in the marked area through the convolutional neural network is compared with the first gradient reference threshold θ1 and the second gradient reference threshold θ2, where θ2>θ1>θ 参考 , where θ 参考 is the reference threshold of the potential mildew coefficient, and the mildew is divided into three levels: slight mildew, moderate mildew and severe mildew. The classification expression is: ψ mildew Indicates the potential mildew coefficient; According to the mold level, different algorithm analysis times are allocated to different levels of mold areas. The time allocation formula is as follows: T a =δ·ψ mildew +T min , where T a is the algorithm analysis time allocated to the moldy area, δ is the time growth factor, which determines the influence of the potential mold coefficient on the time, T min The duration of the basic analysis; The analysis time is dynamically adjusted according to the mold characteristics found in the actual detection process. The specific expression for dynamically adjusting the analysis time is: Among them, T final is the final analysis time, ΔC m is the change range of mildew characteristics, C ref is the expected reference change value.

9. An intelligent detection system for wolfberry quality and safety, used to implement the intelligent detection method for wolfberry quality and safety described in any one of claims 1 to 8, characterized in that: It includes image acquisition module, image preprocessing module, color segmentation module, abnormal area marking module, moldy area identification module, moldy risk classification module and algorithm analysis time allocation module; An image acquisition module uses a high-definition camera or an industrial camera to shoot the surface of wolfberry to capture high-resolution images; Image preprocessing module, which performs image preprocessing on the collected original images to optimize image quality and improve clarity; Color segmentation module, for each frame of image, distinguishes the normal color wolfberry area from the abnormal color wolfberry area in the image through color segmentation algorithm; The abnormal region marking module marks the wolfberry region with abnormal color after identifying the wolfberry region with abnormal color; The moldy area recognition module extracts the potential moldy features of the marked area, inputs the extracted moldy features into a pre-trained convolutional neural network, and identifies the marked area with moldy abnormalities by analyzing the extracted features; The mold risk classification module further determines the mold risk level of the mold area identified by the convolutional neural network, and divides the mold into three levels: slight mold, moderate mold, and severe mold; The algorithm analysis time allocation module allocates different algorithm analysis times to different levels of mold risk levels.

Citation Information

Cited By

  • Battery cell installation detection result display method, system and equipment and storage medium

    CN121190400A

  • A medicinal and edible traditional Chinese medicinal material mildewing image recognition method

    CN122618351A