A method and system for visual inspection of milk powder quality

By performing grayscale and HSV image processing on milk powder images, segmenting and analyzing feature sequences, the problem of low impurity detection accuracy under traditional threshold segmentation technology is solved and more accurate impurity identification is achieved.

CN118691607BActive Publication Date: 2024-10-25SHAANXI SHENGTANG DAIRY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411162183.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-10-25
Estimated Expiration
2044-08-23

AI Technical Summary

Technical Problem

Traditional threshold segmentation technology has low accuracy in detecting impurities in milk powder, and it is easy to identify shadow areas as impurities.

Method used

By acquiring the grayscale image and HSV image of the milk powder image, the suspected impurity area is segmented, and further divided into feature sequences, and the possibility of impurities is calculated based on the color information difference, gradient degree and importance of the feature sequence and the reference sequence. Screen out the real impurity areas.

Benefits of technology

It improves the accuracy of milk powder impurity detection and reduces the possibility of misidentification of shadow areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691607B_ABST
    Figure CN118691607B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology, and specifically to a method and system for visual inspection of milk powder quality, comprising: obtaining a grayscale image and an HSV image according to a milk powder image; segmenting a suspected impurity region in the HSV image according to the grayscale image; further, obtaining a feature sequence of the suspected impurity region and a reference sequence corresponding to the feature sequence, obtaining the degree of impurity represented by the reference sequence for the feature sequence, and the importance of the reference sequence; obtaining the possibility that the feature sequence is in the impurity region according to the degree of impurity represented by the reference sequence for the feature sequence and the importance of the reference sequence; further obtaining the possibility that the suspected impurity region is the impurity region, and screening out the impurity region. The present invention analyzes the difference between the impurity region and the surrounding region in the milk powder image, thereby accurately distinguishing the shadow region from the impurity region in the milk powder image, thereby improving the accuracy of milk powder quality inspection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of image processing, and in particular to a method and system for visually detecting milk powder quality. Background Art

[0002] Milk powder is usually used to make milk powder, dairy products, baked goods and other foods. In the process of producing milk powder, impurities may exist in the milk powder due to factors such as raw materials and environment. In order to ensure the production quality of milk powder, it is necessary to detect whether the milk powder contains impurities. Since milk powder is always uneven, the light intensity received at different positions in the milk powder image is different, resulting in the possibility of identifying shadow areas as impurities when detecting impurities in milk powder through traditional threshold segmentation technology, that is, the accuracy of detecting impurities in milk powder using traditional threshold segmentation technology is low. Summary of the invention

[0003] The present invention provides a method and system for visually detecting milk powder quality, so as to solve the existing problem that the accuracy of detecting impurities in milk powder by using traditional threshold segmentation technology is low.

[0004] A method and system for visually inspecting milk powder quality of the present invention adopts the following technical solutions:

[0005] An embodiment of the present invention provides a method for visually detecting milk powder quality, the method comprising the following steps:

[0006] Obtain the grayscale image and HSV image corresponding to the milk powder image; segment the suspected impurity area in the HSV image according to the grayscale image;

[0007] According to the gradient direction of the pixel points in the suspected impurity region, the suspected impurity region is divided into several feature sequences, and the reference sequence corresponding to the feature sequence is obtained; according to the difference in color information between the feature sequence and the reference sequence, the degree of impurity represented by the reference sequence for the feature sequence is obtained; the degree of gradient between the feature sequence and the reference sequence is obtained; according to the difference in gradient between the feature sequence and the reference sequence corresponding to the feature sequence, the importance of the reference sequence is obtained;

[0008] According to the degree of impurity characterized by each reference sequence for the characteristic sequence, combined with the importance of each reference sequence of the characteristic sequence, the possibility of the characteristic sequence being in the impurity region is obtained; according to the possibility that all characteristic sequences in the suspected impurity region are in the impurity region, the possibility of the suspected impurity region being the impurity region is obtained; according to the degree of impurity in the suspected impurity region, the impurity region is screened out.

