Nut impurity rapid detection method and device suitable for mobile production line and computing equipment

Through multispectral imaging technology and Euclidean distance recognition algorithm, combined with the initial spectral library, the problem of difficulty in detecting internal impurities of nuts and insufficient recognition ability of different types of impurities in the existing technology is solved, and accurate detection of internal and external impurities of nuts is achieved. Improves the accuracy of detection and the robustness of the process.

CN119044076AInactive Publication Date: 2024-11-29SOUTH SUBTROPICAL CROP RES INST CHINA ACAD OF TROPICAL AGRI SCI

Patent Information

Application Number
CN202411164945.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is difficult to detect impurities inside nuts, and the ability to identify different types of impurities is limited, making it easy to miss and miss detection.

Method used

Using multispectral imaging technology, the nut images are captured in visible light, near-infrared and short-wave infrared bands, and the characteristic vector is generated, and impurity recognition is combined with Euclidean distance and initial spectral library, and the threshold is set according to different impurities to achieve the internal and internal nuts of the nut. Accurate detection of external impurities.

Benefits of technology

It improves the accuracy and consistency of nut impurity detection, reduces artificial intervention, enhances the ability to identify new types of impurities, ensures efficient and reliable detection and robustness of production processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119044076A_ABST
    Figure CN119044076A_ABST
Patent Text Reader

Abstract

The invention provides a nut impurity rapid detection method and device suitable for a mobile production line and computing equipment, and relates to the technical field of food detection.The method comprises the steps that on the basis of the multispectral imaging and image recognition technology, imaging of nut samples in different wavebands is collected, spectral reflectivity of pixel points is generated, then feature vectors of the samples are generated, and the feature vectors are calculated; the method comprises the following steps: classifying to-be-detected substance types into normal nuts, deteriorated nuts, shell debris and external impurities, establishing a spectrum library of spectral reflectance of pixel points of known types, and generating feature similarity through Euclidean distances between sample pixel points collected in real time and the pixel points in the spectrum library; according to the method, the pixel point type corresponding to the highest feature similarity in the spectrum library is selected as the sample pixel point type collected in real time, a comparison image is generated to display pixel points of different types of impurities, pixel point thresholds are set for early warning sorting, and the production efficiency and the product quality guarantee capability are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food detection, and in particular to a method, a device and a computing device for quickly detecting nut impurities suitable for a mobile production line. Background Art

[0002] In the nut processing industry, as the consumption demand for nuts continues to increase, the production and processing of nuts is also increasing. Macadamia nuts, in particular, are popular for their unique taste and high nutritional value. However, macadamia nuts are easily mixed with various impurities during the production and processing process, which not only affects the product quality, but may also endanger the health of consumers. Therefore, impurities must be detected and sorted out during the processing to ensure the quality of nuts. At present, traditional detection methods mainly rely on manual sorting or simple machine physical screening, which is not only time-consuming and labor-intensive, but also has low accuracy and efficiency. Especially when dealing with large-scale production and processing, manual sorting is easily affected by fatigue and subjective factors, and machine physical screening is difficult to accurately judge the internal quality of nuts. Under this premise, the use of multispectral imaging technology to identify impurities and deteriorated nuts has a significant improvement over traditional methods, evaluating the quality of nuts from a comprehensive perspective and overcoming the limitations of traditional methods.

[0003] In the prior art, publication number CN114445623A discloses a method, device, electronic device and storage medium for detecting food impurities. The method collects images of a food conveyor belt and pre-processes the images. The portion of the image containing food is extracted as an image of a region of interest. The image of the region of interest is input into a pre-trained impurity recognition model to obtain the type of impurities in the image of the region of interest. After obtaining the impurity type information, the electronic device analyzes the image and determines the food quality based on the ratio of the area occupied by impurities to the overall area.

[0004] The main problems with the above scheme are: it can only detect impurities on the outside of food, but cannot detect food that is spoiled inside, resulting in incomplete detection results; and it only collects images under visible light, and may not be able to effectively identify impurities that are similar in color to food, and has limited capabilities for different types of impurities; the detection and judgment of impurities relies on traditional image classification models, which usually require a large amount of data to achieve a good generalization effect, and are prone to missed detections and false detections when faced with new types of impurities.

[0005] 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

