A method for identifying maize haploid based on CNN-SVM
By automatically extracting maize kernel features and optimizing hyperparameters using the CNN-SVM method, the problems of low accuracy and low automation in existing maize haploid identification methods are solved, achieving efficient and accurate haploid identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGCHUN UNIV OF SCI & TECH
- Filing Date
- 2022-12-27
- Publication Date
- 2026-08-04
AI Technical Summary
Existing methods for identifying haploid maize suffer from problems such as low accuracy, slow speed, high cost, or low automation. In particular, machine vision-based methods are subject to subjective interference during feature extraction, which affects classification accuracy.
A CNN-SVM-based approach was adopted to automatically extract corn kernel image features through a convolutional neural network, combine them with a support vector machine for classification, and use the cuckoo search algorithm to optimize hyperparameters C and gamma to improve classification accuracy.
It achieves efficient and automated identification of maize haploid kernels, improves classification accuracy, avoids overfitting, and enhances the robustness and accuracy of the model.
Smart Images

Figure CN116246270B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of maize haploid identification technology, specifically relating to a maize haploid identification method based on CNN-SVM. Background Technology
[0002] Haploids are cells or individuals possessing only the number of chromosomes found in gametes. Haploid breeding can significantly shorten the breeding cycle and is one of the fastest and most efficient breeding methods in modern plant breeding, playing a crucial role in agricultural breeding. Generally, the natural probability of haploid kernels in maize is less than 0.1%, and even with artificial induction, it can only reach 10%, leading to a relative scarcity of haploid maize kernel resources. Accurately classifying haploid kernels from maize grains is particularly critical for maize breeding.
[0003] There are many methods for detecting haploids, mainly including: morphological identification, molecular marker identification, cytological and anatomical identification, radioactive methods, and genetic marker identification. While morphological and cytological methods offer high accuracy in identifying haploid plants, they are time-consuming and not conducive to the rapid development of superior varieties during breeding. Molecular marker and radioactive methods have high technical requirements and costs, which do not meet practical production needs. Genetic marker methods can identify haploids in the early stages of growth and have lower technical requirements and costs, thus becoming the mainstream method for haploid identification. In maize haploids, the Navajo marker gene R-nj is commonly used. After the marker is introduced, different color characteristics appear in the endosperm and base of haploid and polyploid maize kernels.
[0004] Existing haploid identification methods based on genetic markers include manual identification, nuclear magnetic resonance (NMR), and machine vision. Manual identification methods are highly subjective, slow, and have low accuracy; their low level of automation prevents them from meeting production requirements. NMR methods are also slow, and the equipment is expensive, making them difficult to popularize. Machine vision-based identification methods are fast, highly automated, and suitable for engineering implementation. However, existing machine vision-based maize haploid classification models require manually designed and extracted features such as texture, shape, and color. This feature extraction process is often subject to subjective interference, affecting the accuracy of the model's classification. Summary of the Invention
[0005] To address the problems existing in the prior art, this invention provides a CNN-SVM-based method for identifying maize haploid kernels. This method acquires images of haploid and polyploid maize kernels, creates a dataset using image processing algorithms, automatically extracts features from the maize kernel images using a convolutional neural network, classifies the extracted features using a support vector machine, and optimizes the hyperparameters C and gamma of the support vector machine using a cuckoo search algorithm to improve the accuracy of maize kernel classification.
[0006] This invention is achieved through the following technical solution:
[0007] A CNN-SVM-based method for identifying haploids in maize includes the following steps:
[0008] Step 1: Use image acquisition equipment to acquire multi-kernel images of haploid and polyploid corn kernels;
[0009] Step 2: Use image processing algorithms to process the acquired corn multi-kernel images, automatically cut the multi-kernel images into single-kernel images, and after classification labeling and data augmentation, the single-kernel images are divided into training samples and test samples.
[0010] Step 3: Build a convolutional neural network and input the training sample images into the constructed convolutional neural network for training; the convolutional neural network includes convolutional layers, pooling layers and fully connected layers, uses the ReLU activation function, and uses a sigmoid classifier for classification;
[0011] Step 4: Obtain the CNN model through training:
[0012] The training sample images and image categories obtained in step 3 are input into the CNN model. A sigmoid classifier is used for classification. The error is continuously reduced through backpropagation to adjust the CNN parameters and train the optimal CNN model.
[0013] Step 5: Extract multiple features from the training samples:
[0014] Remove the sigmoid classifier from the CNN model, and then input the training sample images into the CNN model. The CNN model will output multiple image features of the training samples through fully connected layers.
[0015] Step 6: Obtain the SVM model through training:
[0016] Multiple image features of the training samples are used to train the SVM model. During the training process, the Cuckoo Search algorithm is used to automatically determine the optimal hyperparameters C and gamma values of the SVM.
[0017] Step 7: Extract multiple features from the test sample:
[0018] The test sample image is input into the CNN model obtained in step 4. The CNN model outputs multiple features of the test sample through a fully connected layer.
[0019] Step 8: Output the classification results:
[0020] The multiple features of the test sample are input into the SVM model obtained in step 6, and the classification result of the test image is output.
[0021] Furthermore, the image acquisition device in step 1 includes: an industrial camera, an LED light source, a stage, a bracket, and a computer; each multi-grain image includes 20 corn kernels in 4 rows and 5 columns, with 15 images acquired for haploid kernels and 15 images for polyploid kernels respectively, and the acquired images are saved in JPEG format in the image acquisition device.
[0022] Furthermore, the image processing algorithm described in step 2 specifically includes thresholding, dilation, background removal, region of interest bounding matrix operation, and image cropping.
[0023] The thresholding process is used to perform preliminary segmentation on the original color corn kernel image;
[0024] The dilation operation is used to remove irrelevant isolated points, breakpoints, spikes, holes, and other noise from the image after threshold segmentation.
[0025] The background removal operation is used to eliminate the background area outside the seed image;
[0026] Furthermore, the threshold processing formula is as follows:
[0027]
[0028] In the formula, f(i,j) represents the gray value of the input image at that point, g(i,j) represents the gray value of the output image at that point, and T is the selected threshold.
[0029] The expansion operation is defined as follows:
[0030]
[0031] The expansion process first obtains the image of B relative to its own origin, which is A. Then its image is shifted according to the value of x, so that The intersection with A is not an empty set.
[0032] Furthermore, the data augmentation in step 2 specifically involves enhancing the corn kernel image dataset through rotation or flipping operations, and dividing the image dataset into a training set and a test set in a 6:4 ratio.
[0033] Furthermore, in step 6, the Cuckoo Search algorithm is used to optimize the SVM parameters. The specific steps are as follows:
[0034] Step A: Define the objective function g(NEST), set the maximum acceptable value of g(NEST) to g(Tol), the maximum number of iterations T, and initialize the population; where NEST = (NEST1, ..., NEST) n ), where n represents the number of parasitic nests, NEST i =(x1,…,x m ), where m represents the original number of eggs in each parasitic nest, i.e., the dimension of the solution space; in the SVM parameter optimization process, the values of C and gamma are solved, so NEST is set. i =(x c ,x g ), x c and x g These represent the values of C and gamma, respectively.
[0035] Step B: Calculate the objective function value g(NEST) for each parasitic nest. i ), and record the current optimal solution, that is, the smallest g(NEST). i );
[0036] Step C: Among them, NEST i (t) Let represent the position of the i-th parasitic nest in generation t, α be the step size control parameter, and L be the Levy random search path. Where μ and ν follow a normal distribution and:
[0037] g best This indicates the best parasitic nest currently available;
[0038] The positions of other parasitic nests are updated according to the above formula. If the objective function value of the new generation is better than that of the previous generation, then the previous optimal solution is replaced and becomes the new optimal solution. That is, the NEST is updated according to the Levy flight algorithm. i If a value smaller than the current g(NEST) is found, i When ), replace it;
[0039] Step D: Design a random number r and a random number P a Compare, if r > P a Then, the current location of the parasitic nest is randomly changed, resulting in a new set of locations, i.e., a new set of g(NEST). i );
[0040] Step E: If g(NEST) iIf g(Tol) ≤ g(Tol), then output the optimal solution; otherwise, jump back to step C and continue iterating until iteration number t = T, then output the current g(NEST) value. i The optimal solution is obtained by finding the optimal C and gamma.
[0041] Compared with the prior art, the advantages of the present invention are as follows:
[0042] 1. This invention utilizes the strong feature representation capability of CNN to automatically extract features from corn kernel images; using CNN to extract features from corn kernel images to identify haploid corn kernels provides stronger robustness.
[0043] 2. This invention uses the SVM algorithm to replace the sigmoid classifier in CNN to classify corn kernel images, thus avoiding the overfitting phenomenon caused by small sample size in CNN;
[0044] 3. In the training process of SVM, this invention uses the Cuckoo Optimization Algorithm to automatically find the optimal hyperparameters C and gamma, thereby improving the accuracy of SVM classification. Attached Figure Description
[0045] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.
[0046] Figure 1 This is a flowchart illustrating a CNN-SVM-based method for identifying haploid maize according to the present invention.
[0047] Figure 2 This is a schematic diagram of the image acquisition device of the present invention;
[0048] Figure 3 This is a schematic diagram of the dataset processing flow of the present invention;
[0049] Figure 4 This is a schematic diagram of the CNN-SVM model structure of the present invention;
[0050] In the diagram: 1. Stage; 2. Bracket; 3. Industrial camera; 4. LED light source. Detailed Implementation
[0051] To clearly and completely describe the technical solution and its specific working process of the present invention, the specific embodiments of the present invention are as follows, in conjunction with the accompanying drawings:
[0052] Example 1
[0053] like Figure 1 The diagram shown is a flowchart of a CNN-SVM-based method for identifying haploid maize in this embodiment. The identification method specifically includes the following steps:
[0054] Step 1, use as follows Figure 2 The device shown acquires images of corn kernels;
[0055] The stage is designed to stably hold corn kernels for easy photography, while the bracket is used to fix the industrial camera and two LED lights on top of the stage. The industrial camera is connected to the computer via a USB data cable, and the computer uses drivers and third-party image management software to control the industrial camera to capture and save images.
[0056] First, images of corn kernels were acquired in a dark, indoor environment. Two LED lights on top of the stage reduced the impact of external light on image acquisition, ensuring image quality and uniformity through controlled illumination. The shooting distance of the industrial camera was controlled by adjusting the length of the support, and the camera was positioned orthogonally to the plane containing the corn kernels. After adjusting the lighting and shooting range, an A4 sheet of paper was placed on the stage as a background, using a white background to make the corn kernels easier to distinguish from the background. The corn kernels to be acquired were placed on the stage, arranged in a 4x5 row sequence to speed up image acquisition. Each acquired image contained 20 corn kernels, with 15 images acquired for haploid kernels and 15 for polyploid kernels. The acquired images were saved as JPEG format on the computer.
[0057] Step 2, refer to Figure 3 The process described in this invention uses single-kernel corn images for classification and recognition. Therefore, it is necessary to automatically segment the single-kernel images from the acquired multi-kernel images and perform image category labeling and data augmentation for experimental use. The specific method is as follows:
[0058] (1) First, the original color corn kernel image is converted to grayscale. Since there is a significant difference between the grayscale region where the corn kernel is located and the background, it can be preliminarily segmented after thresholding.
[0059] (2) Use the dilation operation in morphological algorithms to remove irrelevant isolated points, breakpoints, burrs and holes in the image after threshold segmentation;
[0060] (3) Perform an AND operation between the thresholded image and the original image to eliminate the background area outside the seed image. Use the minimum bounding matrix method to obtain the length, width and four vertex coordinates of the minimum bounding matrix of the corn kernel.
[0061] (4) In order to ensure the integrity of the corn kernels, the minimum outer matrix is expanded outward by 5 pixels to cut out a single corn kernel image.
[0062] (5) Label the image categories of haploid and polyploid kernels, perform appropriate image enhancement operations such as rotation and flipping, expand the number of corn kernel images to 1000, and haploid and polyploid images to 500 each; divide them into training set and test set according to a 6:4 ratio.
[0063] Step 3: Use training sample images as input to train the constructed convolutional neural network.
[0064] The constructed convolutional neural network includes:
[0065] Four convolutional layers are used, employing 3x3 convolutional kernels. The number of kernels is 32, 64, 128, and 128 respectively. The image input structure is 200x200x3, and the output structures of the convolutional layers are 198x198x32, 97x97x64, 46x46x128, and 21x21x128 respectively. The ReLU activation function is selected.
[0066] Four pooling layers, using max pooling operation;
[0067] Two fully connected layers, with 128 and 32 output features respectively, using the ReLU activation function;
[0068] Finally, the sigmoid classifier is used for classification;
[0069] During training, 15 epochs are set, the learning rate is 0.001, the binary cross-entropy loss function is used, and the optimal model is saved during training.
[0070] Step 4: Remove the sigmoid classifier from the optimal CNN model saved in Step 3, save the CNN model without the classifier, and use it as a feature extractor; then input the training sample images into the newly saved CNN model, the CNN model outputs 32 image features of the training samples through the fully connected layer, and save these feature data;
[0071] Step 5: Input the 32 image features of the training samples saved in Step 4 into the SVM classifier. The kernel function of the SVM is the RBF kernel.
[0072] The core principle of SVM classification is:
[0073] Let the sample set be (x i ,y i x), where i = 1, 2, ..., 32. i It uses 32 features extracted through a CNN network, y iThese are the category numbers of corn kernels. The optimal hyperplane for classification, obtained through margin maximization learning, is:
[0074] ω·x+b=0
[0075] In the formula, ω is the normal vector, which determines the direction of the hyperplane. b is the displacement, which determines the distance between the hyperplane and the origin. The general form of the corresponding linear classification function is:
[0076] f(x) = ω·x + b
[0077] At the same time, the optimal hyperplane satisfies the following for all sample points:
[0078] |f(x)|≥1
[0079] The values of hyperparameters C and gamma in a support vector machine (SVM) affect the final classification accuracy. Therefore, a cuckoo search algorithm is added during the SVM training process to optimize hyperparameters C and gamma and automatically find the optimal SVM model.
[0080] When using the cuckoo search algorithm, three idealized states need to be assumed:
[0081] 1. A cuckoo lays only one egg at a time and randomly selects a parasitic nest to incubate it;
[0082] 2. Among the randomly selected parasitic nests, the best nest will be preserved to the next generation;
[0083] 3. The number of available parasitic nests is n, and the probability of them being discovered by the host is P. a If the egg is found by the host within the range [0,1], the host will push the cuckoo's egg out of the nest. Therefore, this assumption can be understood as the probability of the egg being replaced by a new nest being P. a ∈[0,1].
[0084] In this algorithm, it is assumed that each parasitic nest contains several eggs, each representing a solution, while the cuckoo's egg represents a new, potentially better solution to replace the original, less desirable solution.
[0085] In this embodiment, the specific steps for optimizing SVM parameters using the cuckoo search algorithm are as follows:
[0086] Step A: Define the objective function g(NEST), set the maximum acceptable value of g(NEST) to g(T o)l, the maximum number of iterations T, and initialize the population. Where NEST = (NEST1, ..., NEST...) n ), indicating the number of parasitic nests, NEST i =(x1,…,x m), where m represents the original number of eggs in each parasitic nest, i.e., the dimension of the solution space. In the SVM parameter optimization process, the values of C and gamma are being solved, so NEST is set. i =(x c ,x g ), x c and x g These represent the values of C and gamma, respectively. In this embodiment, the maximum number of iterations is set to 20, the range of C and gamma is set to (0.01, 10], the step size is set to 0.4, the number of parasitic nests is set to 20, and P... a Set to 0.25;
[0087] Step B: Calculate the objective function value g(NEST) for each parasitic nest. i ), and record the current optimal solution, that is, the smallest g(NEST). i );
[0088] Step C: NEST i (t) Let represent the position of the i-th parasitic nest in generation t, α be the step size control parameter, and L be the Levy random search path. Where μ and ν follow a normal distribution and:
[0089] g best This indicates the best parasitic nest currently available.
[0090] The positions of other parasitic nests are updated according to the above formula. If the objective function value of the new generation is better than that of the previous generation, then the previous optimal solution is replaced and becomes the new optimal solution. That is, the NEST is updated according to the Levy flight algorithm. i If a value smaller than the current g(NEST) is found, i When ), replace it;
[0091] Step D: Design a random number r and a random number P a Compare, if r > P a Then the current location of the parasitic nest is randomly changed, resulting in a new set of locations, i.e., a new set of g(NEST). i );
[0092] Step E: If g(NEST) i If g(Tol) ≤ g(Tol), output the optimal solution; otherwise, jump back to step 3 and continue iterating until iteration number t = T, then output the current g(NEST) value. i The optimal solution is obtained by finding the optimal C and gamma.
[0093] Finally, the value of C was determined to be 9.68, and the value of gamma was 0.43.
[0094] Step 6, refer to Figure 4 The test sample images are input into the finally saved convolutional neural network, passing through its convolutional layer C1, pooling layer P1, convolutional layer C2, pooling layer P2, convolutional layer C3, pooling layer P3, convolutional layer C4, pooling layer P4, fully connected layer D1, and fully connected layer D2 in sequence to obtain a 1*32 feature vector of the test image. The feature vector of the test sample is then input into the optimal SVM model saved in step 5, and the SVM model is used to predict the image category. The final algorithm model achieves an accuracy of 95.25% in the recognition of 400 corn kernel test images.
[0095] The preferred embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the specific details of the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solution of the present invention, and these simple modifications all fall within the protection scope of the present invention.
[0096] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present invention will not describe the various possible combinations separately.
[0097] Furthermore, various different embodiments of the present invention can be combined in any way, as long as they do not violate the spirit of the present invention, they should also be regarded as the content disclosed by the present invention.
Claims
1. A method for identifying haploids in maize based on CNN-SVM, characterized in that, Specifically, the steps include the following: Step 1: Use image acquisition equipment to acquire multi-kernel images of haploid and polyploid corn kernels; Step 2: Use image processing algorithms to process the acquired corn multi-kernel images, automatically cut the multi-kernel images into single-kernel images, and after classification labeling and data augmentation, the single-kernel images are divided into training samples and test samples. Step 3: Build a convolutional neural network and input the training sample images into the constructed convolutional neural network for training; the convolutional neural network includes convolutional layers, pooling layers and fully connected layers, uses the ReLU activation function, and uses a sigmoid classifier for classification; Step 4: Obtain the CNN model through training: The training sample images and image categories obtained in step 3 are input into the CNN model. A sigmoid classifier is used for classification. The error is continuously reduced through backpropagation to adjust the CNN parameters and train the optimal CNN model. Step 5: Extract multiple features from the training samples: Remove the sigmoid classifier from the CNN model, and then input the training sample images into the CNN model. The CNN model will output multiple image features of the training samples through fully connected layers. Step 6: Obtain the SVM model through training: Multiple image features of the training samples are used to train the SVM model. During the training process, the Cuckoo Search algorithm is used to automatically determine the optimal hyperparameters C and gamma values of the SVM. Step 7: Extract multiple features from the test sample: The test sample image is input into the CNN model obtained in step 5 without the sigmoid classifier. The CNN model outputs multiple features of the test sample through a fully connected layer. Step 8: Output the classification results: The multiple features of the test sample are input into the SVM model obtained in step 6, and the classification result of the test image is output. The image processing algorithm described in step 2 specifically includes thresholding, dilation, background removal, region of interest bounding matrix operation, and image cropping. The thresholding process is used to perform preliminary segmentation on the original color corn kernel image; The dilation operation is used to remove irrelevant isolated points, breakpoints, burrs, and hole noise from the image after thresholding. The background removal operation is used to eliminate background areas outside the test image; In step 6, the Cuckoo Search algorithm is used to optimize the SVM parameters. The specific steps are as follows: Step A: Define the objective function Set the maximum allowed The value is Maximum number of iterations Initialize the population; among which , Indicates the number of parasitic nests. , This represents the original number of eggs in each parasitic nest, i.e., the dimension of the solution in space; In the SVM parameter optimization process, the values of C and gamma are solved, so the parameters are set as follows: , and These represent the values of C and gamma, respectively. Step B: Calculate the objective function value for each parasitic nest. And record the current optimal solution, that is, the smallest one. ; Step C: ,in, Indicates the first The parasitic nest was in the first The position of the era, These are step size control parameters. for Random search path, and , ;in , Follows a normal distribution. , ,and: , This indicates the best parasitic nest currently available; The positions of other parasitic nests are updated according to the above formula. If the objective function value of the new generation is better than that of the previous generation, then the new optimal solution replaces the previous one. Flight algorithm update If a value smaller than the current value is found... When, replace it; Step D: Design a random number generator and If a comparison is made, Then, the current location of the parasitic nest is randomly changed, resulting in a new set of locations, i.e., a new set of locations. ; Step E: If If the solution is found to be optimal, output the optimal solution; otherwise, return to step C and continue iterating until the specified number of iterations is reached. Output the current This is the optimal solution, meaning we obtain the optimal C and gamma.
2. The method for identifying maize haploids based on CNN-SVM as described in claim 1, characterized in that, The threshold processing formula is as follows: ; In the formula, This represents the grayscale value of that point in the input image. This represents the grayscale value of that point in the output image. For the selected threshold; The expansion operation is defined as follows: ; The expansion process first obtains The image relative to its own origin Then its image is based on The value is shifted so that and The intersection of these sets is not an empty set; The data augmentation in step 2 specifically involves enhancing the corn kernel image dataset through rotation or flipping operations, and then dividing the image dataset into training and test sets in a 6:4 ratio.
3. The method for identifying maize haploids based on CNN-SVM as described in claim 1, characterized in that, The image acquisition device in step 1 includes an industrial camera, an LED light source, a stage, a bracket, and a computer. Each multi-grain image includes 20 corn kernels in 4 rows and 5 columns. 15 images are acquired for haploid kernels and 15 images are acquired for polyploid kernels. The acquired images are saved in JPEG format in the image acquisition device.