Convolutional neural network-based species image two-step classification method
Through a two-step classification method based on convolutional neural networks, using multiple 3x3 convolution kernels and improved pooling layers, the high computational complexity and overfitting problems of traditional deep learning methods in image classification are solved, and species classification is achieved. More efficient model training and more accurate recognition results in image classification.
Patent Information
- Application Number
- CN202410786681.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-09-17
AI Technical Summary
Traditional deep learning methods have problems of high computational complexity, high energy consumption and over-fitting in image classification, especially when the amount of data is limited, causing the model to perform well on the training set but not on unseen test data. Performance degrades.
A two-step classification method based on convolutional neural networks is used. First, a species classification model is established, and image classification is performed through multiple convolution blocks and pooling layers. Then a subspecies classification model is established based on the results of the major categories, and an improved pooling layer is used. sort_pool2d and batch normalization layer BN, and add a classification output layer adaptive enhancement classifier Adaboost between the convolution layer and the pooling layer, share the convolution layer parameters, and use multiple 3x3 convolution kernels to reduce the number of parameters and increase non- Linear capabilities.
Parameter sharing accelerates the convergence of the model in subdivided areas, reduces the risk of over-fitting, improves network performance without increasing the amount of calculations, shortens training time and computing resource consumption, and improves the accuracy of image classification. and efficiency.
Smart Images