[0009] Preferably, the method of segmenting the suspected impurity region in the HSV image according to the grayscale image includes:

[0010] The grayscale image is threshold segmented using the Otsu method, and the coordinates of the pixels with a grayscale value of 255 in the segmentation result are obtained as suspected impurity coordinates. All pixels in the HSV image located at the suspected impurity coordinates are recorded as suspected impurity pixels, and the area composed of suspected impurity pixels is recorded as suspected impurity area.

[0011] Preferably, the method of segmenting the suspected impurity region into a plurality of feature sequences according to the gradient direction of the pixel points in the suspected impurity region and obtaining the reference sequences corresponding to the feature sequences includes the following specific methods:

[0012] For any suspected impurity region, the sum of the gradient vectors of all pixel points is taken as the reference gradient vector, and the direction of the reference gradient vector of the region is recorded as the reference direction; a straight line perpendicular to the reference direction is drawn through the center of the region, and the part of the straight line in the region is taken as the skeleton of the region;

[0013] For any pixel point on the skeleton of any suspected impurity region, a straight line perpendicular to the skeleton is drawn through the pixel point, and the part of the straight line of the skeleton located in the region is recorded as the characteristic sequence of the pixel point, and the part of the straight line of the skeleton not located in the region is recorded as the reference segment of the pixel point;

[0014] For any feature sequence, taking the intersection between the feature sequence and the reference segment as the starting point, the reference segment corresponding to the feature sequence is equally divided into several sequences with the same length as the feature sequence, and a preset number of sequences in the reference segment closest to the feature sequence are used as reference sequences of the feature sequence.

[0015] Preferably, the obtaining of the impurity level of the reference sequence with respect to the characteristic sequence comprises the following specific methods:

[0016] Obtaining differences between the characteristic sequence and the reference sequence in terms of brightness mean, hue mean, and saturation mean, respectively; recording them as brightness difference, hue difference, and saturation difference, respectively;

[0017] The product of the brightness difference, the hue difference and the saturation difference is taken as the impurity degree characterized by the reference sequence for the feature sequence.

[0018] Preferably, the step of obtaining the degree of gradual change between the characteristic sequence and the reference sequence comprises the following specific methods:

[0019] For any pixel point in any feature sequence, obtain the average value of the difference in brightness value of all adjacent pixel points in a preset neighborhood range of the pixel point as the gradient degree of the pixel point in the feature sequence;

[0020] Similarly, the gradient degrees of all pixels in the reference sequence are obtained, and the average gradient degree of all pixels in the reference sequence is taken as the gradient degree of the reference sequence.

[0021] Preferably, the obtaining of the importance of the reference sequence comprises the following specific methods:

[0022] The variance of the gradient degree of all pixels in the reference sequence is used as the importance of the gradient degree of the reference sequence;

[0023] The importance of the reference sequence of the feature sequence is taken as the ratio of the difference in the degree of gradual change between the feature sequence and the reference sequence of the feature sequence to the importance of the degree of gradual change of the reference sequence.

[0024] Preferably, the possibility of obtaining the characteristic sequence being in the impurity region includes the following specific methods:

[0025] For any feature sequence, the product of the degree of impurity represented by each reference sequence of the feature sequence with respect to the feature sequence and the degree of importance of each reference sequence of the feature sequence is used as the factor representing that the feature sequence is in the impurity region by each reference sequence of the feature sequence, and the factor representing that the feature sequence is in the impurity region by all reference sequences of the fused feature sequence is used as the possibility that the feature sequence is in the impurity region.

[0026] Preferably, the possibility of obtaining the suspected impurity region being the impurity region includes the following specific methods:

[0027] The probability means of all feature sequences in the suspected impurity region being in the impurity region are normalized, and the normalized result is used as the probability that the suspected impurity region is the impurity region.

[0028] Preferably, the method of screening out the impurity region according to the impurity level of the suspected impurity region includes:

[0029] A possibility threshold is preset, and for any suspected impurity region, if the possibility that the suspected impurity region is an impurity region is greater than the possibility threshold, the suspected impurity region is an impurity region.

