Starch screen residue detection method
By preprocessing the starch image and using a convolutional neural network detection model, the problem of traditional starch impurity detection relying on manual observation is solved, and high-precision and high-efficiency starch impurity detection and purity evaluation are achieved.
Patent Information
- Application Number
- CN202510184907.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-19
- Publication Date
- 2025-06-10
AI Technical Summary
Traditional starch impurity detection methods rely on manual observation and empirical judgment, resulting in low detection accuracy and low efficiency. It is impossible to accurately evaluate the purity status of the starch through naked eyes and average estimation of the starch impurity number.
Image preprocessing technology is used to process the original image of the starch to be detected, and a starch impurity detection model based on a convolutional neural network is constructed. The impurities are detected through the model and the quantity and weight of the sieve residue are determined, thereby evaluating the purity of the starch.
It improves the accuracy and efficiency of starch impurity detection, avoids errors in manual observation, and can clearly distinguish impurities, observe comprehensively and accurately evaluate the purity of starch.
Smart Images

Figure CN120125523A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of starch detection, and particularly to a method for detecting starch residue. Background Art
[0002] With the acceleration of the industrialization process, starch, as a basic raw material widely used in industries such as food, medicine, and chemical engineering, its quality control has become particularly important. The purity of starch directly affects its application effect in various products. Therefore, how to quickly and accurately detect starch residue has become a key factor in improving the efficiency of starch quality control.
[0003] In the prior art, traditional methods for detecting starch impurities mainly rely on manual observation and empirical judgment, which results in low detection accuracy and low efficiency, and it is difficult to accurately reflect the actual situation of starch.
[0004] In addition, since starch impurities are usually distributed in the powder, traditional methods for detecting starch residue mainly judge the situation of impurities in starch by visual observation and average estimation of the number of starch impurities. However, this method has a large error, the observation is not comprehensive enough, and it is impossible to accurately evaluate the purity of starch. Summary of the Invention
[0005] In order to solve the technical problems that traditional methods for detecting starch impurities mainly rely on manual observation and empirical judgment, which results in low detection accuracy and low efficiency, and it is difficult to accurately reflect the actual situation of starch, and traditional methods for detecting starch residue mainly judge the situation of impurities in starch by visual observation and average estimation of the number of starch impurities, with a large error, unable to clearly distinguish impurities, the observation is not comprehensive enough, and it is impossible to accurately evaluate the purity of starch, the present invention provides a method for detecting starch residue.
[0006] The technical solutions provided by the embodiments of the present invention are as follows:
[0007] A method for detecting starch residue provided by an embodiment of the present invention includes:
[0008] S1: Obtain the original image of the starch to be detected;
[0009] S2: Perform image preprocessing on the original image to obtain a target image;
[0010] S3: Construct a starch impurity detection model based on a convolutional neural network;
[0011] S4: Input the target image into the starch impurity detection model for impurity detection, and output the starch impurity detection result;
[0012] S5: When no impurities are detected in the target image, return to S1;
[0013] S6: When impurities are detected in the target image, proceed to the next step;
[0014] S7: Conduct residue detection on the starch in which impurities are detected to determine the quantity and weight of the residue;
[0015] S8: Determine the starch purity based on the quantity and weight of the residue.
[0016] The beneficial effects brought by the technical solution provided in the embodiments of the present invention at least include:
[0017] In the present invention, through image preprocessing of the original image of the starch to be detected, a target image is obtained, and the target image is input into a starch impurity detection model based on a convolutional neural network for impurity detection, and the starch impurity detection result is output. The detection of starch impurities no longer relies on manual observation and empirical judgment, with high detection accuracy and efficiency, and can accurately reflect the actual situation of the starch. By conducting residue detection on the starch in which impurities are detected, the quantity and weight of the residue are determined, and based on the quantity and weight of the residue, the starch purity is determined, avoiding the situation of judging the impurities in the starch by visually observing and averaging and estimating the number of starch impurities during the detection process of starch residue, reducing errors, being able to clearly distinguish impurities, observing comprehensively, and accurately evaluating the purity status of the starch. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a schematic flowchart of a method for detecting starch residue provided in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] The following will describe the technical solutions in the present invention with reference to the drawings.
[0021] Refer to the attached Figure 1 illustrates a schematic flowchart of a method for detecting starch residue provided in an embodiment of the present invention.
[0022] The embodiments of the present invention provide a method for detecting starch residue. This method can be implemented by a starch residue detection device, and the starch residue detection device can be a terminal or a server. The processing flow of the method for detecting starch residue can include the following steps:
[0023] S1: Obtain the original image of the starch to be detected.
[0024] S2: Perform image preprocessing on the original image to obtain the target image.
[0025] In the present invention, by performing image preprocessing on the original image to improve the image quality, the accuracy and reliability of image analysis can be significantly improved.
[0026] In a possible implementation manner, S2 specifically includes sub-steps S201 and S202:
[0027] S201: Eliminate the motion blur of the original image through the Wiener filtering algorithm to obtain a clear image.
[0028] Specifically, during the process of photographing the starch to be detected, due to camera shake, slow shutter speed, or the movement of the object being photographed, the original image may generate motion blur, thereby reducing the detection accuracy. Motion blur refers to the imaging blur caused by the relative motion between the camera and the shooting scene, which affects the recognition of starch impurities. Therefore, by using the Wiener filtering algorithm to eliminate the motion blur of the original image, a clear image of the starch to be detected can be obtained.
[0029] It should be noted that Wiener Filtering is an optimal linear filtering method, mainly used to remove noise and blur and improve the clarity of images or signals. It is based on the minimum mean square error criterion (MMSE), and constructs a filter in the frequency domain using the power spectrum of the original image, the noise power spectrum, and the point spread function (PSF) to restore the original signal as much as possible. Wiener filtering is widely used in the fields of motion blur removal, image denoising, speech signal processing, etc., and can achieve the best effect between noise suppression and detail preservation.
[0030] In the present invention, by removing motion blur, Wiener filtering can restore the details of starch in the image, especially the edges of impurities, making them clearer, which is helpful for subsequent impurity detection and improves the detection accuracy. Motion blur often leads to the loss of image information or an increase in errors. Wiener filtering can effectively reduce the influence of noise and blur by optimizing image restoration in the frequency domain, and avoid misclassification caused by blur.
[0031] In a possible implementation manner, S201 specifically includes sub-steps S2011 to S2015:
[0032] S2011: Convert the original image from the spatial domain to the frequency domain through Fourier transform.
[0033] It should be noted that the Fourier Transform (FT) is a mathematical tool used to decompose signals in the time domain or spatial domain into sine wave components of different frequencies, thereby analyzing the frequency characteristics of signals in the frequency domain. The core idea of the Fourier Transform is that any complex signal can be regarded as the superposition of sine waves of different frequencies. It is widely used in fields such as image processing, signal analysis, vibration detection, and speech recognition. For example, in image processing, the Fourier Transform can be used to remove periodic noise, enhance specific frequency components, or perform deblurring processing. Its inverse transform (Inverse Fourier Transform, IFT) can convert frequency domain data back to the original signal.
[0034] Specifically, according to the following formula, through the Fourier Transform, the original image is converted from the spatial domain to the frequency domain:
[0035] F(u,v) = FT{f(x,y)}
[0036] Where, F(u,v) represents the pixel value of the original image at the coordinate (u,v) in the frequency domain, FT represents the Fourier Transform operator, and f(x,y) represents the pixel value of the original image at the coordinate (x,y) in the spatial domain.
[0037] S2012: Through the Fourier Transform, the point spread function is converted from the spatial domain to the frequency domain.
[0038] Specifically, according to the following formula, through the Fourier Transform, the point spread function is converted from the spatial domain to the frequency domain:
[0039] H(u,v) = FT[h(x,y)]
[0040] Where, H(u,v) represents the point spread function at the coordinate (u,v) in the frequency domain, and h(x,y) represents the point spread function at the coordinate (x,y) in the spatial domain.
[0041] S2013: According to the point spread function in the frequency domain, determine the transfer function of the Wiener filter in the frequency domain.
[0042] Specifically, according to the following formula, determine the transfer function of the Wiener filter in the frequency domain:
[0043]
[0044] Where, W(u,v) represents the transfer function of the Wiener filter at the coordinate (u,v) in the frequency domain, H * (u,v) represents the complex conjugate of the point spread function at the coordinate (u,v) in the frequency domain, and K represents the empirical parameter.
[0045] S2014: Restore the original image in the frequency domain according to the transfer function of the Wiener filter to obtain a restored image.
[0046] Specifically, restore the original image in the frequency domain according to the following formula to obtain a restored image:
[0047]
[0048] where represents the pixel value of the restored image in the frequency domain at coordinates (u, v).
[0049] S2015: Convert the restored image from the frequency domain to the spatial domain through inverse Fourier transform to obtain a clear image.
[0050] Specifically, according to the following formula, convert the restored image from the frequency domain to the spatial domain through inverse Fourier transform to obtain a clear image:
[0051]
[0052] where represents the pixel value of the clear image in the spatial domain at coordinates (x, y), and FT -1 represents the inverse Fourier transform operator.
[0053] In the present invention, the process of Fourier transform converts the image into the frequency domain, which can separate different frequency components. By using the Wiener filter, the lost detail information can be restored. Especially when there are fine features (such as starch impurities) in the image, higher clarity and accuracy can be maintained. Wiener filtering not only eliminates blurring, but also balances noise suppression and detail retention during the processing, avoiding the over-smoothing problem that may be caused by traditional filtering methods and ensuring more accurate image features.
[0054] S202: Enhance the clear image through the MSRCR algorithm to obtain a target image.
[0055] Specifically, before impurity detection, the clear image may be affected by factors such as uneven illumination, noise interference, or low contrast, resulting in blurred key details, thus weakening the recognition ability of the convolutional neural network (CNN). Therefore, enhance the clear image through the MSRCR algorithm to obtain a target image. After MSRCR processing, the target image can remain clear, rich in details, and accurate in color in a complex illumination environment, thus providing a more stable and accurate input for subsequent impurity detection by CNN.
[0056] It should be noted that MSRCR (Multi-Scale Retinex with Color Restoration) is an image enhancement algorithm used to improve the contrast, details, and color fidelity of images. It combines the illumination normalization ability of multi-scale Retinex (MSR) and the color restoration (CR) mechanism, and can enhance images in complex environments such as low light, high dynamic range, and haze. The MSR part decomposes the illumination component of the image using multi-scale Gaussian filtering and extracts the reflection component through logarithmic transformation, thereby enhancing the local contrast. The CR part prevents color distortion caused by Retinex processing through color compensation. This algorithm is widely used in fields such as medical imaging, remote sensing image processing, and industrial inspection, and can significantly improve the image clarity and color quality.
[0057] It should be noted that Gaussian Filtering is a smoothing filtering method based on the Gaussian function, mainly used to remove image noise, reduce the influence of details, and at the same time maintain good edge characteristics. It performs a convolution operation on the image through a Gaussian Kernel, replacing the current pixel value with the weighted average of neighboring pixels to make the image smoother. Gaussian filtering has a better denoising effect compared to mean filtering because it assigns higher weights to neighboring pixels and lower weights to pixels farther away, thereby reducing the loss of sharp edges. This method is widely used in computer vision tasks such as image preprocessing, edge detection (such as the Canny operator), and frequency domain filtering.
[0058] In the present invention, the MSRCR algorithm can effectively perform illumination normalization through multi-scale Retinex technology, enhance the local contrast, make the details of the image clearer, and at the same time avoid color distortion through the color restoration mechanism, ensuring that the colors of the image are more real and accurate. The MSRCR algorithm combines Gaussian filtering for noise removal, smooths the noise components in the image, and at the same time maintains key details by enhancing the local contrast, thereby avoiding the interference of noise on impurity detection.
[0059] In a possible implementation manner, S202 specifically includes sub-steps S2021 to S2025:
[0060] S2021: Perform multi-scale Gaussian filtering on the clear image to obtain illumination components at different scales:
[0061]
[0062] where L s (x, y) represents the illumination component at the coordinate (x, y) at the s-th scale, G s(x, y) represents the Gaussian kernel at the coordinate (x, y) under the s-th scale.
[0063] Among them, the illumination component refers to the brightness component generated by the ambient light source in the image, usually manifested as large-scale illumination changes, such as shadow or highlight areas.
[0064] S2022: Calculate the reflection components at different scales according to the illumination component and the clear image:
[0065]
[0066] Among them, r s (x, y) represents the reflection component at the coordinate (x, y) under the s-th scale.
[0067] Among them, the reflection component refers to the texture and color information of the object surface itself, representing the true reflection characteristics after removing the influence of illumination.
[0068] S2023: Perform weighted fusion on the reflection components at different scales to obtain the comprehensive reflection component:
[0069]
[0070] Among them, R(x, y) represents the comprehensive reflection component at the coordinate (x, y), and ω s represents the weight coefficient of the s-th scale.
[0071] S2024: Perform exponential transformation on the comprehensive reflection component to obtain the enhanced image:
[0072]
[0073] Among them, represents the pixel value of the enhanced image at the coordinate (x, y), and exp() represents the exponential function.
[0074] S2025: Introduce a color restoration factor to perform color restoration processing on the enhanced image to obtain the target image:
[0075]
[0076] Among them, represents the pixel value of the target image at the coordinate (x, y), C(x, y) represents the color restoration factor at the coordinate (x, y), α represents the first color adjustment parameter, and λ represents the second color adjustment parameter.
[0077] In the present invention, by processing the illumination component through multi-scale Gaussian filtering, the illumination and reflection components of the image can be effectively decomposed at different scales, enhancing the local contrast of the image, especially in the shadow and highlight regions, thereby making the details in the image clearer and richer. Illumination changes (such as shadows or reflections) can interfere with image details. The extraction of the reflection component removes the influence of illumination and only retains the texture and color information of the object surface, thus more accurately reflecting the real scene. When enhancing the image, by introducing a color restoration factor, the common color distortion problem in the Retinex processing process is avoided, and the natural color of the image is restored.
[0078] S3: Construct a starch impurity detection model based on a convolutional neural network.
[0079] Among them, the convolutional neural network includes: an input layer, multiple convolutional layers, multiple pooling layers, multiple flattening layers, a feature fusion layer, a fully connected layer, and an output layer. The convolutional layers include a first convolutional layer, a second convolutional layer, and a third convolutional layer. The pooling layers include a first pooling layer, a second pooling layer, a third pooling layer, a fourth pooling layer, and a fifth pooling layer. The flattening layers include a first flattening layer, a second flattening layer, and a third flattening layer.
[0080] It should be noted that a convolutional neural network (CNN) is a deep learning model specifically used to process images, videos, and time-series data. It automatically extracts local features and hierarchical patterns of the data through structures such as convolutional layers, pooling layers, and fully connected layers. The core of the CNN lies in the convolutional operation, which uses a trainable filter (kernel) to scan the input data and extract key features such as edges, textures, and shapes. Subsequently, the pooling operation reduces the computational amount and improves the generalization ability of the model. The CNN has made breakthrough progress in fields such as image classification, object detection, speech recognition, and medical image analysis.
[0081] S4: Input the target image into the starch impurity detection model for impurity detection, and output the starch impurity detection result.
[0082] In the present invention, the CNN can automatically extract local features (such as edges, textures, shapes, etc.) from the input image without manual feature design, which greatly simplifies the image processing process and improves the efficiency and accuracy of feature extraction. In starch impurity detection, this means that the model can automatically identify the key features in the image without human intervention.
[0083] In a possible implementation manner, S4 specifically includes sub-steps S401 to S415:
[0084] S401: Input the target image in the input layer.
[0085] S402: Extract features from the target image in the first convolutional layer to obtain the first local feature map.
[0086] It should be noted that in the first convolutional layer, 32 convolutional kernels are used to extract features from the target image. The size of each convolutional kernel is 5×5, and the ReLU activation function is adopted, thereby obtaining the first local feature map.
[0087] S403: Perform a pooling operation on the first local feature map in the first pooling layer to obtain the first pooled feature map.
[0088] It should be noted that in the first pooling layer, a max pooling operation is performed on the first local feature map. The size of the pooling window is 2×2, and the stride is 2, thereby obtaining the first pooled feature map.
[0089] S404: Extract features from the first pooled feature map in the second convolutional layer to obtain the second local feature map.
[0090] It should be noted that in the second convolutional layer, 64 convolutional kernels are used to extract features from the first pooled feature map. The size of each convolutional kernel is 5×5, and the ReLU activation function is adopted, thereby obtaining the second local feature map.
[0091] S405: Perform a pooling operation on the second local feature map in the second pooling layer to obtain the second pooled feature map.
[0092] It should be noted that in the second pooling layer, a max pooling operation is performed on the second local feature map. The size of the pooling window is 2×2, and the stride is 2, thereby obtaining the second pooled feature map.
[0093] S406: Extract features from the second pooled feature map in the third convolutional layer to obtain the third local feature map.
[0094] It should be noted that in the third convolutional layer, 128 convolutional kernels are used to extract features from the first pooled feature map. The size of each convolutional kernel is 5×5, and the ReLU activation function is adopted, thereby obtaining the third local feature map.
[0095] S407: Perform a pooling operation on the third local feature map in the third pooling layer to obtain the third pooled feature map.
[0096] It should be noted that in the third pooling layer, a max pooling operation is performed on the third local feature map. The size of the pooling window is 2×2, and the stride is 2, thereby obtaining the third pooled feature map.
[0097] S408: In the first flattening layer, flatten the third pooled feature map into a one-dimensional vector to obtain the first flattened vector.
[0098] S409: In the fourth pooling layer, perform a pooling operation on the first pooled feature map to obtain the fourth pooled feature map.
[0099] It should be noted that in the fourth pooling layer, perform a max pooling operation on the first pooled feature map with a pooling window size of 4×4 and a stride of 4 to obtain the fourth pooled feature map.
[0100] S410: In the second flattening layer, flatten the fourth pooled feature map into a one-dimensional vector to obtain the second flattened vector.
[0101] S411: In the fifth pooling layer, perform a pooling operation on the second pooled feature map to obtain the fifth pooled feature map.
[0102] It should be noted that in the fifth pooling layer, perform a max pooling operation on the second pooled feature map with a pooling window size of 2×2 and a stride of 2 to obtain the fifth pooled feature map.
[0103] S412: In the third flattening layer, flatten the fifth pooled feature map into a one-dimensional vector to obtain the third flattened vector.
[0104] S413: In the feature fusion layer, fuse the first flattened vector, the second flattened vector, and the third flattened vector to obtain the feature fusion vector.
[0105] S414: In the fully connected layer, perform feature recognition on the feature fusion vector through the ReLU activation function.
[0106] It should be noted that the number of neurons in the fully connected layer is 256.
[0107] S415: In the output layer, classify the output of the fully connected layer through the SoftMax activation function and output the starch impurity detection result.
[0108] In the present invention, through the combination of multiple convolutional layers and pooling layers, the model extracts features at different levels layer by layer. The low-level convolutional layers capture edges and textures, while the high-level convolutional layers identify more complex features such as shapes and textures. The hierarchical feature extraction improves the recognition accuracy and robustness of the model for starch impurities. Through multiple flattening layers, the feature maps of each layer are flattened into one-dimensional vectors, and the features of different convolutional layers and pooling layers are fused in the feature fusion layer, enhancing the information integration ability and further improving the detection accuracy. In the fully connected layer, non-linear feature recognition is performed through the ReLU activation function to capture more complex feature patterns, enhancing the learning and classification ability of the model. In the output layer, the Softmax activation function is used for classification to ensure high accuracy and stability, and accurately detect whether there are impurities in the starch.
[0109] S5: When no impurities are detected in the target image, return to S1.
[0110] S6: When impurities are detected in the target image, proceed to the next step.
[0111] S7: Perform residue detection on the starch detected to have impurities, and determine the quantity and weight of the residue.
[0112] It should be noted that the residue refers to the solid substances or impurities that cannot pass through the sieve holes after the sieving process, and is usually used to evaluate the purity or quality of the material.
[0113] In a possible implementation, S7 specifically includes sub-steps S701 to S708:
[0114] S701: Dissolve the starch with impurities in water to obtain a starch aqueous solution.
[0115] S702: Pour the starch aqueous solution into a round sieve with a specified mesh size.
[0116] Specifically, pour the starch aqueous solution into a 200-mesh round sieve.
[0117] S703: Wash the starch aqueous solution in the round sieve with flowing water until the water flowing out from below the sieve holes of the round sieve becomes clean and transparent, to obtain the residue.
[0118] S704: Use a constant-weight filter paper to collect the residue.
[0119] It should be noted that a constant weight filter paper is a filter paper that has been fully dried and weighed, and is used to accurately measure the weight of a sample. It is usually used in experiments to collect solid substances. For example, during the filtration process, it is used to collect the residue or precipitate. When the filter paper is used to collect the sample, the weight of the dried filter paper remains unchanged, which can ensure more accurate results measured in the experiment and avoid errors caused by changes in the humidity of the filter paper. Constant weight filter papers are widely used in fields such as chemical analysis, environmental detection, and food quality control.
[0120] S705: Obtain an image of the residue on the constant weight filter paper.
[0121] S706: Determine the quantity of the residue through a support vector machine algorithm based on the residue image.
[0122] It should be noted that the Support Vector Machine (SVM) is a machine learning algorithm used for classification and regression tasks. Its core idea is to find the optimal hyperplane in the feature space to maximize the margin between classes, thereby improving the generalization ability of the model. The SVM defines the decision boundary through support vectors and uses the kernel function to map non-linearly separable data to a higher-dimensional space to make it linearly separable in the new dimension. The SVM is widely used in fields such as text classification, face recognition, medical diagnosis, and object detection, and has strong robustness and good classification performance, especially suitable for small sample datasets.
[0123] In a possible implementation, S706 specifically includes sub-steps S7061 to S7069:
[0124] S7061: Divide the residue image into multiple cells based on a preset pixel size.
[0125] It should be noted that those skilled in the art can set the preset pixel size according to actual needs. Optionally, the target image is divided into multiple cells with a size of 8×8 pixels.
[0126] S7062: Calculate the horizontal gradient and vertical gradient of each pixel point in each cell through a Sobel filter.
[0127] It should be noted that the Sobel Filter is an operator for edge detection. It highlights edge information by calculating the gradient of pixel points in an image. It uses convolution kernels in two directions (horizontal Gx and vertical Gy) to calculate the brightness changes in the horizontal and vertical directions respectively, and then synthesizes the gradient magnitude to detect edges in the image. The Sobel Filter has a certain noise suppression effect and high computational efficiency. It is widely used in tasks such as computer vision, image processing, and edge detection, and is often used as a basic step in advanced algorithms such as Canny edge detection.
[0128] Specifically, according to the following formula, the horizontal gradient and vertical gradient of each pixel point in the cell are calculated through the Sobel Filter:
[0129] I X = I * W 1 , W 1 = [-1, 0, 1]
[0130] I Y = I * W 2 , W 2 = [-1, 0, 1] T
[0131] where, I X represents the horizontal gradient of the pixel point, I represents the pixel value of the pixel point, W 1 represents the Sobel filter matrix in the horizontal direction, I Y represents the vertical gradient of the pixel point, W 2 represents the Sobel filter matrix in the vertical direction, T represents the transpose operation.
[0132] S7063: Calculate the gradient magnitude and gradient direction of each pixel point in the cell according to the horizontal gradient and vertical gradient of each pixel point in the cell.
[0133] Specifically, according to the following formula, calculate the gradient magnitude and gradient direction of each pixel point in the cell:
[0134]
[0135] where, G represents the gradient magnitude of the pixel point, || represents taking the absolute value, θ represents the gradient direction of the pixel point, tan() represents the arctangent function, and mod represents the modulo operation.
[0136] S7064: Divide multiple direction groups in the cell according to the gradient direction of each pixel point in the cell.
[0137] Specifically, within the range of 0 to 180°, nine direction groups are evenly divided: direction group 1 is from 0° to 20°, direction group 2 is from 20° to 40°, direction group 3 is from 40° to 60°, direction group 4 is from 60° to 80°, direction group 5 is from 80° to 100°, direction group 6 is from 100° to 120°, direction group 7 is from 120° to 140°, direction group 8 is from 140° to 160°, and direction group 9 is from 160° to 180°.
[0138] For example, when the gradient direction of a pixel is 90°, the pixel is classified into direction group 5. When the gradient direction of a pixel is 145°, the pixel is classified into direction group 8.
[0139] S7065: Calculate the total gradient magnitude of each direction group based on the gradient magnitudes of each pixel in the cell to obtain the directional gradient histogram.
[0140] Specifically, according to the following formula, calculate the total gradient magnitude of each direction group to obtain the directional gradient histogram:
[0141]
[0142] where Z j represents the total gradient magnitude of the j-th direction group, M represents the total number of pixels in the direction group, and G i represents the gradient magnitude of the i-th pixel in the direction group.
[0143] S7066: Group each cell to obtain multiple feature blocks, and splice the directional gradient histograms in each cell of the feature block to obtain the block feature vector.
[0144] Specifically, combine adjacent 2×2 cells into a feature block, that is, each feature block contains 4 cells (for example: if each cell is 8×8 pixels, then the size of each feature block is 16×16 pixels). Then, splice the directional gradient histograms of each cell in the feature block to form the final block feature vector.
[0145] S7067: Standardize the block feature vector through the L2-Norm algorithm to obtain the directional gradient histogram descriptor.
[0146] It should be noted that the L2-Norm algorithm is a method for measuring the magnitude or similarity of vectors. It calculates the square root of the sum of the squares of all components to obtain the overall length or intensity. In machine learning and deep learning, L2-Norm is often used for feature normalization to ensure the consistency of data at different scales. At the same time, in regularization, it is used to suppress overly large weights to prevent the model from overfitting. In addition, in the field of computer vision, it is widely used in image feature extraction, object detection, and edge detection to help improve the stability and accuracy of the model.
[0147] Specifically, according to the following formula, the block feature vector is normalized through the L2-Norm algorithm to obtain the histogram of oriented gradients descriptor:
[0148]
[0149] where, represents the normalized block feature vector, v represents the block feature vector, || || 2 represents the L2 norm, and ε represents a constant (usually taking the value of 10 -6 ).
[0150] S7068: Gradually scan the target image through a sliding window with a preset window size, and extract the histogram of oriented gradients descriptor within the current window.
[0151] It should be noted that those skilled in the art can set the preset window size according to actual needs, and the present invention does not limit it here.
[0152] S7069: According to the histogram of oriented gradients descriptor within the current window, identify the number of residues through the support vector machine algorithm and determine the number of residues.
[0153] Specifically, according to the following formula, identify the number of residues through the support vector machine algorithm and determine the number of residues:
[0154] F(x 0 ) = w T x 0 + b 0
[0155] where, F() represents the output of the support vector machine algorithm, x 0 represents the histogram of oriented gradients descriptor within the current window, w represents the weight coefficient of the support vector machine, and b 0 represents the bias term. Among them, when F(x 0 ) > 0, the current window is classified as a window containing residues; when F(x 0 ) < 0, the current window is classified as a window not containing residues.
[0156] Specifically, when the current window is classified as a window containing residues, the residue quantity is incremented by 1; otherwise, the current residue quantity remains unchanged.
[0157] In the present invention, through precise image processing and the Support Vector Machine (SVM) algorithm, the Sobel filter is combined to extract the edge features of the image, calculate the gradient magnitude and direction, and the texture information in the image is efficiently extracted through the Histogram of Oriented Gradients (HOG) features. The L2-Norm algorithm is used to standardize the feature vectors to ensure feature consistency under different scales and conditions, improving the stability and accuracy of the model. The image is scanned through a sliding window, which can comprehensively cover the possible residue areas to ensure that the residues in each window can be recognized and classified. The SVM classifier accurately determines whether each window contains residues using the maximum margin principle, providing high-precision residue quantity recognition.
[0158] It should be noted that since the same target (residue) may be detected by multiple detection frames (windows), duplicate counting may occur.
[0159] Furthermore, after S7068 and before S7069, it further includes:
[0160] Removing duplicate detection frames (windows) through the Soft-Non-Maximum Suppression algorithm.
[0161] Specifically, through the Soft-Non-Maximum Suppression algorithm, the confidence of the detection frame (window) is adjusted. After adjusting the confidence, if the confidence of a certain detection frame (window) is lower than a set minimum value, it is deleted.
[0162] Among them, the Soft-Non-Maximum Suppression algorithm is specifically:
[0163]
[0164] Where S i represents the Soft-Non-Maximum Suppression algorithm, K i represents the confidence of the i-th detection frame, M represents the maximum confidence frame, b i represents the i-th detection frame, and iou(M, b i ) represents the intersection over union between the maximum confidence frame and the i-th detection frame, and N t represents the set threshold.
[0165] It should be noted that the Soft-Non-Maximum Suppression algorithm (Soft-NMS) is an improvement over the traditional IoU-NMS, mainly solving the problem that the traditional NMS may delete too many frames when dealing with a large number of overlapping frames. Soft-NMS does not directly delete frames when calculating IoU, but retains more frames by reducing the confidence of overlapping frames.
[0166] In the present invention, a soft non-maximum suppression algorithm is adopted to replace the traditional intersection over union non-maximum suppression algorithm, which can avoid premature rejection of boxes with a small degree of overlap, reduce the missed detection and false detection of targets in the case of target aggregation, retain more potential target information, and thus further optimize the detection performance.
[0167] S707: Dry the constant-weight filter paper after collecting the residue to obtain a dried filter paper.
[0168] Specifically, put the constant-weight filter paper after collecting the residue into an oven for drying, and the drying conditions are 130 °C for 90 minutes to obtain a dried filter paper.
[0169] S708: Determine the weight of the residue through subtraction according to the constant-weight filter paper and the dried filter paper.
[0170] In a possible implementation manner, S708 is specifically:
[0171] Determine the weight of the residue by subtracting the weight of the constant-weight filter paper from the weight of the dried filter paper through subtraction.
[0172] Specifically, weigh the constant-weight filter paper before using it to collect the residue to obtain the weight of the constant-weight filter paper, then weigh the dried filter paper to obtain the weight of the dried filter paper, subtract the weight of the constant-weight filter paper from the weight of the dried filter paper through subtraction, and determine the obtained weight difference as the weight of the residue.
[0173] In the present invention, impurities in the starch aqueous solution are removed by washing with flowing water to ensure the purity of the residue, reduce interference, and ensure the accuracy of subsequent analysis. Use a constant-weight filter paper to collect the residue to avoid errors caused by humidity changes and ensure the accuracy of the measurement results. Identify the number of residues on the constant-weight filter paper by obtaining the residue image and using the support vector machine algorithm to accurately count the number and provide data support for subsequent weight calculation. Calculate the weight of the residue by the weight difference between the dried filter paper and the constant-weight filter paper to eliminate the influence of moisture and ensure the accuracy of the weight determination.
[0174] S8: Determine the starch purity according to the number and weight of the residue.
[0175] Among them, the starch purity includes: high-purity starch, medium-purity starch, and low-purity starch.
[0176] Among them, when the number of residues is less than the preset number and the weight of the residue is less than the preset weight, it is determined that the starch is high-purity starch.
[0177] Among them, when the number of residues is equal to the preset number and the weight of the residue is equal to the preset weight, it is determined that the starch is medium-purity starch.
[0178] Among them, when the quantity of the sieve residue is greater than a preset quantity or the weight of the sieve residue is greater than a preset weight, it is determined that the starch is low-purity starch.
[0179] It should be noted that those skilled in the art can set the sizes of the preset quantity and the preset weight according to actual needs, and the present invention does not make any limitations here.
[0180] In the present invention, through comprehensive evaluation of the quantity and weight of the sieve residue, the purity of the starch can be determined more accurately. Different quantity and weight ranges correspond to different purity levels (high purity, medium purity, low purity), thereby providing a scientific basis for the quality control of starch. By real-time monitoring of the changes in the quantity and weight of the sieve residue, the starch quality can be dynamically tracked, and unqualified starch batches can be detected in a timely manner, so as to make adjustments and optimizations during the production process to ensure the consistency and stability of the product quality.
[0181] The beneficial effects brought by the technical solutions provided by the embodiments of the present invention at least include:
[0182] In the present invention, through image preprocessing of the original image of the starch to be detected, a target image is obtained, and the target image is input into a starch impurity detection model based on a convolutional neural network for impurity detection, and the starch impurity detection result is output. The detection of starch impurities no longer depends on manual observation and empirical judgment, with high detection accuracy and efficiency, and can accurately reflect the actual situation of the starch. By performing sieve residue detection on the starch detected to have impurities, the quantity and weight of the sieve residue are determined, and based on the quantity and weight of the sieve residue, the starch purity is determined, avoiding the situation of judging the impurities in the starch by visually observing and averaging and estimating the number of starch impurities during the detection process of the starch sieve residue, reducing errors, being able to clearly distinguish impurities, observing comprehensively, and accurately evaluating the purity status of the starch.
[0183] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, and all should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
[0184] The following points need to be explained:
[0185] (1) The drawings of the embodiments of the present invention only relate to the structures involved in the embodiments of the present invention, and other structures can refer to the general design.
[0186] (2) For clarity, in the drawings used to describe the embodiments of the present invention, the thickness of layers or regions is enlarged or reduced, that is, these drawings are not drawn to actual scale. It can be understood that when an element such as a layer, film, region, or substrate is referred to as being "on" or "under" another element, the element can be "directly" on or under the other element or there can be intervening elements.
[0187] (3) Without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other to obtain new embodiments.
[0188] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for detecting starch residue, characterized in that: include: S1: Obtain the original image of the starch to be detected; S2: performing image preprocessing on the original image to obtain a target image; S3: Construct a starch impurity detection model based on convolutional neural network; S4: inputting the target image into the starch impurity detection model to perform impurity detection, and outputting a starch impurity detection result; S5: When no impurities are detected in the target image, return to S1; S6: When the target image is detected to have impurities, proceed to the next step; S7: Performing a sieve residue test on the starch detected to contain impurities to determine the amount and weight of the sieve residue; S8: Determine the starch purity according to the quantity and weight of the residue.
2. The starch residue detection method according to claim 1, characterized in that: The S2 specifically includes: S201: Eliminate the motion blur of the original image by using a Wiener filtering algorithm to obtain a clear image; S202: Perform enhancement processing on the clear image by using the MSRCR algorithm to obtain the target image.
3. The starch residue detection method according to claim 2, characterized in that: The S201 specifically includes: S2011: converting the original image from the spatial domain to the frequency domain through Fourier transform; S2012: Convert the point spread function from the spatial domain to the frequency domain through Fourier transform; S2013: determining a transfer function of the Wiener filter in the frequency domain according to the point spread function in the frequency domain; S2014: Restoring the original image in the frequency domain according to the transfer function of the Wiener filter in the frequency domain to obtain a restored image; S2015: Convert the restored image from the frequency domain to the spatial domain through inverse Fourier transform to obtain the clear image.
4. The starch residue detection method according to claim 2, characterized in that: The S202 specifically includes: S2021: Perform multi-scale Gaussian filtering on the clear image to obtain illumination components at different scales; S2022: Calculating reflection components at different scales according to the illumination component and the clear image; S2023: performing weighted fusion on the reflection components at different scales to obtain a comprehensive reflection component; S2024: performing exponential transformation on the comprehensive reflection component to obtain an enhanced image; S2025: Introducing a color restoration factor, performing color restoration processing on the enhanced image, and obtaining the target image.
5. The starch residue detection method according to claim 1, characterized in that: The convolutional neural network includes: an input layer, multiple convolutional layers, multiple pooling layers, multiple flattening layers, a feature fusion layer, a fully connected layer and an output layer, the convolutional layer includes a first convolutional layer, a second convolutional layer and a third convolutional layer, the pooling layer includes a first pooling layer, a second pooling layer, a third pooling layer, a fourth pooling layer and a fifth pooling layer, and the flattening layer includes a first flattening layer, a second flattening layer and a third flattening layer.
6. The starch residue detection method according to claim 5, characterized in that: The S4 specifically includes: S401: In the input layer, input the target image; S402: In the first convolutional layer, extract features of the target image to obtain a first local feature map; S403: In the first pooling layer, performing a pooling operation on the first local feature map to obtain a first pooling feature map; S404: In the second convolutional layer, extract features from the first pooled feature map to obtain a second local feature map; S405: In the second pooling layer, performing a pooling operation on the second local feature map to obtain a second pooling feature map; S406: In the third convolutional layer, extract features from the second pooled feature map to obtain a third local feature map; S407: In the third pooling layer, performing a pooling operation on the third local feature map to obtain a third pooling feature map; S408: In the first flattening layer, flatten the third pooling feature map into a one-dimensional vector to obtain a first flattened vector; S409: In the fourth pooling layer, performing a pooling operation on the first pooling feature map to obtain a fourth pooling feature map; S410: In the second flattening layer, flatten the fourth pooling feature map into a one-dimensional vector to obtain a second flattened vector; S411: In the fifth pooling layer, performing a pooling operation on the second pooling feature map to obtain a fifth pooling feature map; S412: In the third flattening layer, flatten the fifth pooling feature map into a one-dimensional vector to obtain a third flattened vector; S413: In the feature fusion layer, feature fusion is performed on the first flattened vector, the second flattened vector, and the third flattened vector to obtain a feature fusion vector; S414: In the fully connected layer, feature recognition is performed on the feature fusion vector through a ReLU activation function; S415: In the output layer, the output of the fully connected layer is classified through a SoftMax activation function, and a starch impurity detection result is output.
7. The starch residue detection method according to claim 1, characterized in that: The S7 specifically includes: S701: dissolving starch containing impurities using water to obtain a starch aqueous solution; S702: pouring the starch aqueous solution into a mesh round sieve; S703: washing the starch aqueous solution in the mesh round sieve with running water until the water flowing out from below the mesh holes of the mesh round sieve becomes clean and transparent, thereby obtaining the sieve residue; S704: using constant weight filter paper to collect the sieve residue; S705: Acquire an image of the residue on the constant weight filter paper; S706: Determine the amount of the sieve residues according to the sieve residue image by using a support vector machine algorithm; S707: drying the constant weight filter paper after collecting the sieve residue to obtain dry filter paper; S708: Determine the weight of the residue according to the constant weight filter paper and the dry filter paper.
8. The starch residue detection method according to claim 7, characterized in that: The S706 specifically includes: S7061: Dividing the sieve residue image into a plurality of cells based on a preset pixel size; S7062: Calculate the horizontal gradient and vertical gradient of each pixel point in each of the cells through a Sobel filter; S7063: Calculate the gradient amplitude and gradient direction of each pixel point in the cell according to the horizontal gradient and the vertical gradient of each pixel point in the cell; S7064: Divide the cell into a plurality of direction groups according to the gradient directions of the pixels in the cell; S7065: Calculate the sum of the gradient amplitudes of each direction group according to the gradient amplitude of each pixel point in the cell to obtain a directional gradient histogram; S7066: Grouping the cells to obtain a plurality of feature blocks, and concatenating the directional gradient histograms in the cells in the feature blocks to obtain a block feature vector; S7067: normalizing the block feature vector by using an L2-Norm algorithm to obtain a directional gradient histogram descriptor; S7068: Scanning the target image step by step through a sliding window of a preset window size, and extracting a directional gradient histogram descriptor in the current window; S7069: According to the directional gradient histogram descriptor in the current window, the number of screen residues is identified by using a support vector machine algorithm to determine the number of screen residues.
9. The starch residue detection method according to claim 7, characterized in that: The S708 is specifically: The weight of the residue is determined by subtracting the weight of the constant weight filter paper from the weight of the dry filter paper.
10. The starch residue detection method according to claim 1, characterized in that: The starch purity includes: high-purity starch, medium-purity starch and low-purity starch; Wherein, when the amount of the sieve residue is less than a preset amount and the weight of the sieve residue is less than a preset weight, the starch is determined to be the high-purity starch; Wherein, when the amount of the sieve residue is equal to the preset amount and the weight of the sieve residue is equal to the preset weight, the starch is determined to be the medium-purity starch; When the amount of the residue is greater than the preset amount or the weight of the residue is greater than the preset weight, the starch is determined to be the low-purity starch.
Citation Information
Patent Citations
Feature extraction and fusion recognition of dual-source images based on convolution neural network
CN109308483A
Starch quality evaluation method
CN110618058A
Food impurity detection method and device, electronic equipment and storage medium
CN114445623A
Dough detection device and method based on dough mixer
CN118196100A