[0006] The object of the present invention is to provide a method, device and computing equipment for rapid detection of nut impurities suitable for a mobile production line, so as to solve the problems raised in the above-mentioned background technology.

[0007] To achieve the above object, the present invention provides the following technical solutions:

[0008] A method for rapid detection of nut impurities suitable for a mobile production line, the specific steps comprising:

[0009] Step 1: Install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nuts at 20 cm, and install a tunable LED light source next to the multispectral camera. When the nuts pass through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band, and short-wave infrared band to obtain a multispectral image.

[0010] Step 2: De-noise the collected multispectral image, and resize the multispectral image after denoising to a uniform size of 256×256. According to the different acquisition bands of the image, the first, second and third recognition images are generated respectively, and the pixel positions of the first recognition image, the second recognition image and the third recognition image are corresponded one by one;

[0011] Step 3: Calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, find the pixel at the corresponding position in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel in the near infrared band and the short-wave infrared band, generate the feature vector of each pixel, and integrate all the feature vectors into the feature vector set;

[0012] Step 4: Collect samples of normal nuts, spoiled nuts, shell debris and external impurities, generate corresponding pixel spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to the pixels of normal nuts, spoiled nuts, shell debris and external impurities respectively, and combine all initial feature vectors to generate an initial spectral library;

[0013] Step 5: Calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectrum library to generate feature similarity, traverse the initial spectrum library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel;

[0014] Step 6: Set all pixels detected as spoiled nuts, shell debris and external impurities as abnormal pixels, generate a comparison image, mark the coordinates of the abnormal pixels and count the number of different types of abnormal pixels, set pixel thresholds for different types of impurities, and issue a warning message to prompt impurity sorting when the number of abnormal pixels exceeds the pixel threshold.

[0015] Furthermore, the preset band range of the visible light band is 400-700 nm, the preset band range of the near infrared band is 700-1100 nm, and the preset band range of the short-wave infrared band is 1100-2500 nm.

[0016] Furthermore, the coordinates of the pixels of the scaled image are annotated, and a plane rectangular coordinate system is established with the pixels in the bottom row as the x-axis and the pixels in the leftmost column as the y-axis. The pixel positions of the first recognition image, the second recognition image, and the third recognition image are mapped one-to-one through the coordinates so that each pixel has a unique coordinate value.

[0017] Furthermore, the principle for generating the feature vector of each pixel is as follows:

[0018] The formula for calculating the spectral reflectance of a pixel in the visible light band is:

[0019]

[0020] Wherein, R1 represents the spectral reflectance of the pixel point in the visible light band, I(r1) represents the intensity of the pixel point light signal collected in the visible light band, and I0(r1) represents the intensity of the reference light signal of the standard white board collected in the visible light band;

[0021] The formula for calculating the spectral reflectance of a pixel in the near-infrared band is:

[0022]

[0023] Wherein, R2 represents the spectral reflectance of the pixel point in the near-infrared band, I(r2) represents the intensity of the pixel point light signal collected in the near-infrared band, and I0(r2) represents the intensity of the reference light signal of the standard white board collected in the near-infrared band;

[0024] The formula for calculating the spectral reflectance of a pixel in the short-wave infrared band is:

[0025]

[0026] Wherein, R3 represents the spectral reflectance of the pixel point in the short-wave infrared band, I(r3) represents the intensity of the pixel point light signal collected in the short-wave infrared band, and I0(r3) represents the intensity of the reference light signal of the standard white board collected in the short-wave infrared band;

[0027] The resulting feature vector is:

[0028]

[0029] in, represents a feature vector.

[0030] Furthermore, the generated initial feature vector is:

[0031]