[0030] Another embodiment of the present invention provides a system for visual inspection of milk powder quality, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above-mentioned methods for visual inspection of milk powder quality when executing the computer program.

[0031] The technical solution of the present invention has the following beneficial effects: a grayscale image and an HSV image are obtained according to a milk powder image; a suspected impurity region in the HSV image is segmented according to the grayscale image, and since the difference in brightness between the impurities in the milk powder and the milk powder is large, and the difference in color difference and saturation is small, it is necessary to obtain the HSV image of the milk powder; further, the suspected impurity region is segmented into a plurality of feature sequences, and the region compared with each feature sequence is used as a reference sequence, to obtain the feature sequence of the suspected impurity region and the reference sequence corresponding to the feature sequence, to obtain the degree of impurity characterized by the reference sequence for the feature sequence, and the importance of the reference sequence, since the feature sequence and the reference sequence differ in brightness, hue and saturation; and different reference sequences have different importance, so in order to more accurately obtain the possibility that the feature sequence is in the impurity region, it is also necessary to obtain the degree of gradient between the feature sequence and the reference sequence; the importance of the reference sequence is obtained according to the difference in the degree of gradient between the feature sequence and the reference sequence corresponding to the feature sequence;

[0032] According to the degree of impurity represented by the reference sequence for the characteristic sequence, combined with the importance of the reference sequence, the possibility of the characteristic sequence being in the impurity region is obtained; further, the possibility of the suspected impurity region being the impurity region is obtained, and the impurity region is screened out, thereby improving the accuracy of milk powder impurity detection. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0034] Figure 1 A flowchart of the steps of a method for visually detecting milk powder quality according to the present invention;

[0035] Figure 2 It is a schematic diagram of characteristic sequence and reference segment;

[0036] Figure 3 Schematic diagram of the reference sequence of the characteristic sequence. DETAILED DESCRIPTION

[0037] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a method and system for visual inspection of milk powder quality proposed according to the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0038] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0039] The specific scheme of a method and system for visually inspecting milk powder quality provided by the present invention is described in detail below with reference to the accompanying drawings.

[0040] See also Figure 1 , which shows a flow chart of the steps of a method for visually detecting milk powder quality provided by an embodiment of the present invention, the method comprising the following steps:

[0041] Step S001: obtaining a grayscale image and an HSV image corresponding to a milk powder image; and segmenting suspected impurity regions in the HSV image according to the grayscale image.

[0042] It should be noted that milk powder is usually used to make milk powder, dairy products, baked goods and other foods. In the process of producing milk powder, impurities may exist in the milk powder due to factors such as raw materials and environment, resulting in a decrease in the quality of the milk powder. Therefore, this embodiment proposes a visual inspection method for milk powder quality, namely, identifying impurities in milk powder through milk powder images, so it is necessary to first obtain milk powder images.

[0043] It should be further explained that, since there is a large difference in brightness between the impurities in the milk powder and the milk powder, and a small difference in color difference and saturation, in order to better identify the impurities in the milk powder, it is necessary to obtain the HSV image of the milk powder; and since the milk powder is always uneven when collecting the milk powder image, there are shadow areas and illuminated areas in the milk powder image, and since the shadow area and the area composed of impurities have a large difference in overall grayscale value from the illuminated area, the illuminated area can be first segmented out by threshold segmentation to obtain the suspected impurity area.

[0044] Specifically, an industrial camera is used to collect an RGB image of milk powder, and the RGB image of milk powder is converted into an HSV image and a grayscale image. Since the process of converting an RGB image into an HSV image and a grayscale image is a well-known prior art, it will not be described in detail in this embodiment.

[0045] Preferably, in one embodiment of the present invention, the grayscale image is threshold segmented using the Otsu method, and the coordinates of the pixels with a grayscale value of 255 in the segmentation result are obtained as suspected impurity coordinates, and all pixels in the HSV image located at the suspected impurity coordinates are recorded as suspected impurity pixels, and the area composed of suspected impurity pixels is recorded as suspected impurity area; since the Otsu method is a well-known prior art, it will not be described in detail in this embodiment.