Figure CN118657995A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing and analysis, and in particular to a two-step species image classification method based on a convolutional neural network. Background Art
[0002] Using convolutional neural networks to identify animal images is a development trend in visual recognition in recent years. However, this task is challenging. On the one hand, the differences between some species are often very small, which may be only a slight difference in color, a slight change in texture, or a slight change in some local features. On the other hand, traditional methods may not be able to effectively capture the complex and high-dimensional features required for sub-classification. Although deep learning methods have improved in this regard, they still require detailed network structure design and adjustment for specific tasks.
[0003] To address these issues, researchers have proposed applying deep learning to species classification. Traditional image classification methods rely on manual feature extraction, which may be limited in capturing subtle differences. Deep learning methods, especially convolutional neural networks (CNNs), can automatically learn hierarchical feature representations of images to better capture subtle differences between species. Through multiple layers of nonlinear transformations, deep learning models can recognize and learn complex image features, including subtle changes in color, texture, and local features. However, deep learning models, especially convolutional neural networks, have a large number of parameters and are prone to overfitting on training data, especially when the amount of data is limited. Overfitting can cause the model to perform well on the training set, but degrade on unseen test data. At the same time, the computational complexity of deep learning models is high, and model training usually requires a lot of computing resources and storage space, which may limit its application in resource-constrained environments.
[0004] Therefore, there is an urgent need for a method that can solve the problems of high computational complexity, high energy consumption and overfitting in traditional deep learning methods in image classification. Summary of the invention
[0005] The present invention proposes a two-step species image classification method based on convolutional neural network, which solves the problems of high computational complexity, high energy consumption and overfitting in traditional deep learning methods in image classification.
[0006] To solve the above technical problems, the present invention provides a two-step species image classification method based on a convolutional neural network, comprising the following steps:
[0007] Step S1: establishing a species classification model, wherein the species classification model includes a plurality of convolution blocks, each of which includes a plurality of convolution layers and a pooling layer, inputting a species image to be identified into the species classification model, and obtaining a classification result of the species image;
[0008] Step S2: Establish multiple subspecies classification models based on the classification results of the major species categories, input the species images after the major species category classification into the corresponding subspecies classification models, and obtain the subspecies classification results of the species images.
[0009] Preferably, the subspecies classification model adopts an improved pooling layer sort_pool2d.
[0010] Preferably, the subspecies classification model adds a batch normalization layer BN between the convolution layer and the pooling layer.
[0011] Preferably, the subspecies classification model further includes a classification output layer, and the classification output layer adopts an adaptive boost classifier Adaboost.
[0012] Preferably, the species category classification model and the subspecies classification model share the parameters of the convolutional layer.
[0013] Preferably, the convolution layer adopts a 3x3 convolution kernel, and the pooling layer adopts a 2x2 pooling kernel.
[0014] Preferably, step S1 also includes a model training step, including the following steps:
[0015] Step S11: labeling the species category and subspecies for each species image to be trained;
[0016] Step S12: inputting the labeled species image to be trained into the species classification model for training to obtain the classification results of the species categories;
[0017] Step S13: Assign the classification results of the major species categories to different subspecies classification models for training to obtain subspecies subdivision results.
[0018] The present invention also provides an electronic device, comprising: a memory, a processor and a computer program, wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the above-mentioned two-step species image classification method based on convolutional neural network.
[0019] The present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is executed by a processor to implement the above-mentioned two-step classification method for species images based on convolutional neural networks.
[0020] The benefits of the present invention include at least:
[0021] 1. Through the two-step classification method, the subspecies classification model is trained on the basis of parameter sharing, which speeds up the convergence of the model in the subdivision field and shortens the training time;
[0022] 2. Using multiple small convolution kernels can greatly reduce the number of network parameters, thereby reducing the risk of overfitting, and multiple 3x3 convolution kernels connected in series can form a convolution kernel with a larger receptive field and stronger nonlinear ability; therefore, using multiple 3x3 convolution kernels can increase the receptive field without increasing the amount of calculation and improve the performance of the network. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A schematic diagram of a method flow chart of an embodiment of the present invention;
[0024] Figure 2 A schematic diagram of a classification model according to an embodiment of the present invention;
[0025] Figure 3 This is a schematic diagram of the structure of a species classification model in an embodiment of the present invention;
[0026] Figure 4 It is a schematic diagram of the structure of the subspecies classification model in an embodiment of the present invention;
[0027] Figure 5 A schematic diagram of parameter sharing between a species category classification model and a subspecies classification model according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.
[0029] like Figure 1 and Figure 2 As shown, the present invention provides a two-step species image classification method based on a convolutional neural network, comprising the following steps:
[0030] Step S1: Establish a species classification model. The species classification model includes multiple convolution blocks, each convolution block includes multiple convolution layers and a pooling layer. Input the species image to be identified into the species classification model to obtain the species image classification result.
[0031] Specifically, the major categories of species are identified through a neural network model. The model uses continuous 3x3 small convolution kernels and pooling layers to build a deep neural network. The network depth is 13 layers, which is composed of multiple convolution layers and pooling layers stacked alternately. Finally, a fully connected layer is used for classification.
[0032] like Figure 3The figure shows the structure diagram of the species classification model of the present invention. The input (224x224RGB image) refers to a color image with a size of 224x244 and 3 channels, i.e. 224x224x3. Conv3-64 means that the dimension of the image becomes 64 after three layers of convolution, and Conv3-128 means that the dimension of the image becomes 128 after three layers of convolution. Maxpool refers to maximum pooling, and pooling adopts a 2x2 maximum pooling method. FC-4096 means that there are 4096 nodes in the fully connected layer, and FC-1000 means that there are 1000 nodes in the fully connected layer.
[0033] The model includes 4 convolution blocks, three fully connected layers and a classification output layer. Block 1 contains 2 64x3x3 convolution layers; block 2 contains 2 128x3x3 convolution layers; block 3 contains 3 256x3x3 convolution layers; block 4 contains 3 512x3x3 convolution layers. All convolution layers use 3x3 convolution kernels and 2x2 pooling kernels. Finally, the activation function softmax is used to output the posterior probabilities of 1000 classes.
[0034] The specific process after inputting the species image to be identified into the neural network model is as follows:
[0035] (1) The input image size is 224x224x3, and it is convolved by 64 3x3 convolution kernels with 3 channels. The sliding step size of each convolution layer is 1. After the same padding is filled, convolution is performed twice, and then activated by the activation function ReLU, the output size is 224x224x64. Padding refers to filling n circles outside the matrix. Padding = 1 means filling 1 circle. A 5X5 matrix becomes 7X7 after filling one circle.
[0036] (2) After max pooling, the filter is 2x2, the step size is 2, the image size is halved, and the size after pooling becomes 112x112x64.
[0037] (3) After 128 3x3 convolution kernels, two convolutions, and ReLU activation, the size becomes 112x112x128. After maxpooling, the size becomes 56x56x128.
[0038] (4) After 256 3x3 convolution kernels, three convolutions, and ReLU activation, the size becomes 56x56x256. After maxpooling, the size becomes 28x28x256.
[0039] (5) After 512 3x3 convolution kernels, three convolutions, and ReLU activation, the size becomes 28x28x512. After maxpooling, the size becomes 14x14x512.
[0040] (6) Then, the data is flattened into a vector through the dimensionality reduction function Flatten(), becoming a one-dimensional vector of 512x7x7=25088.
[0041] (7) It then passes through three fully connected layers with two layers of 1x1x4096 and one layer of 1x1x1000, and is activated by ReLU.
[0042] (8) Finally, 1000 prediction results are output through the activation function softmax.
[0043] Using multiple convolutional layers with smaller convolutional kernels instead of larger convolutional layers with convolutional kernels can reduce parameters on the one hand, which is equivalent to more nonlinear mappings, thereby increasing the fitting expression ability:
[0044] A 3x3 convolution kernel has 9 weight parameters, while a 5x5 convolution kernel requires 25 weight parameters, so using a 3x3 convolution kernel can significantly reduce the number of parameters of the network, thereby reducing the risk of overfitting. Two consecutive 3x3 convolutions are equivalent to a 5x5 receptive field, and three are equivalent to 7x7. The advantages of using three 3x3 convolutions instead of one 7x7 convolution are twofold: first, it includes three ReLu layers instead of one, making the decision function more discriminative; second, it reduces parameters. Multiple 3x3 convolution kernels connected in series can form a convolution kernel with a larger receptive field, and this combination has stronger nonlinear capabilities. Using a 3x3 convolution kernel multiple times is equivalent to using a larger convolution kernel, which can improve the feature extraction ability of the network. A 3x3 convolution kernel can obtain the same receptive field as a 5x5 convolution kernel with a step size of 2 through a convolution operation with a step size of 1, but with less computation. Therefore, the network uses multiple 3x3 convolution kernels, which can increase the receptive field without increasing the amount of computation and improve the performance of the network.
[0045] The 1x1 convolution layer in the fully connected layer can increase the nonlinearity of the decision function without affecting the receptive field of the convolution layer, because the 1x1 convolution operation is linear, but ReLu increases nonlinearity.
[0046] Step S2: Establish multiple subspecies classification models based on the classification results of major species categories. The subspecies classification model adopts the improved pooling layer sort_pool2d, and adds a batch normalization layer BN between the convolution layer and the pooling layer in the convolution block. The species image after species category classification is input into the corresponding subspecies classification model to obtain the subspecies classification results of the species image.
[0047] After the first step of identifying and classifying the species of animal images, the main task of the model in the second step is to further subdivide the same species into different subspecies. For the subspecies classification task, this solution uses a relatively special neural convolutional network model to achieve it. The special structural function of this model can more keenly abstract the subtle differences between different subspecies. The structure is as follows Figure 4 shown.
[0048] This neural network model uses a new pooling layer sort_pool2d pooling, which effectively reduces network parameters while ensuring that the model's ability to extract features remains unchanged, avoiding the problem of the maximum pooling layer filtering out too many layers of activation function information.
[0049] The model adds a batch normalization (BN) layer after the convolution layer to improve the standardization of the network structure. To ensure that the machine learning model is more suitable for actual classification situations, it is necessary to normalize the different features of the samples so that the data processed by the BN layer is limited to a reasonable range. Usually the BN layer is added before the activation function, so that more data falls into the sensitive area of the activation function, which is conducive to the realization of data nonlinearity. The batch-normalized data can be transmitted more effectively in the network and reduce the occurrence of gradient diffusion. The BN layer uses certain means to force the dispersed data back to the normal field through the BN layer technology, presenting a normal distribution with a mean of 0 and a variance of 1. Adding a batch normalization layer can greatly improve the training speed and quality of the convolutional neural network.
[0050] The model uses the adaptive enhanced Adaboost classifier with better classification effect. The working principle of the Adaboost classifier is to train multiple different weak classifiers for a training set, and each time combine the wrong samples in the last training with new samples to retrain a new classifier, and finally form a stronger classifier for model classification. The Adaboost classifier has high accuracy, can use different classification algorithms as weak classifiers, and fully consider the weight of each classifier.
[0051] The embodiment of the present invention also includes model training practice. The model in the first step and the model in the second step are similar in structure. Since the main purpose of the model in the second step is to subdivide species, the model parameters that have converged in the first step are used for model training in the second step. This is similar to using the parameters of the pre-trained model, which can speed up the convergence of the model and greatly reduce the amount of training data required. The powerful reasoning and induction ability of the neural network model is utilized, while taking into account the different focuses and key reasoning feature points of species / subspecies identification, and a two-step method is used to achieve the ultimate goal.
[0052] The neural network model structure used in the first step is more suitable for the identification and classification of large categories of species. Feature abstraction and extraction only needs to focus on learning relatively macroscopic features such as species appearance and color.
[0053] The neural network model used in the second step adjusts the network structure and classifier, focusing on strengthening the ability to summarize details, so that it has stronger observation, learning and abstraction capabilities for detailed features, and finally completes the identification of subspecies.
[0054] The two-step method uses two models in series. The two main models have different tasks, so they can perform targeted parameter model tuning, reduce training data, and reduce model training time. At the same time, the two models share parameters. The model used in the second step is based on the parameters of the model used in the first step, which have converged, and is trained based on the subspecies data set. In this way, the neural network avoids abstracting and generalizing from a large amount of irrelevant data.
[0055] The specific operation methods of model training practice are as follows:
[0056] 1. Attach classification labels to image data: Each image data has two labels, one is the species category label, and the other is the subspecies label.
[0057] 2. Input the labeled image data into the first step classification model for training. In this step, the model is fitted using the species category labels.
[0058] 3. The classification model in the second step will assign the data to different subspecies classification models based on the recognition results of the first step. Each subspecies classification model needs to be trained independently in order to more accurately process and identify the data of their respective categories.
[0059] 4. Training of subspecies classification model in the second step: Figure 5 As shown in the figure, each subspecies classification model shares the parameters of the first four convolutional layers with the species classification model trained and optimized in the first step, and freezes the parameters during training. The training of the subspecies classification model is completed by using the same species category image data with different subspecies labels. This means that during training, the model focuses on learning how to distinguish different subspecies based on the subspecies features in the image, and these image data all belong to the same larger species category. The purpose of this is to narrow the scope of model learning and avoid overfitting.
[0060] The present invention provides a two-step classification method for species images based on convolutional neural networks, aiming to solve the high computational complexity, high energy consumption and overfitting problems of traditional deep learning methods in image classification. For the special problem of species segmentation image recognition, conventional classification neural network models are difficult to achieve subdivision of biological subspecies. The method of the present invention improves the convergence speed and classification accuracy of the model in the segmentation field by dividing the image classification task into two stages.
[0061] This method effectively improves the accuracy and efficiency of species image classification through a phased strategy, especially when dealing with species with multiple subspecies. Through the two-step method, the model can reduce the consumption of computing resources and training time while maintaining high classification accuracy. The two-step classification scheme avoids the contradiction between the macro-abstraction and detail-abstraction parameters of the neural network model. By training the model on the basis of parameter sharing, it speeds up the convergence of the model in a certain subdivision field, shortens the model training time, and ultimately achieves high-precision classification effects for professional field image classification.
[0062] The present invention also provides an electronic device, comprising: a memory, a processor and a computer program, wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the above-mentioned two-step species image classification method based on convolutional neural network.
[0063] The present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is executed by a processor to implement the above-mentioned two-step classification method for species images based on a convolutional neural network.
[0064] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is more specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. As long as there is no contradiction in the combination of these technical features, they should be considered as the scope recorded in this specification.
[0065] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A two-step species image classification method based on convolutional neural network, characterized by: The following steps are involved: Step S1: establishing a species classification model, wherein the species classification model includes a plurality of convolution blocks, each of which includes a plurality of convolution layers and a pooling layer, inputting a species image to be identified into the species classification model, and obtaining a classification result of the species image; Step S2: Establish multiple subspecies classification models based on the classification results of the major species categories, input the species images after the major species category classification into the corresponding subspecies classification models, and obtain the subspecies classification results of the species images.
2. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: The subspecies classification model adopts an improved pooling layer sort_pool2d.
3. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: The subspecies classification model adds a batch normalization layer BN between the convolutional layer and the pooling layer.
4. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: The subspecies classification model also includes a classification output layer, and the classification output layer uses an adaptive boost classifier Adaboost.
5. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: The species classification model and subspecies classification model share the parameters of the convolutional layer.
6. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: The convolution layer uses a 3x3 convolution kernel, and the pooling layer uses a 2x2 pooling kernel.
7. The two-step species image classification method based on convolutional neural network according to claim 1, characterized in that: Step S1 also includes a model training step, including the following steps: Step S11: labeling the species category and subspecies for each species image to be trained; Step S12: inputting the labeled species image to be trained into the species classification model for training to obtain the classification results of the species categories; Step S13: Assign the classification results of the major species categories to different subspecies classification models for training to obtain subspecies subdivision results.
8. An electronic device comprising: A memory, a processor and a computer program, characterized in that: the computer program is stored in the memory and is configured to be executed by the processor to implement the two-step species image classification method based on convolutional neural network as described in claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the two-step species image classification method based on a convolutional neural network as described in claims 1 to 7.