[0032] in, represents the initial feature vector of the a-th pixel in the initial spectral library, a represents the index of the pixel in the initial spectral library, S1(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the visible light band, S2(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the near-infrared band, and S3(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the short-wave infrared band.

[0033] Furthermore, the formula for generating feature similarity is:

[0034]

[0035] in, express and The Euclidean distance of , k represents the index of the band, and k = 1, 2, 3, express and The feature similarity between them.

[0036] Furthermore, the principle for setting pixel thresholds for different types of impurities is as follows:

[0037]

[0038]

[0039] Among them, μ j,P represents the mean number of pixels of the jth impurity in the comparison image in the historical data, P i,jrepresents the number of pixels of the jth impurity in the i-th comparison image in the historical data, i represents the index of the comparison image in the historical data, and i = 1, 2, ..., M, M represents the number of historical comparison images, j represents the index of the impurity type, and j = 1, 2, 3, σ j,P represents the standard deviation of the jth impurity in the historical data;

[0040] The formula for generating pixel threshold is:

[0041] H j =μ j,P +k j ·σ j,P

[0042] Among them, H j represents the pixel threshold of the jth impurity, k j represents the threshold factor of the jth impurity, k j =-2, 0 or 1.

[0043] The present invention also provides a nut impurity rapid detection device applicable to a mobile production line, the device is used to implement the above-mentioned nut impurity rapid detection method applicable to a mobile production line, specifically comprising:

[0044] The data acquisition module is used to install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nut at 20 cm, install a tunable LED light source next to the multispectral camera, and when the nut passes through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band and short-wave infrared band to obtain a multispectral image;

[0045] An image processing module is used to perform denoising on the collected multispectral images, uniformly scale the size of the denoising multispectral images to 256×256, generate the first, second and third recognition images according to the different acquisition bands of the images, and correspond the pixel positions of the first recognition image, the second recognition image and the third recognition image one by one;

[0046] A feature calculation module is used to calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, and find the pixel points at the corresponding positions in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel points in the near infrared band and the short-wave infrared band, generate a feature vector for each pixel point, and integrate all feature vectors into a feature vector set;

[0047] The preprocessing module is used to collect samples of normal nuts, spoiled nuts, shell debris and external impurities, generate corresponding pixel spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to the pixels of normal nuts, spoiled nuts, shell debris and external impurities respectively, and combine all the initial feature vectors to generate an initial spectral library;

[0048] The impurity classification module is used to calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectrum library to generate feature similarity, traverse the initial spectrum library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel;

[0049] The impurity processing module is used to set all pixels detected as spoiled nuts, shell fragments and external impurities as abnormal pixels, generate comparison images, mark the coordinates of abnormal pixels and count the number of abnormal pixels of different types, set pixel thresholds for different types of impurities, and when the number of abnormal pixels exceeds the pixel threshold, issue an early warning message to prompt impurity sorting.

[0050] A nut impurity rapid detection computing device suitable for a mobile production line comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned nut impurity rapid detection method suitable for a mobile production line is implemented.

[0051] Compared with the prior art, the present invention has the following beneficial effects:

[0052] The present invention collects the spectral reflectance of the pixel points of the sample image to be detected in the visible light band, near infrared band and short-wave infrared band according to the multi-spectral imaging and image recognition technology, and generates feature vectors by the spectral reflectance in different bands, which can accurately reflect the spectral feature differences between nuts and different impurities, and provides high precision and high reliability for the subsequent classification algorithm; and pre-constructs a spectral library according to the type of impurity to be detected, and directly compares it with the spectral library when the spectral data is collected in real time, which reduces human intervention and improves the accuracy and consistency of impurity identification. At the same time, the spectral library can be adjusted in real time according to the different types of impurities detected, and the generalization ability is improved. The type of the sample to be detected is judged by the feature similarity generated by the Euclidean distance, and the spectral library only needs to be constructed in advance. When the real-time data is collected, it can directly compare with the spectral library to judge the sample type and locate it, which effectively reduces the detection time, and because each pixel is classified and located, it provides accurate data support for impurity sorting, ensuring the efficiency and reliability of the processing process.

[0053] The present invention also optimizes the production process and improves the robustness of the system by setting different abnormal thresholds for different impurities, thereby avoiding uneven product quality caused by different impurities sharing a set of threshold standards. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 This is a schematic diagram of a method flow of an embodiment of the present invention;

[0055] Figure 2 Schematic diagram of system modules according to an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0057] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0058] Example:

[0059] See also Figure 1 , the present invention provides a technical solution:

[0060] A rapid detection method for nut impurities suitable for a mobile production line, the specific steps include:

[0061] Step 1: Install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nuts at 20 cm, and install a tunable LED light source next to the multispectral camera. When the nuts pass through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band, and short-wave infrared band to obtain a multispectral image.

[0062] In this embodiment, the function of the tunable LED light source is to provide light of different wavelength bands, so that the multi-spectral camera can obtain spectral images in different wavelength bands;

[0063] In this embodiment, the preset band range of the visible light band is 400-700nm, the preset band range of the near infrared band is 700-1100nm, and the preset band range of the short-wave infrared band is 1100-2500nm;

[0064] 400-700nm belongs to the visible light band, which is used to reflect the difference in external color. Spoiled nuts and external impurities are different from normal nuts in color, so it is mainly used to detect spoiled nuts and external impurities.

[0065] 700-1100nm belongs to the near-infrared band, which is used to reflect the difference in moisture. The moisture content of spoiled nuts is different from that of normal nuts, so it is mainly used to detect spoiled nuts;

[0066] 1100~2500 belongs to the short-wave infrared band, which is used to reflect the differences in chemical composition and surface texture. The chemical composition and surface roughness of husk fragments are different from the edible part of nuts, so it is mainly used to detect husk fragments.

[0067] Step 2: De-noise the collected multispectral image, and resize the multispectral image after denoising to a uniform size of 256×256. According to the different acquisition bands of the image, the first, second and third recognition images are generated respectively, and the pixel positions of the first recognition image, the second recognition image and the third recognition image are corresponded one by one;

[0068] In this embodiment, scaling the multispectral image size to 256×256 means adjusting the width and height of the image to the same fixed size, i.e., 256 pixels, to ensure that each image has the same size during recognition and to avoid excessive distortion; the pixel points of the scaled image are annotated with coordinates, and a plane rectangular coordinate system is established with the pixel points in the bottom row as the x-axis and the pixel points in the leftmost column as the y-axis. The pixel positions of the first recognition image, the second recognition image, and the third recognition image are mapped one-to-one through the coordinates, so that each pixel point has a unique coordinate value.

[0069] Step 3: Calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, find the pixel at the corresponding position in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel in the near infrared band and the short-wave infrared band, generate the feature vector of each pixel, and integrate all the feature vectors into the feature vector set;

[0070] In this embodiment, the principle for generating the feature vector of each pixel is as follows:

[0071] The formula for calculating the spectral reflectance of a pixel in the visible light band is:

[0072]

[0073] Wherein, R1 represents the spectral reflectance of the pixel point in the visible light band, I(r1) represents the intensity of the pixel point light signal collected in the visible light band, and I0(r1) represents the intensity of the reference light signal of the standard white board collected in the visible light band;

[0074] Whiteboard has a known and nearly constant high reflectivity over the entire spectral range. By imaging the whiteboard, light intensity information related to the light source and imaging system can be obtained, which helps to remove the effects of the environment and equipment on the reflectivity and ensure that the reflectivity reflects the true optical properties of the object;

[0075] The formula for calculating the spectral reflectance of a pixel in the near-infrared band is:

[0076]

[0077] Wherein, R2 represents the spectral reflectance of the pixel point in the near-infrared band, I(r2) represents the intensity of the pixel point light signal collected in the near-infrared band, and I0(r2) represents the intensity of the reference light signal of the standard white board collected in the near-infrared band;

[0078] The formula for calculating the spectral reflectance of a pixel in the short-wave infrared band is:

[0079]

[0080] Wherein, R3 represents the spectral reflectance of the pixel point in the short-wave infrared band, I(r3) represents the intensity of the pixel point light signal collected in the short-wave infrared band, and I0(r3) represents the intensity of the reference light signal of the standard white board collected in the short-wave infrared band;

[0081] The resulting feature vector is:

[0082]

[0083] in, represents a feature vector.

[0084] Each pixel in a multispectral image can form a reflectance feature through its reflectance in different bands. The reflectance features of all considered bands are combined into a feature vector to reflect the comprehensive reflectance features of the pixel.

[0085] Step 4: Collect samples of normal nuts, spoiled nuts, shell debris and external impurities, generate corresponding pixel spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to the pixels of normal nuts, spoiled nuts, shell debris and external impurities respectively, and combine all initial feature vectors to generate an initial spectral library;

[0086] In this embodiment, the generated initial feature vector is:

[0087]

[0088] in, represents the initial feature vector of the a-th pixel in the initial spectral library, a represents the index of the pixel in the initial spectral library, S1(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the visible light band, S2(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the near-infrared band, and S3(a) represents the spectral reflectance of the a-th pixel in the initial spectral library in the short-wave infrared band.

[0089] In this embodiment, the spectral library is the sum of the spectral reflectances of pixels of known types for comparison with the spectral reflectances of pixels collected in real time. When establishing the initial spectral library, it is first necessary to determine the types of all substances to be detected and collect representative samples. The main substances in the nut production line include normal nuts, spoiled nuts, shell debris and external impurities. For these four substances, the spectral reflectances are measured in the visible light band, near-infrared band and short-wave infrared band, respectively, and feature vectors of different known substance types are generated to form the initial spectral library.

[0090] Step 5: Calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectrum library to generate feature similarity, traverse the initial spectrum library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel;

[0091] In this embodiment, the formula for generating feature similarity is:

[0092]

[0093] in, express and The Euclidean distance of , k represents the index of the band, and k = 1, 2, 3, express and The feature similarity between .

[0094] Feature similarity reflects the similarity between the real-time collected pixels and the known type of pixels. The larger the Euclidean distance between the pixels, the greater the deviation between the two and the lower the feature similarity. The feature similarity is inversely proportional to the Euclidean distance between the pixels. By traversing the Euclidean distance between the real-time collected pixels and all the pixels in the spectral library, the pixel with the smallest Euclidean distance is found, indicating that the similarity between the two is higher, and the material type corresponding to the pixel is the type of the real-time collected pixel.

[0095] Step 6: Set all pixels detected as spoiled nuts, shell debris and external impurities as abnormal pixels, generate a comparison image to mark the coordinates of the abnormal pixels and count the number of different types of abnormal pixels, set pixel thresholds for different types of impurities, and issue a warning message to prompt impurity sorting when the number of abnormal pixels exceeds the pixel threshold.

[0096] In this embodiment, the principle for setting pixel thresholds for different types of impurities is as follows:

[0097]

[0098] Among them, μ j,P represents the mean number of pixels of the jth impurity in the comparison image in the historical data, P i,j represents the number of pixels of the jth impurity in the i-th comparison image in the historical data, i represents the index of the comparison image in the historical data, and i = 1, 2, ..., M, M represents the number of historical comparison images, j represents the index of the impurity type, and j = 1, 2, 3, σ j,P represents the standard deviation of the jth impurity in the historical data;

[0099] The formula for generating pixel threshold is:

[0100] H j =μ j,P +k j ·σ j,P

[0101] Among them, H j represents the pixel threshold of the jth impurity, k j represents the threshold factor of the jth impurity, k j =-2, 0 or 1.

[0102] According to the principle of statistical distribution, the pixel threshold of impurity is set to the historical pixel mean minus several times the historical pixel standard deviation. By adjusting the threshold factor, the pixel threshold of different impurities can be affected. The larger the threshold factor value, the higher the pixel threshold, the looser the corresponding impurity type requirement, and the number of pixels that can be accepted by this type of impurity is relatively large. The smaller the threshold factor value, the lower the pixel threshold, the stricter the corresponding impurity type requirement, and the number of pixels that can be accepted by this type of impurity is relatively small.

[0103] See also Figure 2 The present invention also provides a nut impurity rapid detection device applicable to a mobile production line, the device is used to implement the above-mentioned nut impurity rapid detection method applicable to a mobile production line, specifically comprising:

[0104] The data acquisition module is used to install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nut at 20 cm, install a tunable LED light source next to the multispectral camera, and when the nut passes through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band and short-wave infrared band to obtain a multispectral image;

[0105] An image processing module is used to perform denoising on the collected multispectral images, uniformly scale the size of the denoising multispectral images to 256×256, generate the first, second and third recognition images according to the different acquisition bands of the images, and correspond the pixel positions of the first recognition image, the second recognition image and the third recognition image one by one;

[0106] A feature calculation module is used to calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, and find the pixel points at the corresponding positions in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel points in the near infrared band and the short-wave infrared band, generate a feature vector for each pixel point, and integrate all feature vectors into a feature vector set;

[0107] The preprocessing module is used to collect samples of normal nuts, deteriorated nuts, shell debris and external impurities, generate corresponding pixel point spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to normal nuts, deteriorated nuts, shell debris and external impurities respectively, and combine all initial feature vectors to generate an initial spectral library;

[0108] The impurity classification module is used to calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectrum library to generate feature similarity, traverse the initial spectrum library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel;

[0109] The impurity processing module is used to set all pixels detected as spoiled nuts, shell fragments and external impurities as abnormal pixels, generate comparison images, mark the coordinates of abnormal pixels and count the number of abnormal pixels of different types, set pixel thresholds for different types of impurities, and when the number of abnormal pixels exceeds the pixel threshold, issue an early warning message to prompt impurity sorting.

[0110] A nut impurity rapid detection computing device suitable for a mobile production line comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned nut impurity rapid detection method suitable for a mobile production line is implemented.

[0111] 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.

[0112] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.

[0113] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0114] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the 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.

Claims

1. A method for rapid detection of nut impurities suitable for a mobile production line, characterized in that: The specific steps include: Step 1: Install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nuts at 20 cm, and install a tunable LED light source next to the multispectral camera. When the nuts pass through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band, and short-wave infrared band to obtain a multispectral image. Step 2: De-noise the collected multispectral image, and resize the multispectral image after denoising to a uniform size of 256×256. According to the different acquisition bands of the image, the first, second and third recognition images are generated respectively, and the pixel positions of the first recognition image, the second recognition image and the third recognition image are corresponded one by one; Step 3: Calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, find the pixel at the corresponding position in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel in the near infrared band and the short-wave infrared band, generate the feature vector of each pixel, and integrate all the feature vectors into the feature vector set; Step 4: Collect samples of normal nuts, spoiled nuts, shell debris and external impurities, generate corresponding pixel spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to the pixels of normal nuts, spoiled nuts, shell debris and external impurities respectively, and combine all initial feature vectors to generate an initial spectral library; Step 5: Calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectral library to generate feature similarity, traverse the initial spectral library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel; Step 6: Set all pixels detected as spoiled nuts, shell debris and external impurities as abnormal pixels, generate a comparison image, mark the coordinates of the abnormal pixels and count the number of different types of abnormal pixels, set pixel thresholds for different types of impurities, and issue a warning message to prompt impurity sorting when the number of abnormal pixels exceeds the pixel threshold.

2. A method for rapid detection of nut impurities suitable for a mobile production line according to claim 1, characterized in that: The preset band range of the visible light band is 400-700nm, the preset band range of the near infrared band is 700-1100nm, and the preset band range of the short-wave infrared band is 1100-2500nm.

3. A method for rapid detection of nut impurities suitable for a mobile production line according to claim 1, characterized in that: In step 2, the coordinates of the pixel points of the scaled image are marked, and a plane rectangular coordinate system is established with the pixel points in the bottom row as the x-axis and the pixel points in the leftmost column as the y-axis. The pixel positions of the first recognition image, the second recognition image, and the third recognition image are mapped one by one through the coordinates, so that each pixel point has a unique coordinate value.

4. The method for rapid detection of nut impurities suitable for a mobile production line according to claim 1, characterized in that: The principle for generating the feature vector of each pixel in step 3 is: The formula for calculating the spectral reflectance of a pixel in the visible light band is: Wherein, R1 represents the spectral reflectance of the pixel point in the visible light band, I(r1) represents the intensity of the pixel point light signal collected in the visible light band, and I0(r1) represents the intensity of the reference light signal of the standard white board collected in the visible light band; The formula for calculating the spectral reflectance of a pixel in the near-infrared band is: Wherein, R2 represents the spectral reflectance of the pixel point in the near-infrared band, I(r2) represents the intensity of the pixel point light signal collected in the near-infrared band, and I0(r2) represents the intensity of the reference light signal of the standard white board collected in the near-infrared band; The formula for calculating the spectral reflectance of a pixel in the short-wave infrared band is: Wherein, R3 represents the spectral reflectance of the pixel point in the short-wave infrared band, I(r3) represents the intensity of the pixel point light signal collected in the short-wave infrared band, and I0(r3) represents the intensity of the reference light signal of the standard white board collected in the short-wave infrared band; The resulting feature vector is: in, represents a feature vector.

5. The method for rapid detection of nut impurities suitable for a mobile production line according to claim 4, characterized in that: The initial feature vector generated in step 4 is: in, represents the initial feature vector of the a-th pixel in the initial spectral library, a represents the index of the pixel in the initial spectral library, S1() represents the spectral reflectance of the a-th pixel in the initial spectral library in the visible light band, S2() represents the spectral reflectance of the a-th pixel in the initial spectral library in the near-infrared band, and S3() represents the spectral reflectance of the a-th pixel in the initial spectral library in the short-wave infrared band.

6. A method for rapid detection of nut impurities suitable for a mobile production line according to claim 5, characterized in that: The formula for generating feature similarity in step 5 is: in, express and The Euclidean distance of , k is the index of the band, and k = 1, 2, 3, express and The feature similarity between them.

7. The method for rapid detection of nut impurities suitable for a mobile production line according to claim 1, characterized in that: The principle for setting pixel thresholds for different types of impurities in step 6 is as follows: Among them, μ j,P represents the mean number of pixels of the jth impurity in the comparison image in the historical data, P i,j represents the number of pixels of the jth impurity in the ith comparison image in the historical data, i represents the index of the comparison image in the historical data, and i=1, 2, ..., M, M represents the number of historical comparison images, j represents the index of the impurity type, and j=1, 2, 3, σ j,P represents the standard deviation of the jth impurity in the historical data; The formula for generating pixel threshold is: H j = j,P + j ·s j,P Among them, H j represents the pixel threshold of the jth impurity, k j represents the threshold factor of the jth impurity, k j =-2, 0 or 1.

8. A nut impurity rapid detection device suitable for a mobile production line, characterized by: The device is used to implement the method for rapid detection of nut impurities applicable to a mobile production line according to any one of claims 1 to 7, and specifically comprises: The data acquisition module is used to install a multispectral camera on the top of the conveyor belt, keep the vertical distance between the camera and the nut at 20 cm, install a tunable LED light source next to the multispectral camera, and when the nut passes through the detection area, the multispectral camera captures images in the preset visible light band, near infrared band and short-wave infrared band to obtain a multispectral image; An image processing module is used to perform denoising on the collected multispectral images, uniformly scale the size of the denoising multispectral images to 256×256, generate the first, second and third recognition images according to the different acquisition bands of the images, and correspond the pixel positions of the first recognition image, the second recognition image and the third recognition image one by one; A feature calculation module is used to calculate the spectral reflectance of each pixel in the first recognition image in the visible light band, and find the pixel points at the corresponding positions in the second recognition image and the third recognition image, calculate the spectral reflectance of the pixel points in the near infrared band and the short-wave infrared band, generate a feature vector for each pixel point, and integrate all feature vectors into a feature vector set; The preprocessing module is used to collect samples of normal nuts, deteriorated nuts, shell debris and external impurities, generate corresponding pixel point spectral reflectance in the visible light band, near infrared band and short-wave infrared band, generate initial feature vectors corresponding to normal nuts, deteriorated nuts, shell debris and external impurities respectively, and combine all initial feature vectors to generate an initial spectral library; The impurity classification module is used to calculate the Euclidean distance between the feature vector in the feature vector set and the initial feature vector in the initial spectrum library to generate feature similarity, traverse the initial spectrum library, and take the sample type of the pixel corresponding to the initial feature vector with the maximum feature similarity as the type of the pixel corresponding to the feature vector in the feature vector set, and record the type and coordinates of this pixel; The impurity processing module is used to set all pixels detected as spoiled nuts, shell fragments and external impurities as abnormal pixels, generate comparison images, mark the coordinates of abnormal pixels and count the number of abnormal pixels of different types, set pixel thresholds for different types of impurities, and when the number of abnormal pixels exceeds the pixel threshold, issue an early warning message to prompt impurity sorting.

9. A nut impurity rapid detection and calculation device suitable for a mobile production line, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for rapid detection of nut impurities applicable to a mobile production line as described in any one of claims 1 to 7 when executing the computer program.

Citation Information

Patent Citations

  • Detection method and device

    CN106841035A

  • Abnormal sample identification method, system, server and electronic device

    CN107664621A

  • System and method for hyperspectral image processing to identify foreign object

    CN110998603A

  • Water source pollutant monitoring method, system and equipment and storage medium

    CN116187756A

  • Method and system of detecting foreign materials within an agricultural product stream

    US20180100810A1

Cited By

  • Online detection and sorting equipment for internal defects of torreya grandis seeds

    CN120243460A

  • Animal feed nutritional ingredient detection method and system

    CN120314227A

  • Traditional Chinese medicine decoction piece quality detection method based on hyperspectral imaging

    CN121577551A