[0046] At this point, a suspected impurity region is obtained.

[0047] Step S002: According to the gradient direction of the pixel points in the suspected impurity area, the suspected impurity area is divided into several feature sequences, and a reference sequence corresponding to the feature sequence is obtained; according to the difference in color information between the feature sequence and the reference sequence, the impurity degree of the reference sequence with respect to the feature sequence is obtained; the gradient degree of the feature sequence and the reference sequence is obtained; according to the difference in gradient degree between the feature sequence and the reference sequence corresponding to the feature sequence, the importance of the reference sequence is obtained.

[0048] It should be noted that this embodiment achieves accurate detection of impurities in milk powder by analyzing the difference between the impurity area and the surrounding area in the milk powder. In order to better compare the difference between the suspected impurity area and the surrounding area, the suspected impurity area is divided into several feature sequences, and the area compared with each feature sequence is used as a reference sequence. The reference sequence characterizes the degree of impurity for the feature sequence through the difference in brightness, hue and saturation between the feature sequence and the reference sequence. Since there are multiple reference sequences for each feature sequence, and different reference sequences have different importance, in order to more accurately obtain the possibility that the feature sequence is in the impurity area, it is also necessary to obtain the degree of gradient between the feature sequence and the reference sequence; the importance of the reference sequence is obtained according to the difference in gradient between the feature sequence and the reference sequence corresponding to the feature sequence.

[0049] Optionally, in one embodiment of the present invention, for any suspected impurity region, the sum of the gradient vectors of all pixel points is used as a reference gradient vector, and the direction of the reference gradient vector of the region is recorded as a reference direction; a straight line perpendicular to the reference direction is drawn through the center of the region, and the portion of the straight line within the region is used as the skeleton of the region;

[0050] For any pixel point on the skeleton of any suspected impurity region, a straight line perpendicular to the skeleton is drawn through the pixel point, and the part of the straight line of the skeleton located in the region is recorded as the feature sequence of the pixel point, and the part of the straight line of the skeleton not located in the region is recorded as the reference segment of the pixel point, such as Figure 2 As shown, Figure 2 It is a schematic diagram of characteristic sequence and reference segment;

[0051] For any feature sequence, a preset number , The specific value of can be set according to the actual situation, and this embodiment does not limit it. Describe; starting from the intersection between the feature sequence and the reference segment, divide the reference segment corresponding to the feature sequence into several sequences of equal length to the feature sequence, and divide the reference segment closest to the feature sequence into sequences as reference sequences for feature sequences, such as Figure 3 As shown, Figure 3 Schematic diagram of the reference sequence of the characteristic sequence.

[0052] It should be noted that, since the difference in brightness between the impurities in the milk powder and the milk powder is large, and the difference in saturation and chroma is small, the difference in brightness between the pixels in the feature sequence in the impurity area and the pixels in the reference sequence corresponding to the feature sequence is large, and the difference in hue and saturation is small. Therefore, based on this, the degree of impurity represented by each reference sequence for the feature sequence can be obtained.

[0053] Preferably, in an example of the present invention, the differences between the characteristic sequence and the reference sequence in terms of brightness mean, hue mean and saturation mean are obtained; these differences are recorded as brightness difference, hue difference and saturation difference respectively;

[0054] The sum of the brightness difference and the hue difference and the saturation difference is taken as the impurity degree of the reference sequence for the characteristic sequence;

[0055] Furthermore, the product of the brightness difference ratio, the hue difference and the saturation difference is used as the impurity degree characterized by the reference sequence for the feature sequence.

[0056] In an example, the specific calculation formula is:

[0057]

