Algae image classification system and method based on data enhancement
By augmenting the training set of algae image classification, expanding the data sample space, and using the training set after data augmentation to train the classification neural network, the small scale of the algae image data set makes the classification algorithm unable to achieve the optimal classification accuracy rate. The problem of algae classification has achieved the efficiency and accuracy.
Patent Information
- Application Number
- CN202411361985.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the data set of algae classification images is small in scale, which makes it impossible for the classification algorithm in deep learning to achieve the optimal classification accuracy on algae images.
The data sample space is expanded by performing data augmentation on the training set of algae image classification, including transformations in size and color, such as random adjustment cropping, random horizontal flip, random enhancement, random mixing and random cut mixing. Then, the classification neural network is trained using the data-enhanced training set, cross-entropy loss is calculated, and network parameters are updated in combination with backpropagation and gradient descent algorithms, and the algae recognition classification model after the updated parameters are obtained.
The efficient and accurate algae classification is achieved, and the classification accuracy of the optimized algae identification classification model reaches more than 80%, greatly improving the accuracy of algae classification.
Smart Images

Figure CN119418192A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of biological detection and image recognition and classification in water quality, and in particular to a system and method for algae image classification based on data enhancement. Background Art
[0002] Due to the influence of human activities, the frequency of algal blooms is increasing. They not only destroy aquatic ecosystems, but also produce many secondary toxic metabolites. According to studies, algal blooms can reduce the transparency of water, which in turn affects the growth of other aquatic plants. When they die, they also consume a large amount of oxygen in the water, causing fish to die due to lack of oxygen. In addition, some algae also produce some toxic substances. For example, the toxins produced by cyanobacteria can inhibit the synthesis of human proteins and damage various organs of the human body. The toxins produced by Microcystis can promote tumor growth. Therefore, it is very important to monitor the algae in water samples and prevent the occurrence of algal blooms in time. And the classification of algae in water samples is one of the main means of real-time monitoring of algae. However, as far as we know, it is very expensive to train a qualified algae scholar, and it is very time-consuming to complete the classification of algae manually, and it is impossible to predict the occurrence of algal blooms in time.
[0003] In recent years, due to the rapid development of deep learning in computer vision fields such as image classification, object detection and semantic segmentation, the derived applications have also achieved great success in various industries, such as face recognition, autonomous driving, etc. Therefore, the classification, detection and segmentation of algae images with the help of deep learning has attracted the attention of a wide range of algae researchers.
[0004] However, deep learning requires a large amount of manually annotated data. Only when driven by a relatively large data set can the deep learning algorithm be well trained and obtain better results. Compared with common images, it is extremely difficult to obtain algae images, and it is extremely time-consuming and labor-intensive to manually annotate and classify algae images, which makes the algae classification image data set small, which in turn causes the classification algorithm in deep learning to be unable to achieve the optimal classification accuracy on algae images, and makes it impossible to carry out research on the classification algorithm in deep learning on algae images. Summary of the invention
[0005] The purpose of the present invention is to address the problem that the algae classification image data set in the prior art is small in size, which leads to the inability of the classification algorithm in deep learning to achieve the optimal classification accuracy on algae images, and thus proposes a system and method for algae image classification based on data enhancement. The present invention first performs data enhancement on the training set for algae image classification, and then uses the data-enhanced training set to train the classification neural network. After the training is completed, it is tested on the test set, and the training and testing are repeated multiple times, and the model parameters with the highest classification accuracy are saved to obtain the optimal algae recognition classification model. Using the method of the present invention to classify algae images can achieve high efficiency and accuracy of classification.
[0006] The first aspect of the present invention provides a system for algae image classification based on data enhancement, the system comprising:
[0007] An acquisition module, used for acquiring image data of algae to be monitored;
[0008] A processing module, used for dividing the algae image data to be monitored into a training set and a test set in a ratio of 3:1, and performing data enhancement processing on the images in the training set;
[0009] A training module is used to input the training set after data enhancement processing into a preset convolutional neural network for training of algae cell recognition and classification, calculate the cross entropy loss between the true algae category in the training set and the predicted algae category output by the preset convolutional neural network, and update the network parameters by combining the cross entropy loss with the back propagation and gradient descent algorithms to obtain the algae recognition and classification model after the parameters are updated;
[0010] The optimization module is used to input the test set into the algae recognition and classification model, evaluate the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model, further optimize the accuracy, and obtain an optimized algae recognition and classification model.
[0011] Preferably, the specific method for performing data enhancement processing on the images in the training set of the algae image data to be monitored is: transforming the images in the training set of the algae image data to be monitored in size and color, and the transformation methods include random adjustment and cropping, random horizontal flipping, random enhancement, random mixing and random cutting and mixing.
[0012] In this article, the random adjustment and cropping is to select and crop random areas of algae images with inconsistent sizes, and then scale them to a specified size to obtain algae images with consistent pixel sizes; the random horizontal flipping is to flip the image in the horizontal direction according to a specified probability value to obtain a mirror image of the original image; the random enhancement is to perform two image transformations of specified scales on the image, and the two image transformations are randomly selected from 14 image transformation operators (identity transformation, affine transformation along the X-axis, affine transformation along the Y-axis, translation along the X-axis, translation along the Y-axis, rotation, brightness, color, contrast, sharpening, color separation, exposure, automatic contrast and equal transformation) to obtain an image after two image transformation operations; the random cutting and mixing is to perform random area cropping on multiple images of the same batch in the training process, and then move them to another image other than itself to obtain a new image mixed with partial areas of other images.
[0013] Preferably, the preset convolutional neural network includes an AlexNet convolutional neural network, a VGG convolutional neural network, an InceptionNet convolutional neural network, a ResNet convolutional neural network, a ResNeXt convolutional neural network, an EfficientNet convolutional neural network or a ConvNeXt convolutional neural network.
[0014] Preferably, the calculation formula for the cross entropy loss between the true algae category in the training set and the predicted algae category output by the preset convolutional neural network is:
[0015]
[0016] Among them, CEloss is the cross entropy loss, p(x) represents the true label, and q(x) represents the predicted output.
[0017] Preferably, the specific process of obtaining the trained algae recognition and classification model is: back propagation and parameter update are performed according to the cross entropy loss to obtain the trained algae recognition and classification model, wherein the specific operation process of back propagation is: the cross entropy loss is used to adjust the network parameters by the gradient descent method to obtain the network after the parameter values are updated; the specific operation process of parameter update is: The updated parameters w and b are obtained, where w is the weight of the neural network, b is the offset parameter of the neural network, ι is the number of layers of the neural network, α is the learning rate, ▽ is the gradient, and ← is the update of the original parameters with the updated parameters.
[0018] Preferably, the specific operation of evaluating the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model is: acc = n_p / n, where n_p represents the total number of correct predictions of image types in the test set, n represents the total number of images in the test set, and acc is the accuracy.
[0019] Preferably, the specific process of further optimizing the accuracy is: repeating the data enhancement processing, obtaining the trained algae recognition and classification model and evaluating the accuracy 300 times in sequence, and saving the model parameters with the highest accuracy.
[0020] The second aspect of the present invention proposes a method for algae image classification based on data enhancement, which includes: obtaining algae image data to be monitored; dividing the algae image data to be monitored into a training set and a test set in a ratio of 3:1, and performing data enhancement processing on the images in the training set; inputting the training set after data enhancement processing into a preset convolutional neural network for training of algae cell recognition and classification, calculating the cross entropy loss of the true algae category in the training set and the algae predicted category output by the preset convolutional neural network, combining the cross entropy loss with back propagation and gradient descent algorithms to update network parameters, and obtaining an algae recognition and classification model after parameter update; inputting the test set into the algae recognition and classification model, evaluating the accuracy of the true algae category in the test set and the algae output category output by the algae recognition and classification model, further optimizing the accuracy, and obtaining an optimized algae recognition and classification model.
[0021] A third aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for algae image classification based on data enhancement as described above when executing the program.
[0022] A fourth aspect of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method for algae image classification based on data enhancement as described above.
[0023] In the system and method for algae image classification based on data enhancement described in the present invention, the beneficial effects are as follows: in the present invention, data enhancement is first performed on the training set for algae image classification, and then the classification neural network is trained using the data-enhanced training set. After the training is completed, it is tested on the test set, and the training and testing are repeated multiple times, and the model parameters with the highest classification accuracy are saved to obtain the optimal algae recognition and classification model. The method of the present invention solves the problem that the classification algorithm cannot achieve the optimal classification accuracy due to the small scale of algae image data, which leads to the inability to carry out research, and achieves high efficiency in algae classification. At the same time, the classification accuracy of the optimized algae recognition and classification model reaches more than 80%, which greatly improves the accuracy of algae classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A structural block diagram of the system for algae image classification based on data enhancement of the present invention;
[0025] Figure 2 is a flow chart of the method for algae image classification based on data enhancement of the present invention;
[0026] Figure 3 It is a comparison diagram of the original image and the image after data enhancement of the algae classification image in the present invention; the left side is four original algae images selected from the divided training set, and the right side is the image of these four images after data enhancement that will be sent to the classification network for training. DETAILED DESCRIPTION
[0027] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0028] In a first aspect, the present invention proposes a system for algae image classification based on data enhancement, such as Figure 1 As shown, the system includes:
[0029] An acquisition module, used for acquiring image data of algae to be monitored;
[0030] A processing module, used for dividing the algae image data to be monitored into a training set and a test set in a ratio of 3:1, and performing data enhancement processing on the images in the training set;
[0031] A training module is used to input the training set after data enhancement processing into a preset convolutional neural network for training of algae cell recognition and classification, calculate the cross entropy loss between the true algae category in the training set and the predicted algae category output by the preset convolutional neural network, and update the network parameters by combining the cross entropy loss with the back propagation and gradient descent algorithms to obtain the algae recognition and classification model after the parameters are updated;
[0032] The optimization module is used to input the test set into the algae recognition and classification model, evaluate the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model, further optimize the accuracy, and obtain an optimized algae recognition and classification model.
[0033] In the system described in the present invention, the specific steps of obtaining the algae image data to be monitored include: monitoring the algae in the water area, taking corresponding water samples, making slide specimens, using a specially developed Algae-hub device to obtain and collect algae images, manually classifying them and making them into algae image classification data sets, and each algae image contains different quantities and types of algae.
[0034] Data enhancement processing is performed on the images in the training set of the algae image data to be monitored. The purpose of the enhancement processing is to perform image transformation on small-scale data samples, enrich the sample space of small data, and indirectly expand the number of small data samples.
[0035] In the system of the present invention, the preset convolutional neural network includes AlexNet convolutional neural network, VGG convolutional neural network, InceptionNet convolutional neural network, ResNet convolutional neural network, ResNeXt convolutional neural network, EfficientNet convolutional neural network or ConvNeXt convolutional neural network. In a preferred embodiment, the preset convolutional neural network is ResNet-50.
[0036] In the system of the present invention, the specific process of obtaining the trained algae recognition classification model is: back propagation and parameter update according to the cross entropy loss. Specifically, the SGD optimizer is used to update the parameters of the classification algorithm.
[0037] The second aspect of the present invention proposes a method for algae image classification based on data enhancement, such as Figure 2As shown, the method includes: obtaining algae image data to be monitored; dividing the algae image data to be monitored into a training set and a test set according to a ratio of 3:1, and performing data enhancement processing on the images in the training set; inputting the training set after data enhancement processing into a preset convolutional neural network for training of algae cell recognition and classification, calculating the cross entropy loss of the algae true category in the training set and the algae predicted category output by the preset convolutional neural network, combining the cross entropy loss with back propagation and gradient descent algorithms to update network parameters, and obtaining an algae recognition and classification model after parameter update; inputting the test set into the algae recognition and classification model, evaluating the accuracy of the algae true category in the test set and the algae output category output by the algae recognition and classification model, repeating the training and testing multiple times, and saving the model parameters with the highest classification accuracy, which is the optimal algae recognition and classification model.
[0038] The system for algae image classification based on data enhancement provided by the present invention performs data enhancement on a training set for algae image classification, then uses the data-enhanced training set to train a classification neural network, and uses the algae classification result output by the classification neural network to calculate the cross entropy loss with the real classification result, combines back propagation and gradient descent algorithms to obtain an algae recognition classification model after parameter update, and finally tests the algae recognition classification model after parameter update on a test set, repeats training and testing for multiple times, and obtains the optimal algae recognition classification model. The method of the present invention achieves high efficiency in algae classification, and at the same time, the classification accuracy of the optimized algae recognition classification model reaches more than 80%, which greatly improves the accuracy of algae classification.
[0039] Example 1
[0040] Acquire and collect algae images, manually classify them and make them into algae image classification data. The algae include Achnanthidium sp, Aphanocapsa sp, Aulacoseira granulata, Aulacoseira granulatavar.angustissima, Aulacoseira pusilla, Ceratium furca, Chroococcus sp, Closteriumangustatum, Closterium macilentum, Closterium striolatum, Cyclotellameneghiniana, Dolichospermum flos-aquae, Dolichospermum sp, Ectocarpussiliculosus, Ectocarpus sp, Euglena acus, Euglena deses, Euglena spirogyra, Euglena tripteris, Fragilaria sp, Glaucospira laxissima, Gloeocapsa sp, Gomphonema lagenula, Gomphonema sp, Limnothrix rosea, Limnothrix sp, Merismopediaminima, Micrasterias denticulata, Microcystis aeruginosa, Microcystis flos-aquae, Microcystis sp, Microcystis virids, Microcystis wesenbergii, Navicula sp, Nitzschia acicularis, Nitzschia palea, Nitzschia sp, Oscillatoria sp, Phacustortus, Planktothrix agardhii, Pseudanabaena limnetica, Pseudanabaena minima, Pseudanabaena mucicola, Pseudanabaena sp, Raphidiopisis sp, Rhabdogloea smithii, Skeletonema sp, Synura sp, Ulnaria acus and Ulnaria ulna, with a total of 7876 groups of algae image classification data;
[0041] The algae image classification data is divided into training set and test set in a ratio of 3:1. The division results are shown in Table 1.
[0042] Table 1 Number of training sets, test sets and algae image classification data
[0043]
[0044] Data enhancement processing is performed on the images in the training set of the algae image data to be monitored. The specific process of the enhancement processing is: the images in the training set of the algae image data to be monitored are transformed in size and color by using random adjustment cropping, random horizontal flipping, random enhancement, random mixing and random cutting and mixing. The image comparison before and after the enhancement processing is as follows: Figure 3 shown; from Figure 3 It can be seen that the original image after enhancement processing is richer and more complex, thus achieving the effect of expanding the sample space.
[0045] The training set after data enhancement is input into the ResNet-50 convolutional neural network for algae cell recognition and classification training. The cross entropy loss between the true algae category in the training set and the predicted algae category output by the ResNet-50 convolutional neural network is calculated using the formula (the loss is different for each round, and a total of 300 rounds are performed). Then, the network parameters are updated based on the cross entropy loss combined with the back propagation and gradient descent algorithms to obtain the algae recognition and classification model after parameter update. The corresponding process has been mentioned in the previous article and will not be repeated here. The parameters of the ResNet-50 convolutional neural network are shown in Table 2.
[0046] Table 2 Setting parameters in ResNet-50 convolutional neural network
[0047]
[0048] The test set of the algae image data to be monitored is input into the algae recognition and classification model after the parameters are updated, the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model are evaluated, the accuracy of the test set under the current network model parameters is recorded, and then repeated 300 times, the accuracy of the test set under the network model with updated parameters is recorded, and finally the model parameters with the highest accuracy are saved, and the accuracy is output as the final classification accuracy of the image classification algorithm.
[0049] Comparative Example 1
[0050] The implementation is carried out in the manner of Example 1, except that the images in the training set of the algae image data to be monitored are not subjected to data enhancement processing.
[0051] Determination of classification accuracy of the classification algorithms of Example 1 and Comparative Example 1
[0052] Table 3 Classification accuracy of the classification algorithms of Example 1 and Comparative Example 1
[0053]
[0054] As can be seen from Table 3, the method of the present invention solves the problem that the classification algorithm cannot achieve the optimal classification accuracy due to the small scale of algae image data, which in turn leads to the inability to carry out research, and realizes the high efficiency of algae classification. At the same time, the classification accuracy of the optimized algae recognition and classification model reaches more than 80%, which greatly improves the accuracy of algae classification.
[0055] The preferred embodiments of the present invention are described in detail above, but the present invention is not limited thereto. Within the technical concept of the present invention, the technical solution of the present invention can be subjected to a variety of simple modifications, including the combination of various technical features in any other suitable manner, and these simple modifications and combinations should also be regarded as the contents disclosed by the present invention and belong to the protection scope of the present invention.
Claims
1. A system for algae image classification based on data enhancement, characterized in that: include: An acquisition module, used for acquiring image data of algae to be monitored; A processing module, used for dividing the algae image data to be monitored into a training set and a test set in a ratio of 3:1, and performing data enhancement processing on the images in the training set; A training module is used to input the training set after data enhancement processing into a preset convolutional neural network for training of algae cell recognition and classification, calculate the cross entropy loss between the true algae category in the training set and the predicted algae category output by the preset convolutional neural network, and update the network parameters by combining the cross entropy loss with the back propagation and gradient descent algorithms to obtain the algae recognition and classification model after the parameters are updated; The optimization module is used to input the test set into the algae recognition and classification model, evaluate the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model, further optimize the accuracy, and obtain an optimized algae recognition and classification model.
2. The system for classifying algae images according to claim 1, characterized in that: The specific method of performing data enhancement processing on the images in the training set is: transforming the size and color of the images in the training set, and the transformation method includes random adjustment and cropping, random horizontal flipping, random enhancement, random mixing and random cutting and mixing; Random adjustment cropping is to select and crop random areas of algae images with inconsistent sizes, and then scale them to the specified size to obtain algae images with consistent pixel sizes; Random horizontal flipping is to flip the algae image horizontally according to the specified probability value to obtain a mirror image of the original image; Random enhancement is to transform the algae image at two specified scales to obtain an image that has undergone two image transformation operations; Random cutting and mixing is to cut random areas of multiple images in the same batch during training, and then move them to another image other than their own to obtain a new image mixed with parts of other images.
3. The algae image classification system according to claim 1 or 2, characterized in that: The preset convolutional neural network includes AlexNet convolutional neural network, VGG convolutional neural network, InceptionNet convolutional neural network, ResNet convolutional neural network, ResNeXt convolutional neural network, EfficientNet convolutional neural network or ConvNeXt convolutional neural network.
4. The algae image classification system according to claim 1 or 2, characterized in that: The calculation formula for the cross entropy loss between the true algae category in the training set and the predicted algae category output by the preset convolutional neural network is: Among them, CEloss is the cross entropy loss, p(x) is the true category of algae, and q(x) is the predicted category of algae.
5. The system for classifying algae images according to claim 4, characterized in that: The specific process of obtaining the algae recognition and classification model after parameter update is as follows: the cross entropy loss is combined with the back propagation and gradient descent algorithms to update the network parameters to obtain the trained algae recognition and classification model. The specific operation process of back propagation is as follows: the gradient of each layer of network parameters is calculated by using the chain derivation rule for the cross entropy loss; the specific operation process of the gradient descent algorithm is as follows: The updated parameters w and b are obtained, where w is the weight of the neural network, b is the offset parameter of the neural network, ι is the number of layers of the neural network, α is the learning rate, ▽ is the gradient, and ← is the update of the original parameters with the updated parameters.
6. The system for classifying algae images according to claim 1, characterized in that: The specific operation of evaluating the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model is: acc = n_p / n, where n_p represents the total number of correct predictions of image types in the test set, n represents the total number of images in the test set, and acc is the accuracy.
7. The system for classifying algae images according to claim 1, characterized in that: The specific process of further optimizing the accuracy and obtaining the optimized algae recognition and classification model is as follows: the data enhancement processing, the algae recognition and classification model after parameter update and the accuracy evaluation are repeated 300 times in sequence, and the model parameters with the highest accuracy are saved.
8. A method for algae image classification based on data enhancement, characterized in that: The method includes: Acquiring image data of algae to be monitored; Dividing the algae image data to be monitored into a training set and a test set in a ratio of 3:1, and performing data enhancement processing on the images in the training set; The training set after data enhancement processing is input into the preset convolutional neural network for algae cell recognition and classification training, the cross entropy loss between the true algae category in the training set and the algae predicted category output by the preset convolutional neural network is calculated, the cross entropy loss is combined with the back propagation and gradient descent algorithms to update the network parameters, and the algae recognition and classification model after the parameter update is obtained; The test set is input into the algae recognition and classification model, the accuracy of the true algae categories in the test set and the algae output categories output by the algae recognition and classification model are evaluated, the accuracy is further optimized, and an optimized algae recognition and classification model is obtained.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for algae image classification based on data enhancement as claimed in claim 8 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for algae image classification based on data enhancement as claimed in claim 8 are implemented.
Citation Information
Cited By
True coral image data determination method and device, equipment, medium and product
CN120219938A
AI-based autonomous system and method for predicting and removing floating waste from water bodies
US12662786B2