A method and device for online detection of corn kernel mold based on deep CNN
The corn kernel mold detection method constructed through deep convolutional neural network solves the problem of low mechanization and automation of corn kernel screening operations, and realizes efficient automatic detection and classification of corn kernel mold.
Patent Information
- Application Number
- CN202211631103.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-19
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-12-19
AI Technical Summary
In the prior art, the degree of mechanization and automation of corn grain screening operations is low, and the early corn grain mold recognition rate is low, resulting in low manual screening efficiency and frequent misjudgment.
The online detection method of corn kernel mold based on deep convolutional neural network is adopted to construct a deep convolutional neural network model through multi-angle image acquisition, adversarial sample generation and data enhancement to realize the automated detection and classification of corn kernel mold.
It has realized the automation of corn kernel mold detection and classification, improved detection efficiency and accuracy, reduced the rate of manual misjudgment, and has the technical advantages of high efficiency and accuracy.
Smart Images

Figure CN115965962B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of agricultural material detection, and specifically relates to an online detection method and device for corn kernel mildew based on a deep convolutional neural network. Background Art
[0002] Corn kernel quality is the foundation of corn cultivation, and high-quality corn kernels directly impact corn yield. With the rapid development of agricultural mechanization technology and equipment in my country, mechanized corn harvesting and threshing have become practical. However, corn can be damaged by squeezing, collisions, and other factors. This damage accelerates kernel mold, affecting germination rates. Damaged kernels are also susceptible to aflatoxin infection, posing a direct threat to human health. Therefore, screening out moldy corn kernels is an effective method for improving kernel quality and is crucial for preventing aflatoxin infection and ensuring food security.
[0003] At present, the traditional method for sorting moldy corn kernels is mainly manual screening. The mechanization and automation level of corn kernel screening operations is still at a low level, and the recognition rate of early moldy corn kernels is low. Summary of the Invention
[0004] The present invention aims to address the technical defects of the existing technology and provide an online detection method and device for corn kernel mildew based on deep convolutional neural network to solve the technical problem of low mechanization and automation level in the current corn kernel screening operation.
[0005] The technical problem to be solved by the present invention is how to realize the automation of detection and classification of moldy corn kernels.
[0006] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0007] The online detection method for corn kernel mold based on deep convolutional neural network includes:
[0008] 1) Collect images of moldy corn kernels and intact corn kernels. Use n cameras at different spatial locations to capture n images of the same corn kernel at different spatial locations. This method collects n corn kernel images at each workstation to form an original dataset for detecting moldy corn kernels. The corresponding n images are used as input to the prediction model. Each group of n images is grouped together, and a moldy feature of the corn kernel is determined for each group of images.
[0009] 2) Collect images of unrelated categories related to moldy corn kernels and construct an unrelated category dataset;
[0010] 3) Add noise to the original dataset to generate a noisy dataset, and merge the irrelevant class dataset and the noisy dataset into an adversarial sample dataset;
[0011] 4) Perform image enhancement processing on the original dataset and the adversarial sample dataset to obtain mixed datasets of different orders of magnitude;
[0012] 5) Divide mixed data sets into different orders of magnitude to obtain training sets and test sets of different orders of magnitude;
[0013] 6) constructing a deep convolutional neural network model, and using the training set as input, performing feature extraction and classification on the input training set, and obtaining different prediction models after training;
[0014] 7) Using a test set to test the prediction model, the prediction model with the highest accuracy is deployed into the image recognition system to implement the corn moldy kernel image classification function.
[0015] Preferably, the number of the collected images of moldy corn kernels and intact corn kernels is at least 1,000 each, the number of the irrelevant class data set is at least 200, and the size of each image is 224×224.
[0016] Preferably, the adding of noise to the original data set includes: adding salt and pepper noise and Gaussian noise; the adversarial sample data set includes an irrelevant class data set and a noise data set; the image enhancement processing includes: random rotation of 90°, 180° and 270°, as well as a maximum left rotation of 25° and a maximum right rotation of 15°.
[0017] Preferably, the mixed data set is divided into different orders of magnitude, including: randomly extracting the data set into a training set and a test set, wherein the training set and the test set are divided in a ratio of 7:3, the ratio of the number of moldy and intact grain images between each order of magnitude is at least 1:2, and at least 5 orders of magnitude are set.
[0018] Preferably, the deep convolutional neural network model comprises at least 5 convolutional layers, 5 activation function layers and 2 maximum pooling layers; the classification layer for feature extraction comprises at least 4 fully connected layers.
[0019] Preferably, the value of n is 4.
[0020] Preferably, the images unrelated to the moldy corn kernels include: dark non-moldy corn kernels, artificially darkened non-moldy corn kernels, and blank background images.
[0021] On the basis of the above technical solution, the present invention further provides a detection device for implementing the above method, including a seed meter, a driving motor, a transmission wheel, a camera, a servo, a fork rack, a guide plate, and a photoelectric sensor; the driving motor drives the seed meter to work through a chain drive, and another driving motor drives the transmission wheel through a belt drive, and the camera, servo, fork rack, guide plate and photoelectric sensor are all fixed on a sub-bracket, and the sub-bracket is fixed on the main bracket.
[0022] Preferably, the transmission wheel includes a cylindrical station and a pulley at the bottom. The cylindrical stations are evenly distributed on the disc. The bottom cover of the cylindrical station is in a normally closed state due to the tension of the reset spring. It moves with the transmission wheel and completes the opening and closing action when it contacts the guide plate. The guide plate is an inverted isosceles triangle with a rounded transition at the top angle.
[0023] Preferably, the main bracket passes through the center of the conveying wheel, and the pulley at the bottom of the conveying wheel and the pulley on the driving motor are tensioned with each other through a flat belt.
[0024] Preferably, four cameras are fixed on four auxiliary brackets respectively, and the four cameras are located directly above four adjacent cylindrical workstations in sequence. When not in operation, the camera lenses are facing the center of the conveyor wheel cylindrical workstation.
[0025] Preferably, the two servos are mounted opposite to each other on the auxiliary bracket, and the output shafts of the two servos are both equipped with pinions meshing with the shift fork racks, and the lowest point of the travel of the shift fork racks shall not exceed the lowest position of the guide rod.
[0026] Based on the above technical solution, the present invention further provides a detection system for implementing the above method, including a detection result statistics and display module, and a detection device working status monitoring module; the detection results include: the number of detected corn kernels, mold rate, intact rate, model prediction results, and confidence level.
[0027] In the present invention, the CNN is the abbreviation of Convolutional Neural Network, which is specially explained.
[0028] The present invention provides a method and device for online detection of corn kernel mold based on a deep convolutional neural network. The detection device includes a seed meter, a drive motor, a transmission wheel, four industrial cameras, two servos, a return spring, a shift fork rack, a guide plate, a guide rod, and a photoelectric sensor. The seed meter is driven by a motor via a transmission chain, and the transmission wheel is driven by a motor via a belt drive. The camera, servo, shift fork rack, guide plate, and photoelectric sensor are all fixed to a secondary support and connected to a main support. The online detection method for corn kernel mold utilizes four cameras at different spatial locations to capture four images of the same corn kernel at different spatial locations. The method proposes an online detection method for corn kernel mold that first generates adversarial samples and then increases the number of training sets incorporating adversarial samples to obtain the optimal accuracy model weight after training. Adversarial samples are generated by collecting irrelevant images and adding noise to images of moldy and intact corn kernels. The corn kernel images are then randomly rotated, enlarged, and reduced to increase the number of training sets. The corn kernel mold detection system controls the seeding and sorting units to ensure that corn kernels land accurately in their workstations. The control system and image recognition system communicate via a serial port. An industrial camera captures fixed-view images of the corn kernels within each workstation and classifies them using a deep convolutional neural network prediction model. The image recognition system transmits the prediction results back to the control system via the serial port, controlling the hardware to sort the moldy kernels, achieving binary classification and automating the detection and classification of moldy corn kernels. The corn kernel mold detection system developed based on this device can efficiently and accurately identify moldy corn kernels.
[0029] This invention replaces manual identification of moldy corn kernels with machine vision technology, addressing the problems of misidentification and the short duration of manual labor during long hours. This invention not only automates the detection and classification of moldy corn kernels but also achieves optimal results by increasing the number of original training sets, offering technical advantages such as high efficiency and accuracy. This invention provides an effective solution for the automatic identification and classification of moldy corn kernels, with significant social and economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a diagram of the online detection method and system for corn kernel mildew based on a deep convolutional neural network of the present invention;
[0031] Figure 2 This is a block diagram of the systems and hardware relationships of the corn kernel mold detection device based on a deep convolutional neural network of the present invention;
[0032] Figure 3 This is a structural diagram of a device for detecting corn kernel mildew based on a deep convolutional neural network according to the present invention;
[0033] Figure 4 A top view of the transmission wheel structure in the embodiment;
[0034] Figure 5 This is a structural diagram of the detection station in the embodiment;
[0035] Figure 6 For the detection system;
[0036] In the picture:
[0037] 1, 2, 3, 4 - industrial cameras; 5 - seed meter; 6 - photoelectric sensor 1; 7 - guide plate; 8 - servo 1; 9 - fork rack; 10 - servo 2; 11 - photoelectric sensor 2; 12, 13, 14, 15, 16, 17, 18, 19 - work stations; 20 - guide rod; 21 - return spring; 22 - trigger rod. DETAILED DESCRIPTION
[0038] The following is a detailed description of specific embodiments of the present invention. To avoid excessive unnecessary detail, well-known structures or functions will not be described in detail in the following examples. Approximate language used in the following examples can be used for quantitative expression to indicate that a certain amount of variation is allowed without changing the basic function. Unless otherwise defined, technical and scientific terms used in the following examples have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0039] A method and device for online detection of moldy corn kernels based on a deep convolutional neural network. The device includes a seed meter, two drive motors, a transmission wheel, four cameras, two servos, a return spring, a shift fork rack, a guide plate, a guide rod, and a photoelectric sensor. The detection method uses a moldy corn kernel prediction model constructed using a convolutional neural network-based online detection method for moldy corn kernels.
[0040] The detection method specifically comprises the following steps:
[0041] (1) Images of moldy corn kernels and intact corn kernels are collected. Four cameras are used at different spatial positions to collect four images of the same corn kernel at different spatial positions. Four corn kernel images are collected at each workstation to form an original data set for detecting moldy corn kernels. The corresponding four images are used as input to the prediction model. Each group of four images is used as a group, and each group of images determines a moldy feature of the corn kernel.
[0042] (2) Collect irrelevant images of moldy corn kernels, such as moldy corn kernel images, empty background images, and other irrelevant images that do not have the characteristics of moldy corn kernels, and construct an irrelevant dataset.
[0043] (3) Add noise to the original dataset to generate a noisy dataset, and merge the irrelevant class dataset and the noisy dataset into an adversarial sample dataset.
[0044] (4) Perform image enhancement on the original dataset and the adversarial sample dataset to obtain mixed datasets of different magnitudes. The enhancement methods include random rotation of 90°, 180°, 270°, and maximum left rotation of 25° and maximum right rotation of 15°.
[0045] (5) Divide mixed data sets of different orders of magnitude to obtain training sets and test sets of different orders of magnitude.
[0046] (6) Constructing a deep convolutional neural network model, and using the training set as input, performing feature extraction and classification on the input training set, and obtaining different prediction models after training.
[0047] (7) Using the test set to test the prediction model, the prediction model with the highest accuracy is deployed into the image recognition system to realize the image classification function.
[0048] Among them, the collected images of moldy corn kernels and intact corn kernels are obtained by placing a single corn kernel in the cylindrical workstation and using the camera to collect the corn kernel image, ensuring that each camera collects each corn kernel image at least once, and collecting at least 1,000 images of moldy kernels and intact corn kernels, and the size of each image is 224×224.
[0049] The collected irrelevant images include images irrelevant to the characteristics of intact corn kernels, including images irrelevant to target category characteristics such as images of empty backgrounds, and the number of the irrelevant images is at least 200.
[0050] The method adds noise to the original dataset, adds salt and pepper noise and Gaussian noise to the images in the original dataset through an image processing method, generates a noise dataset, and merges the irrelevant class dataset and the noise dataset into an adversarial sample dataset.
[0051] The mixed data set of different orders of magnitude is divided into a training set and a test set by randomly extracting from the data set. The training set and the test set are divided in a ratio of 7:3. According to the number of images in each level, at least 5 orders of magnitude are set, and the number ratio between each level is maintained at least 2. Preferably, the constructed deep convolutional neural network model takes the preprocessed training set as input, extracts and classifies the input quantity set, and obtains different prediction models after training, including the following steps:
[0052] Constructing a convolutional neural network, wherein the feature extraction includes at least 5 convolutional layers, 5 activation function layers, and 2 maximum pooling layers, and the classification includes at least 4 fully connected layers;
[0053] Add a Dropout layer after the fully connected layer to prevent the model from overfitting;
[0054] During training, a variable learning rate strategy is adopted, seeking an optimizer with adjustable learning rate and a cross-entropy loss function. The initial learning rate is defined to be no greater than 0.001. The learning rate decays to 0.5 times the original value every time the number of iterations increases by 10 times, and the number of iterations is no less than 100 times.
[0055] Error backpropagation, weight update, and save the optimal model.
[0056] The detection device is designed to provide a platform architecture for the online detection method, combined with mechatronic control to realize the automation of detection and classification of moldy corn kernels. A detection system software with functions such as visualization of corn kernel mold detection, calculation and display of mold rate and intact rate, model prediction results and confidence level has been developed, providing a reference for realizing moldy corn kernel identification and automatic classification.
[0057] Among them, the transmission wheel is composed of a cylindrical workstation and a pulley at the bottom. The cylindrical workstations are evenly distributed on the disc. The bottom cover of the cylindrical workstation is in a normally closed state due to the tension of the reset spring. It moves with the transmission wheel and completes the opening and closing action when it contacts the guide plate. The guide plate is an inverted isosceles triangle with a rounded corner transition at the top angle.
[0058] The main bracket passes through the center of the transmission wheel disc, and the pulley at the bottom of the transmission wheel disc and the pulley on the driving motor are tensioned with each other through a flat belt.
[0059] Four cameras are fixed on four auxiliary brackets respectively. The four cameras are located directly above four adjacent cylindrical workstations in sequence. When not working, the camera lenses face the center of the conveyor wheel cylindrical workstation.
[0060] The two steering gears are mounted opposite to each other on the auxiliary bracket, and the steering gear output shafts are each equipped with a small gear meshing with the shift fork rack. The lowest point of the shift fork rack's travel must not exceed the lowest position of the guide rod.
[0061] The software interface is designed using QtDesigner and written in Python to implement corresponding functions. It is designed to run in dual threads to prevent infinite loop programs from blocking threads. It can count and display the number of detected corn kernels, mold rate and intact rate, model prediction results and confidence, and device working status.
[0062] Combining the above two aspects, the trained optimal prediction model is deployed in the image recognition system. Through the hardware connection with the camera and relying on serial communication to interact with the control system, combined with the mechanical structure of the device, the detection and classification of moldy corn kernels can be automated.
[0063] The following further illustrates how the present invention implements its functions in conjunction with the structural diagram of the detection device.
[0064] The seeding port of the seed metering device 5 is located directly above the work station 16, and the four cameras 1, 2, 3, and 4 are located directly above the work stations 12, 19, 18, and 17 respectively. The servo 1 and the servo 2 are mounted opposite each other on the sub-bracket and are located outside the work station 13. The shift fork rack is engaged with the pinions on the output shafts of the two servos. The guide plate is mounted on the sub-bracket and led out from the main bracket and is located outside the work station 14. The two ends of the reset spring are respectively connected to the work station and the trigger rod. The outward extension of the trigger rod exceeds the maximum circumferential boundary of the transmission wheel.
[0065] The following is an example using station 16 as a reference. The working conditions of all stations are continuous and the principle is the same. After the detection device is powered on, the control system controls the drive motor at the bottom of the wheel to rotate, and drives the entire transmission wheel to rotate in a belt drive manner. When station 16 is directly below the seed meter 5, the trigger rod triggers the photoelectric sensor 1 installed on the side of the seed tube guide of the seed meter to ensure that station 16 reaches the correct position. The control system controls the motor at the bottom of the transmission wheel to stop, controls the drive motor of the seed meter 5 to rotate, and drives the seed meter 5 to perform single-grain seeding in a chain drive manner. At this time, there is a single corn kernel in station 16, and the control system controls the drive motor below the transmission wheel to stop. The motor continues to rotate, bringing station 16 to station 17 in the figure. That is, station 16 is now directly below camera 1. The control system repeats the above control while communicating with the image recognition system in real time via the serial port. The image recognition system controls camera 4 to capture the first image of the corn kernels in station 16. The above control is repeated, driving the motor to continue rotating, bringing station 16 to station 18 in the figure. That is, station 16 is now directly below camera 3. The image recognition system controls camera 3 to capture the second image of the corn kernels in station 16. Similarly, the corn kernels in station 16 will stop directly below cameras 2 and 1 to capture the third and fourth images. That is, four images will be captured of the corn kernels in each station.
[0066] In the image recognition system, four images of corn kernels in each workstation will be used as input one by one, and predictions will be made using the moldy corn kernel prediction model constructed by the online detection method of corn kernel mold based on convolutional neural networks.
[0067] It is stipulated that if the prediction results of at least two images are "moldy grains", the returned result will be "moldy grains", otherwise the returned result will be "intact grains". The prediction results are transmitted back to the control system by the image recognition system through serial communication. Assuming that the returned result is "moldy kernels", when station 16 moves to station 13 in the figure, that is, the working position of the fork rack, the trigger rod triggers the photoelectric sensor 2 installed next to the servo 2, and the control system controls the sorting unit motor 1 to lock, so that the station stops just below the fork rack. The control system receives the result returned by the image recognition system, controls the output shafts of the servo 1 and the servo 2 to rotate, thereby driving the pinions on the two output shafts to rotate clockwise and counterclockwise at the same circumferential speed respectively, and then the fork rack moves downward. The trigger rod stopped below the fork rack is subjected to the external force applied by the fork rack, which exceeds the pulling force of the reset spring on the trigger rod, and the bottom cover of the station opens downward. At this time, the corn kernels in station 16 fall to the position of station 13 in the figure, and the control system controls the servo 1 and the servo 2 to rotate counterclockwise and clockwise at the same circumferential speed respectively, and the fork rack moves upward to complete the reset.
[0068] Assuming the prediction result is "good kernels," when station 16 moves to station 13 in the figure, i.e., the working position of the shift fork rack, the trigger rod triggers photoelectric sensor 2. The control system receives the result returned by the image recognition system and controls motor 1 in the sorting unit to lock, causing the station to stop exactly below the shift fork rack. The output shafts of servos 1 and 2 are controlled to prevent rotation. When the conveyor wheel continues to rotate to the next station, i.e., station 16 stops at station 14 in the figure, i.e., the position of the guide plate. During the movement of the conveyor wheel from station 13 to station 15 in the figure, due to the squeezing force of the guide plate, the trigger rod will first move downward along the guide rod to the lowest point of the guide plate, and the station bottom cover will open downward. The corn kernels predicted as "good kernels" by the image recognition system will slide down to station 14 in the figure due to gravity. Because the trigger rod is always pulled by the return spring, it will move upward along the guide rod, and the station bottom cover will close to complete the reset. At this point, the reference station 16 completes one working cycle, and the remaining stations have the same workflow and principles as the reference station.
[0069] In this invention, during the dataset creation process, an unrelated dataset is added to improve the accuracy of identifying intact and moldy corn kernels. During device operation, four cameras are used to capture four images of the same corn kernel at different spatial locations. These four images are used as input for the prediction model, with each group of four images used to determine a moldy corn kernel feature. This implementation, by adding the input feature of a single corn kernel, improves recognition accuracy. Compared to methods that use a model to determine a decision based on a single image, this reduces the error rate and significantly improves overall accuracy.
[0070] The embodiments of the present invention are described in detail above, but the contents are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the scope of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A device for online detection of corn kernel mildew based on deep CNN, characterized in that: It includes a seed meter, a driving motor, a transmission wheel, a camera, a steering gear, a shift fork rack, a guide plate, and a photoelectric sensor; the driving motor drives the seed meter to work through a chain drive, and another driving motor drives the transmission wheel through a belt drive. The camera, steering gear, shift fork rack, guide plate and photoelectric sensor are all fixed on a sub-bracket, and the sub-bracket is fixed on a main bracket; the seed metering port of the seed meter is located directly above the workstation, and the four cameras are located directly above the four workstations in sequence. The two steering gears are installed oppositely on the sub-bracket, located outside one of the workstations, the shift fork rack and the small gears on the output shafts of the two steering gears are engaged with each other, the guide plate is installed on the sub-bracket and led out from the main bracket, located outside the other workstation, and the two ends of the reset spring are respectively connected to the workstation and the trigger rod, and the outward extension part of the trigger rod exceeds the maximum circumferential boundary of the transmission wheel; After the detection device is powered on, the control system controls the drive motor at the bottom of the wheel to rotate, and drives the entire transmission wheel to rotate in a belt drive manner. When the work station is directly below the seed meter, the trigger rod triggers the photoelectric sensor installed on the side of the seed tube guide port of the seed meter to ensure that the work station reaches the correct position. The control system controls the motor at the bottom of the transmission wheel to stop, controls the drive motor of the seed meter to rotate, and drives the seed meter to perform single-grain seeding in a chain drive manner. At this time, there is a single corn kernel in the work station, and the control system controls the drive motor under the transmission wheel to continue rotating. At this time, the work station is directly below the camera. While the control system repeats the above control, it interacts with the image recognition system in real time through the serial port. The image recognition system controls the camera to collect the first image of the corn kernel in the work station. The above control is repeated, and the drive motor continues to rotate. At this time, the work station is directly below the camera, and the image recognition system controls the camera to collect the second image of the corn kernel in the work station. In the image recognition system, four images of corn kernels in each workstation are used as input one by one, and the moldy corn kernel prediction model constructed by the convolutional neural network-based online detection method for corn kernel mold is used to predict the moldy corn kernels. When the prediction results of at least two images are moldy kernels, the returned result is moldy kernels, otherwise the returned result is intact kernels, and the prediction result is transmitted back to the control system by the image recognition system through serial communication; when the returned result is moldy kernels, the workstation moves to the working position of the fork rack, the trigger rod triggers the photoelectric sensor installed next to the servo, and the control system controls the motor of the sorting unit to lock, so that the workstation stops under the fork rack. The control system receives the result returned by the image recognition system, controls the output shafts of the two servos to rotate, and drives the pinions on the two output shafts to rotate clockwise and counterclockwise at the same circumferential speed respectively, so that the fork rack moves downward, and the trigger rod stopped under the fork rack is subjected to the external force applied by the fork rack, which exceeds the pulling force of the reset spring on the trigger rod, and the bottom cover of the workstation opens downward, and the corn kernels in the workstation fall down. The control system controls the two servos to rotate counterclockwise and clockwise at the same circumferential speed respectively, and the fork rack moves upward to complete the reset; When the predicted result is a good kernel, the workstation moves to the working position of the fork rack, the trigger rod triggers the photoelectric sensor, the control system receives the result returned by the image recognition system, controls the motor lock in the sorting unit, makes the workstation stop just below the fork rack, controls the output shafts of the two servos not to rotate, and when the conveyor wheel continues to rotate to the next workstation, during the movement of the conveyor wheel, the trigger rod first moves downward along the guide rod to the lowest point of the guide plate, the bottom cover of the workstation opens downward, and the corn kernels predicted by the image recognition system as good kernels slide down due to gravity, the trigger rod moves upward along the guide rod, and the bottom cover of the workstation closes to complete the reset.
2. A method for performing online detection of corn kernel mildew using the device of claim 1, characterized in that: include: 1) Collect images of moldy and intact corn kernels. Using n cameras at different spatial locations, capture n images of the same corn kernel at different locations. This allows n corn kernel images to be collected at each workstation to form a raw dataset for detecting moldy corn kernels. These n corresponding images are used as input to the prediction model. Each set of n images is grouped together, and each group of images determines a moldy corn kernel feature. 2) Collect images of unrelated categories related to moldy corn kernels and construct an unrelated category dataset; 3) Add noise to the original dataset to generate a noisy dataset, and merge the irrelevant class dataset and the noisy dataset into an adversarial sample dataset; 4) Perform image enhancement on the original dataset and the adversarial sample dataset to obtain mixed datasets of different orders of magnitude; 5) Divide mixed data sets into different orders of magnitude to obtain training sets and test sets of different orders of magnitude; 6) Constructing a deep convolutional neural network model, and using the training set as input, performing feature extraction and classification on the input training set, and obtaining different prediction models after training; 7) Using the test set to test the prediction model, the prediction model with the highest accuracy is deployed into the image recognition system to implement the corn moldy kernel image classification function.
3. The method according to claim 2, characterized in that The images of moldy corn kernels and intact corn kernels are collected, and the number of each is at least 1,000. The number of the irrelevant class data set is at least 200, and the size of each image is 224×224.
4. The method according to claim 2, characterized in that The adding of noise to the original dataset includes: adding salt and pepper noise and Gaussian noise; the adversarial sample dataset includes an irrelevant class dataset and a noise dataset; the image enhancement processing includes: random rotation of 90°, 180° and 270°, as well as a maximum left rotation of 25° and a maximum right rotation of 15°.
5. The method according to claim 2, characterized in that The mixed data set is divided into different orders of magnitude, including: randomly extracting the data set into a training set and a test set, wherein the training set and the test set are divided in a ratio of 7:3, the ratio of the number of moldy and intact grain images between each order of magnitude is at least 1:2, and at least 5 orders of magnitude are set.
6. The method according to claim 2, characterized in that The deep convolutional neural network model constructed includes at least 5 convolutional layers, 5 activation function layers and 2 maximum pooling layers; the classification layer for feature extraction includes at least 4 fully connected layers.
7. The method according to claim 2, characterized in that The value of n is 4.
8. The method according to claim 2, characterized in that The images irrelevant to the moldy corn kernels include: dark non-moldy corn kernels, artificially darkened non-moldy corn kernels, and blank background images.
9. An online detection system for corn kernel mildew comprising the device of claim 1, characterized in that: It includes a detection result statistics and display module and a detection device working status monitoring module; the detection results include: the number of detected corn kernels, mildew rate, intact rate, model prediction results, and confidence level.
Citation Information
Patent Citations
Rice detection and classification method based on deep multi-view feature
CN108197636A
Defensive adversarial sample method based on combination of image preprocessing and adversarial training
CN112560901A