[0058] In the formula, The first The degree of impurity of the reference sequence with respect to the characteristic sequence; Represents the mean brightness of all pixels in the feature sequence; The first The average brightness of all pixels in the reference sequence; Represents the hue mean of all pixels in the feature sequence; The first The mean hue of all pixels in the reference sequence; Represents the mean saturation value of all pixels in the feature sequence; The first The mean saturation value of all pixels in the reference sequence; Represents absolute value operation.

[0059] It should be noted that It represents the feature sequence and the first The difference in brightness between the reference sequences; and They represent the feature sequence and the first The difference in hue and saturation between the reference sequences is large, and the difference in brightness between the pixels in the feature sequence in the impurity region and the pixels in the reference sequence corresponding to the feature sequence is large, but the difference in hue and saturation is small; The larger the value of and The smaller the value of is, the The more a reference sequence can represent the degree of impurity of the characteristic sequence.

[0060] It should be further stated that since the suspected impurity area is obtained by the threshold segmentation method, usually there is a large grayscale difference between the impurity area and the surrounding area, so the threshold segmentation can completely segment the impurity area, but the shadow area is caused by the influence of light, and there is a grayscale gradient in the shadow area, that is, the grayscale difference between the shadow area and the surrounding area is small, so the threshold segmentation can completely segment the shadow area. Therefore, different reference sequences have different importance. Therefore, in order to more accurately obtain the possibility that the feature sequence is in the impurity area, it is also necessary to obtain the gradient between the feature sequence and the reference sequence; according to the difference in gradient between the feature sequence and the reference sequence corresponding to the feature sequence, the importance of the reference sequence is obtained.

[0061] Preferably, in an example of the present invention, a neighborhood range is preset, and the size of the neighborhood range can be set according to the actual situation, which is not limited in this embodiment. In this embodiment, the neighborhood range is described as 5; for any pixel point in any feature sequence, the average value of the difference in brightness value of all adjacent pixel points in the preset neighborhood range of the pixel point is obtained as the gradient degree of the pixel point in the feature sequence;

[0062] Similarly, the gradient degree of all pixels in the reference sequence is obtained, and the average gradient degree of all pixels in the reference sequence is used as the gradient degree of the reference sequence; the specific calculation formula is:

[0063]

[0064] In the formula, Indicates the first The gradient degree of each pixel; Indicates the number of pixels in the neighborhood; Indicates the first The first pixel in the neighborhood of The brightness value of each pixel; Indicates the first The first pixel in the neighborhood of The brightness value of a pixel.

[0065] Furthermore, the average value of the gradient degree of the pixel points in the feature sequence is used as the gradient degree of the feature sequence;

[0066] Similarly, the gradient degree of all pixels in the reference sequence is obtained, and the average gradient degree of all pixels in the reference sequence is taken as the gradient degree of the reference sequence;

[0067] The variance of the gradient degree of all pixels in the reference sequence is used as the importance of the gradient degree of the reference sequence;

[0068] The ratio between the difference in the degree of gradual change between the feature sequence and the reference sequence of the feature sequence and the importance of the degree of gradual change of the reference sequence is used as the importance of the reference sequence of the feature sequence; the specific calculation formula is:

[0069]

[0070] In the formula, The first The importance of the reference sequence; Indicates the degree of gradual change of the feature sequence; The first The degree of gradient of a reference sequence; The first The variance of the reference series; Represents absolute value operation; represents the logistic function, which is used for normalization in this embodiment.

[0071] It should be noted that The first The variance of the reference sequence, i.e. The degree of chaos of the gradient of each pixel in the first reference sequence, and the The lower the chaos of the gradient of each pixel in the reference sequence, the The more credible the reference sequence is, the more gradual it is; Represents the feature sequence and the first The difference in the degree of gradient between the reference sequences, The larger the value, the more the feature sequence and the feature sequence The less likely the first reference sequence is to be in the same region, the more likely the first The more important the reference sequence.

[0072] At this point, the impurity level of each reference sequence for the characteristic sequence characterization and the importance of each reference sequence are obtained.

[0073] Step S003: Based on the degree of impurity characterized by each reference sequence for the feature sequence and the importance of each reference sequence of the feature sequence, obtain the possibility that the feature sequence is in the impurity region; based on the possibility that all feature sequences in the suspected impurity region are in the impurity region, obtain the possibility that the suspected impurity region is the impurity region; based on the degree of impurity in the suspected impurity region, screen out the impurity region.

[0074] It should be noted that after obtaining the degree of impurity represented by each reference sequence for the characteristic sequence and the importance of each reference sequence through step S002, the possibility of the characteristic sequence being in the impurity region can be obtained based on the degree of impurity represented by the reference sequence for the characteristic sequence and the importance of the reference sequence; the possibility of the suspected impurity region being the impurity region can be further obtained to screen out the impurity region.

[0075] Preferably, in one embodiment of the present invention, for any feature sequence, the product of the degree of impurity of each reference sequence of the feature sequence with respect to the feature sequence and the degree of importance of each reference sequence of the feature sequence is used as a factor for each reference sequence of the feature sequence to characterize that the feature sequence is in the impurity region, and the factors for all reference sequences of the fused feature sequence to characterize that the feature sequence is in the impurity region are used as the possibility that the feature sequence is in the impurity region.

[0076] In an example, the specific calculation formula is:

[0077]

[0078] In the formula, Indicates the possibility that the characteristic sequence is in the impurity region; Represents the preset number of feature sequences; The first The degree of impurity of the reference sequence with respect to the characteristic sequence; The first The importance of a reference sequence.

[0079] Furthermore, for any suspected impurity region, the possibility of all characteristic sequences in the suspected impurity region being in the impurity region is integrated to obtain the possibility that the suspected impurity region is the impurity region.

[0080] In one example, the probability means of all feature sequences in the suspected impurity region being in the impurity region are normalized, and the normalized result is used as the probability that the suspected impurity region is the impurity region.

[0081] Furthermore, a threshold of possibility is preset , The specific value can be set according to the actual situation, and this embodiment does not limit it. For any suspected impurity region, if the probability that the suspected impurity region is an impurity region is greater than , then the suspected impurity region is the impurity region.

[0082] It should be noted that this embodiment segments the suspected impurity region in the HSV image based on the grayscale image; further, obtains the feature sequence of the suspected impurity region and the reference sequence corresponding to the feature sequence, obtains the degree of impurity represented by the reference sequence for the feature sequence, and the importance of the reference sequence; based on the degree of impurity represented by the reference sequence for the feature sequence, combined with the importance of the reference sequence, obtains the possibility that the feature sequence is in the impurity region; further obtains the possibility that the suspected impurity region is the impurity region, thereby accurately screening out the impurity region.

[0083] Another embodiment of the present invention provides a system for visual inspection of milk powder quality, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method for visual inspection of milk powder quality in steps S001 to S003 when executing the computer program.

[0084] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for visually detecting milk powder quality, It is characterized in that The method comprises the following steps: Obtain the grayscale image and HSV image corresponding to the milk powder image; segment the suspected impurity area in the HSV image according to the grayscale image; According to the gradient direction of the pixel points in the suspected impurity region, the suspected impurity region is divided into several feature sequences, and the reference sequence corresponding to the feature sequence is obtained; according to the difference in color information between the feature sequence and the reference sequence, the degree of impurity represented by the reference sequence for the feature sequence is obtained; the degree of gradient between the feature sequence and the reference sequence is obtained; according to the difference in gradient between the feature sequence and the reference sequence corresponding to the feature sequence, the importance of the reference sequence is obtained; According to the degree of impurity characterized by each reference sequence for the characteristic sequence, combined with the importance of each reference sequence of the characteristic sequence, the possibility of the characteristic sequence being in the impurity region is obtained; according to the possibility that all characteristic sequences in the suspected impurity region are in the impurity region, the possibility of the suspected impurity region being the impurity region is obtained; according to the degree of impurity in the suspected impurity region, the impurity region is screened out; The method of dividing the suspected impurity region into a plurality of feature sequences according to the gradient direction of the pixel points in the suspected impurity region and obtaining the reference sequence corresponding to the feature sequence includes the following specific methods: For any suspected impurity region, the sum of the gradient vectors of all pixel points is taken as the reference gradient vector, and the direction of the reference gradient vector of the region is recorded as the reference direction; a straight line perpendicular to the reference direction is drawn through the center of the region, and the part of the straight line in the region is taken as the skeleton of the region; For any pixel point on the skeleton of any suspected impurity region, a straight line perpendicular to the skeleton is drawn through the pixel point, and the part of the straight line of the skeleton located in the region is recorded as the characteristic sequence of the pixel point, and the part of the straight line of the skeleton not located in the region is recorded as the reference segment of the pixel point; For any feature sequence, the intersection between the feature sequence and the reference segment is taken as the starting point, and the reference segment corresponding to the feature sequence is equally divided into a number of sequences with the same length as the feature sequence. The preset number of sequences closest to the feature sequence in the reference segment are taken as the reference sequences of the feature sequence; The specific method of obtaining the impurity level of the reference sequence with respect to the characteristic sequence is as follows: Obtaining differences between the characteristic sequence and the reference sequence in terms of brightness mean, hue mean, and saturation mean, respectively; recording them as brightness difference, hue difference, and saturation difference, respectively; The product of the brightness difference and the hue difference and the saturation difference is used as the impurity degree of the reference sequence to the feature sequence; The specific method of obtaining the degree of gradual change between the characteristic sequence and the reference sequence includes: For any pixel point in any feature sequence, obtain the average value of the difference in brightness value of all adjacent pixel points in a preset neighborhood range of the pixel point as the gradient degree of the pixel point in the feature sequence; Similarly, the gradient degree of all pixels in the reference sequence is obtained, and the average gradient degree of all pixels in the reference sequence is taken as the gradient degree of the reference sequence; The specific method of obtaining the importance of the reference sequence includes: The variance of the gradient degree of all pixels in the reference sequence is used as the importance of the gradient degree of the reference sequence; The ratio between the difference in the degree of gradual change between the characteristic sequence and the reference sequence of the characteristic sequence and the importance of the degree of gradual change of the reference sequence is used as the importance of the reference sequence of the characteristic sequence; The method of obtaining the possibility that the characteristic sequence is in the impurity region includes: For any feature sequence, the product of the degree of impurity represented by each reference sequence of the feature sequence with respect to the feature sequence and the degree of importance of each reference sequence of the feature sequence is used as the factor representing that the feature sequence is in the impurity region by each reference sequence of the feature sequence, and the factor representing that the feature sequence is in the impurity region by all reference sequences of the fused feature sequence is used as the possibility that the feature sequence is in the impurity region.

2. A method for visually detecting milk powder quality according to claim 1, It is characterized in that The specific method of segmenting the suspected impurity area in the HSV image according to the grayscale image includes: The grayscale image is threshold segmented using the Otsu method, and the coordinates of the pixels with a grayscale value of 255 in the segmentation result are obtained as suspected impurity coordinates. All pixels in the HSV image located at the suspected impurity coordinates are recorded as suspected impurity pixels, and the area composed of suspected impurity pixels is recorded as suspected impurity area.

3. A method for visually detecting milk powder quality according to claim 1, It is characterized in that The method of obtaining the possibility that the suspected impurity region is the impurity region includes: The probability means of all feature sequences in the suspected impurity region being in the impurity region are normalized, and the normalized result is used as the probability that the suspected impurity region is the impurity region.

4. A method for visually detecting milk powder quality according to claim 1, It is characterized in that The specific method of screening out the impurity region according to the impurity level of the suspected impurity region includes: A possibility threshold is preset, and for any suspected impurity region, if the possibility that the suspected impurity region is an impurity region is greater than the possibility threshold, the suspected impurity region is an impurity region.

5. A milk powder quality visual inspection system, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the computer program is executed by a processor, the steps of a method for visually inspecting milk powder quality as described in any one of claims 1 to 4 are implemented.