A butterfly image recognition method based on convolutional neural network

Through convolutional neural network and multi-feature fusion recognition method, combined with body shape and marking features, subtle differences and mimicry problems in butterfly image recognition are solved, high-precision recognition and adaptive learning are achieved, and the accuracy and efficiency of butterfly recognition are improved.

CN115631417BActive Publication Date: 2024-11-05NANJING INST OF ENVIRONMENTAL SCI MINIST OF ECOLOGY & ENVIRONMENT OF THE PEOPLES REPUBLIC OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211420809.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2024-11-05
Estimated Expiration
2042-11-11

AI Technical Summary

Technical Problem

Butterfly image recognition task is difficult to deal with due to the fine force of the category to which its image belongs, the difference in objects is only in subtle places, large influences by posture and lighting, small size and occupy a small part of the image, and the mimicry ability makes it difficult to distinguish between the target and the background. The identification challenge is huge.

Method used

A multi-feature fusion recognition method based on convolutional neural network is adopted, and a multi-feature fusion recognition model is constructed by combining growth state data through image expansion processing, body shape features and mark feature extraction, RGB threshold segmentation algorithm and iterative optimization classifier.

Benefits of technology

Highly accurate extraction and type recognition of butterfly diversity characteristics are achieved, recognition accuracy and efficiency are improved, and high-definition grayscale images are formed, which is convenient for subsequent feature extraction and recognition, and model flexibility is improved through adaptive learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115631417B_ABST
    Figure CN115631417B_ABST
Patent Text Reader

Abstract

The present invention discloses a butterfly image recognition method based on a convolutional neural network, the method comprising the following steps: S1, collecting butterfly original images and growth status images with species information annotations; S2, expanding and processing the butterfly original images to form an original image data set; S3, using the original image data set to construct a multi-feature fusion recognition model based on a convolutional neural network; S4, inputting the butterfly image to be detected into the multi-feature fusion recognition model for recognition; S5, outputting the recognition result and matching and outputting the growth status image corresponding to the butterfly of this type. The present invention constructs a multi-feature fusion recognition model based on the characteristics of different types of butterflies with strong diversity and high similarity in color, pattern and morphology, and starting from the bright and colorful patterns of butterflies, respectively calculates and utilizes their body features and multi-dimensional pattern features, thereby ensuring the high-precision extraction of features of different types of butterflies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a butterfly image recognition method based on a convolutional neural network. Background Art

[0002] Butterflies belong to the order Lepidoptera, suborder Hammerhorn, class Insecta. There are many species of butterflies, which are generally classified by family. Butterflies are generally colorful and have an elegant flying posture, which makes them highly ornamental. Butterflies can spread pollen for plants, allowing them to reproduce smoothly; some butterfly larvae are also pests in agriculture and forestry. Therefore, the identification and identification of butterfly species is an important task in the protection and utilization of biodiversity, popular science education, and the prevention and control of agricultural and forestry pests.

[0003] However, the current traditional method for identifying butterfly species uses pattern recognition methods, namely image preprocessing, feature extraction and screening, classifier training and testing, etc., which can generally achieve a higher recognition rate for butterfly identification of limited species and limited sample sizes.

[0004] Compared with traditional image recognition tasks, the difficulty of butterfly image recognition tasks lies in the fact that the strength of the category to which the image belongs is more refined, and the differences between objects are only reflected in subtle details. In addition, due to the influence of posture, lighting, etc., the intra-class differences are very large, and the inter-class differences are relatively small; secondly, in ecological images, butterflies are small in size and only occupy a very small position in the image; finally, butterflies also have a mimicry ability, which makes it difficult to distinguish the butterfly target from the background. These have brought huge challenges to the recognition and classification of butterfly images.

[0005] In recent years, many deep neural network models with excellent image recognition effects have emerged, such as VGGNet, GoogLeNet, ResNet, etc., all of which have super high recognition accuracy. Convolutional neural networks have been widely used in handwritten Chinese character recognition, face recognition, speech recognition and other fields. At present, with the continuous maturity and improvement of machine learning technology, deep learning technology has been well applied in image recognition, and the automatic extraction and classification of animal and plant features using deep learning technology has been gradually carried out.

[0006] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0007] In view of the problems in the related art, the present invention proposes a butterfly image recognition method based on convolutional neural network to overcome the above-mentioned technical problems existing in the existing related art.

[0008] To this end, the specific technical solution adopted by the present invention is as follows:

[0009] A butterfly image recognition method based on convolutional neural network, the method comprising the following steps:

[0010] S1, collecting original images of butterflies with species information annotation and images of their growth status;

[0011] S2, expanding and processing the original butterfly image to form an original image data set;

[0012] S3, using the original image data set to build a multi-feature fusion recognition model based on a convolutional neural network;

[0013] S4, inputting the butterfly image to be detected into the multi-feature fusion recognition model for recognition;

[0014] S5, output the recognition result and match and output the growth state image corresponding to the type of butterfly;

[0015] S6. Storing the butterfly image to be detected and its information data into the original image set.

[0016] Furthermore, the expanding and processing of the original butterfly images to form an original image data set comprises the following steps:

[0017] S21, rotating and mirroring the original butterfly image;

[0018] S22, performing denoising filtering on the original butterfly image, and cutting it into an image of 64*64 size;

[0019] S23, dividing the image into n windows, and using median filtering to remove noise from each of the n windows to obtain a noise-free image;

[0020] S24, aggregating the noise-free images to form an original image data set.

[0021] Furthermore, obtaining a noise-free image includes:

[0022] Arrange all pixels in a window in order of pixel value, and then replace the noisy pixels with the center pixel value;

[0023] Calculate the median of the window. The calculation formula for the median filter is as follows:

[0024]

[0025] For a given image I(i,j), (r,s)∈(-(w-1) / 2,…,(w-1) / 2), (i,j)∈(1,2,…,H)×(1,2,…,L), H and L represent the width and height of the image respectively, w is the odd value of the window, w=(3,5,…), W is a set of coordinates in a rectangular sub-image window, centered at point (x, y), and all the central pixel values ​​in the window are replaced by the calculated median value;

[0026] Then the remaining windows are filtered using median filtering to remove noise and obtain a noise-free image.

[0027] Furthermore, the use of the original image data set to construct a multi-feature fusion recognition model based on a convolutional neural network includes the following steps:

[0028] S31, dividing the original image data set into a training image set and a test image set;

[0029] S32, using an RGB threshold segmentation algorithm to process the training image in the training image set to obtain a grayscale image;

[0030] S33, extracting the body features of the butterfly in the grayscale image;

[0031] S34, extracting the pattern features of the butterfly in the grayscale image;

[0032] S35, integrating the body shape feature and the pattern feature as a training set and importing them into a classifier for training to obtain a strong classifier;

[0033] S36. Use the test set to test and output the strong classifier to obtain a multi-feature fusion recognition model.

[0034] Furthermore, the method of processing the training images in the training image set using the RGB threshold segmentation algorithm to obtain the edge segmented image includes the following steps:

[0035] S321, performing filtering and noise reduction processing on the grayscale image using a median filtering method;

[0036] S322, using a threshold segmentation algorithm in RGB color space to segment the R component, G component, and B component of the training image to form a color segmented image with different color regions;

[0037] S323, removing the background color area in the color segmented image;

[0038] S324, graying and normalizing the color segmented image to form a grayscale image.

[0039] Furthermore, the step of extracting the body features of the butterflies in the training image set comprises the following steps:

[0040] S332, calculating the gradient size and direction of each pixel in the grayscale image;

[0041] S333, performing unit segmentation on the grayscale image to obtain N×N pixel units;

[0042] S334, calculating the gradient histogram of each pixel unit;

[0043] S335, merging four adjacent pixel units into a pixel block, and calculating a normalized gradient histogram in the pixel block;

[0044] S336, cascading the histograms of all pixel blocks as the body features of the training image.

[0045] Furthermore, the calculation of the gradient magnitude and direction of each pixel in the grayscale image includes the following steps:

[0046] S3321, using the first-order differential template and its professional calculation of the horizontal gradient and vertical gradient of the grayscale image, as follows:

[0047]

[0048] In the formula, G X (x,y) represents the gradient value in the x direction;

[0049] G Y (x,y) represents the gradient value in the y direction;

[0050] H represents the gray value of the pixel;

[0051] (x,y) represents the pixel coordinates;

[0052] S3322. Use the gradient template to directly perform a convolution operation to obtain the gradient amplitude and gradient direction of the grayscale image, as shown in the following formula:

[0053]

[0054] Where M(x,y) represents the gradient amplitude of the grayscale image;

[0055] θ(x,y) represents the gradient direction of the grayscale image.

[0056] Furthermore, the step of extracting the pattern features of the butterfly in the edge detection image comprises the following steps:

[0057] S341, selecting four directions of the grayscale image to generate four grayscale co-occurrence matrices;

[0058] S342, respectively calculating five characteristic parameters of the gray level co-occurrence matrix;

[0059] S343, respectively calculating the means and variances of the five similar feature parameters of the four gray-level co-occurrence matrices, and using them as the speckle features of the current gray-level image.

[0060] Furthermore, the four directions are 0°, 45°, 90° and 135° directions of the grayscale image; and the characteristic parameters include contrast, energy, entropy, local uniformity and correlation.

[0061] Furthermore, the fusion of the body shape feature and the pattern feature as a training set is imported into a classifier for training to obtain a strong classifier, comprising the following steps:

[0062] S351, using a cascade fusion method to combine the body features and the pattern features into a butterfly feature model and perform iterative training;

[0063] S352, importing the trained body shape features and pattern features into a classifier as a training set, and initializing the weight value of the training set;

[0064] S353: Iteratively optimize the classifier to obtain a final strong classifier.

[0065] Furthermore, the iterative optimization of the classifier to obtain a final strong classifier includes the following steps:

[0066] S353, selecting the weak classifier with the lowest current error rate as the tth basic classifier, and calculating the weak classifier;

[0067] S3531. Calculate the weight value of the weak classifier on the final classifier, as follows:

[0068]

[0069] In the formula, α t Indicates the weight value;

[0070] e t Represents the error of the weak classifier on the distribution dt;

[0071] S3532. According to the weight values ​​of each weak classifier, a final strong classifier is constructed as follows:

[0072]

[0073] In the formula, F represents the final classifier;

[0074] F t (x) represents a weak classifier;

[0075] T represents the number of classifiers.

[0076] The beneficial effects of the present invention are:

[0077] 1. Based on the characteristics of different types of butterflies with strong diversity and high similarity in color, pattern and morphology, a multi-feature fusion recognition model is constructed. Starting from the bright and colorful patterns of butterflies, the body characteristics and multi-dimensional pattern features are calculated and utilized respectively, so as to ensure the high-precision extraction of the characteristics of different types of butterflies and the high-precision identification of the species.

[0078] 2. By using the RGB threshold segmentation algorithm, the colorful patterns on the butterfly wings can be segmented and identified with high precision, thereby extracting the clear shape of the butterfly patterns and forming a high-definition, high-smoothness and low-noise grayscale image, which is convenient for extracting and identifying the butterfly morphology and pattern features in subsequent steps.

[0079] 3. By calculating the grayscale co-occurrence matrix and its five parameter values ​​in the grayscale image, comprehensive and high-precision feature extraction can be performed on butterfly patterns, thereby ensuring the accuracy of butterfly image recognition; in addition, by iteratively optimizing the feature model and classifier, the efficiency of feature recognition and the accuracy of classifier classification recognition can be further improved.

[0080] 4. By synchronously inputting butterfly and growth status data, it is possible to synchronously output multi-state images of the growth process of this type of butterfly after successful recognition, thereby helping users to understand and learn about butterflies more comprehensively; at the same time, the input images and recognition results are stored in the original image data set, which can realize continuous adaptive learning and training during the application process, thereby ensuring the high flexibility of the feature recognition model. BRIEF DESCRIPTION OF THE DRAWINGS

[0081] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0082] Figure 1 The present invention is a flowchart of a butterfly image recognition method based on a convolutional neural network according to an embodiment of the present invention. DETAILED DESCRIPTION

[0083] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in the field should be able to understand other possible implementations and advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.

[0084] According to an embodiment of the present invention, a butterfly image recognition method based on a convolutional neural network is provided.

[0085] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to the butterfly image recognition method based on convolutional neural network according to an embodiment of the present invention, the method comprises the following steps:

[0086] S1, collecting original images of butterflies with species information annotation and images of their growth status;

[0087] The order Lepidoptera of the class Insecta includes two types of insects: moths and butterflies. There are about 112,000 known species of Lepidoptera insects in the world, of which butterflies only account for about 10%, and the rest are moths. As two types of insects in the order Lepidoptera, their main differences are as follows:

[0088] First, butterflies usually have slender bodies, broad wings, and beautiful colors; moths usually have short and thick bodies, relatively narrow wings, and generally less bright colors.

[0089] Second, the antennae of butterflies are club-shaped or hammer-shaped; the antennae of moths are comb-shaped, silk-shaped or feather-shaped.

[0090] Third, butterflies are active during the day, while moths are mostly active at night.

[0091] Fourth, when butterflies are at rest, their wings stand upright on their backs or flap continuously; when moths are at rest, their wings are folded flat on their backs or placed on both sides of their bodies.

[0092] Fifth, the front and rear wings of butterflies generally do not have a special connecting structure. When flying, the shoulder area of ​​the hind wing is directly attached to the front wing to maintain consistent movements; the front and rear wings of moths usually have a special connecting structure "wing yoke" or "wing reins" to connect the front and rear wings when flying.

[0093] The original butterfly images are composed of multiple butterfly specimen images and multiple butterfly images taken on-site in nature as sample images of the database, and the above butterfly images have been classified according to different family levels in the preset butterfly database, and specific family levels are for example: Hesperiidae, Lycaenidae, Nymphalidae, Papilionidae, Pieridae, and Ophthalmidae. The crawler tool used not only crawls butterfly images through the Internet, but also crawls the butterfly species corresponding to the butterfly images and the butterfly information under the butterfly species. The butterfly information includes the butterfly species and living habits under the butterfly species. On the one hand, rich butterfly images and butterfly information are directly crawled through the crawler tool, and on the other hand, it is prepared for the subsequent process to display the introduction of the corresponding butterfly species after the butterfly species in the image to be identified is identified.

[0094] In addition, butterflies are holometabola insects, and they need to go through four developmental stages in their lifetime: ovum, larva, pupa, and imago. The first three developmental stages (i.e., ovum, larva, and pupa) are often referred to as early stages. The developmental process of butterfly eggs from leaving the mother to adult sexual maturity is called life cycle or life history. Therefore, in order to improve the popular science function after butterfly identification, the present invention also records the growth state data of butterflies at different developmental stages.

[0095] S2, expanding and processing the original butterfly image to form an original image data set, comprising the following steps:

[0096] S21, rotating and mirroring the original butterfly image;

[0097] S22, performing denoising filtering on the original butterfly image, and cutting it into an image of 64*64 size;

[0098] S23, dividing the image into n windows, and using median filtering to remove noise from each of the n windows to obtain a noise-free image;

[0099] S24, aggregating the noise-free images to form an original image data set.

[0100] The noise-free image is obtained by:

[0101] Arrange all pixels in a window in order of pixel value, and then replace the noisy pixels with the center pixel value;

[0102] Calculate the median of the window. The calculation formula for the median filter is as follows:

[0103]

[0104] For a given image I(i,j), (r,s)∈(-(w-1) / 2,…,(w-1) / 2), (i,j)∈(1,2,…,H)×(1,2,…,L), H and L represent the width and height of the image respectively, w is the odd value of the window, w=(3,5,…), W is a set of coordinates in a rectangular sub-image window, centered at point (x, y), and all the central pixel values ​​in the window are replaced by the calculated median value;

[0105] Then the remaining windows are filtered using median filtering to remove noise and obtain a noise-free image.

[0106] The convolutional neural network model requires a large amount of data sets for automatic feature learning, so image enhancement and data set expansion are required. Data set expansion helps increase data diversity, enhance the robustness of the convolutional neural network model, and avoid overfitting.

[0107] S3, using the original image data set to build a multi-feature fusion recognition model based on a convolutional neural network;

[0108] Convolutional neural networks have been gradually used in computer vision tasks such as image detection, pose estimation, image classification, and scene analysis. The convolution layer mainly extracts features from images through convolution operations to obtain local feature patterns. This operation gives convolutional neural networks the following two important properties: (1) The patterns learned by convolutional neural networks are translation invariant, which allows convolutional neural networks to efficiently use data when processing images. It only needs a relatively small number of training samples to learn data representations with generalization capabilities. (2) Convolutional neural networks can learn the spatial hierarchy of patterns. At the same time, the convolutional network includes a pooling layer. The pooling layer reduces the number of feature maps output by the convolutional layer, reduces redundancy, and can also greatly improve the classifier overfitting problem.

[0109] The biggest advantage of using convolutional neural networks to identify image types is that it can automatically extract features without the need for manual extraction.

[0110] Wherein, step S3 comprises the following steps:

[0111] S31, dividing the original image data set into a training image set and a test image set;

[0112] S32, using the RGB threshold segmentation algorithm to process the training images in the training image set to obtain a grayscale image,

[0113] RGB stands for the colors of three channels: red, green, and blue. Various colors are obtained by combining and superimposing the three color channels of red (R), green (G), and blue (B). The principle of color threshold segmentation technology is based on the different brightness level distributions of different substances. The amount of RGB components is represented by brightness. The range of RGB brightness is 0 to 255, and the distribution of brightness values ​​is formed as the f(i, j) function. Different objects have different RGB brightness level distributions, while the same substances have similar brightness level distributions. The threshold is the boundary value. The RGB brightness distribution between different substances is discontinuous. The brightness value at the discontinuous point is selected as the threshold for image segmentation, and different material graphics can be segmented. Threshold segmentation is the key to digital image processing.

[0114] Wherein, step S32 comprises the following steps:

[0115] S321, performing filtering and noise reduction processing on the grayscale image using a median filtering method;

[0116] S322, using a threshold segmentation algorithm in RGB color space to segment the R component, G component, and B component of the training image to form a color segmented image with different color regions;

[0117] S323, removing the background color area in the color segmented image;

[0118] S324, graying and normalizing the color segmented image to form a grayscale image, which is used to adjust the contrast of the image and reduce the impact of local shadows, illumination changes and noise interference on the image.

[0119] S33, extracting the body features of the butterfly in the grayscale image, comprising the following steps:

[0120] S332, calculating the gradient size and direction of each pixel in the grayscale image, comprising the following steps:

[0121] S3321, using the first-order differential template and its professional calculation of the horizontal gradient and vertical gradient of the grayscale image, as follows:

[0122]

[0123] In the formula, G X (x,y) represents the gradient value in the x direction;

[0124] G Y (x,y) represents the gradient value in the y direction;

[0125] H represents the gray value of the pixel;

[0126] (x,y) represents the pixel coordinates;

[0127] S3322. Use the gradient template to directly perform a convolution operation to obtain the gradient amplitude and gradient direction of the grayscale image, as shown in the following formula:

[0128]

[0129] Where M(x,y) represents the gradient amplitude of the grayscale image;

[0130] θ(x,y) represents the gradient direction of the grayscale image.

[0131] S333, performing unit segmentation on the grayscale image to obtain N×N pixel units;

[0132] S334, calculating the gradient histogram of each pixel unit;

[0133] S335, merging four adjacent pixel units into a pixel block, and calculating a normalized gradient histogram in the pixel block;

[0134] S336, cascading the histograms of all pixel blocks as the body features of the training image.

[0135] S34, extracting the pattern features of the butterfly in the grayscale image, comprising the following steps:

[0136] S341, selecting four directions of the grayscale image to generate four grayscale co-occurrence matrices;

[0137] S342, respectively calculating five characteristic parameters of the gray level co-occurrence matrix;

[0138] S343, respectively calculating the means and variances of the five similar feature parameters of the four gray-level co-occurrence matrices, and using them as the speckle features of the current gray-level image.

[0139] The four directions are respectively 0°, 45°, 90° and 135° directions of the grayscale image; the characteristic parameters include contrast, energy, entropy, local uniformity and correlation.

[0140] Contrast (CON), also called moment of inertia, reflects the clarity of the image and the depth of the texture grooves. The deeper the texture grooves, the greater the contrast and the clearer the visual effect; conversely, the smaller the contrast, the shallower the grooves and the blurrier the effect. The greater the grayscale difference (i.e., contrast), the more pixel pairs there are, and the greater this value. The greater the value of the element farthest from the diagonal in the grayscale co-occurrence matrix, the greater the contrast. The formula for calculating contrast CON is:

[0141]

[0142] In the formula, G represents the gray level;

[0143] i represents the gray value of the pixel (x, y);

[0144] i represents the gray value of the pixel (x+a, y+b);

[0145] P represents the frequency of simultaneous occurrence of pixel i and pixel j;

[0146] Energy (E), also called the angular second moment, is the sum of the squares of the elements of the gray-level co-occurrence matrix, reflecting the uniformity and coarseness of the gray-level distribution of the image. When E is large, the texture is coarse and the energy is large; conversely, when E is small, the texture is fine and the energy is small. The energy E calculation formula is:

[0147]

[0148] In the formula, G represents the gray level;

[0149] i represents the gray value of the pixel (x, y);

[0150] i represents the gray value of the pixel (x+a, y+b);

[0151] P represents the frequency of simultaneous occurrence of pixel i and pixel j;

[0152] Entropy (G) is a measure of the amount of texture information in an image. If the image has no texture, the entropy value is close to 0; if the image is full of fine textures, the entropy value is large; if the image has few textures, the entropy value is small. The entropy G calculation formula is

[0153]

[0154] In the formula, G represents the gray level;

[0155] i represents the gray value of the pixel (x, y);

[0156] i represents the gray value of the pixel (x+a, y+b);

[0157] P represents the frequency of simultaneous occurrence of pixel i and pixel j;

[0158] Local uniformity (L), also called inverse moment, is a marker of the average level of local pixels in an image. The larger L is, the more complex the image is. The formula for calculating local uniformity L is:

[0159]

[0160] In the formula, G represents the gray level;

[0161] i represents the gray value of the pixel (x, y);

[0162] i represents the gray value of the pixel (x+a, y+b);

[0163] P represents the frequency of simultaneous occurrence of pixel i and pixel j;

[0164] Correlation (COR) is a measure of the similarity of the elements of the spatial grayscale co-occurrence matrix in the row or column direction. The size of the correlation value reflects the local grayscale correlation in the image. When the values ​​of the matrix elements are uniformly equal, the correlation value is large; on the contrary, if the matrix pixel values ​​are very different, the correlation value is small. If there is horizontal texture in the image, the COR of the horizontal matrix is ​​greater than the COR value of the rest of the matrix.

[0165] S35, fusing the body shape feature and the pattern feature as a training set and importing it into a classifier for training to obtain a strong classifier, including the following steps:

[0166] S351, using a cascade fusion method to combine the body features and the pattern features into a butterfly feature model and perform iterative training;

[0167] S352, importing the trained body shape features and pattern features into a classifier as a training set, and initializing the weight value of the training set;

[0168] S353, iteratively optimizing the classifier to obtain a final strong classifier, comprising the following steps:

[0169] S3531, selecting the weak classifier with the lowest current error rate as the tth basic classifier, and calculating the weak classifier;

[0170] S3532. Calculate the weight value of the weak classifier on the final classifier, as follows:

[0171]

[0172] In the formula, α t Indicates the weight value;

[0173] e t Represents the error of the weak classifier on the distribution dt;

[0174] S353, according to the weight value of each weak classifier, form the final strong classifier, as shown in the following formula:

[0175]

[0176] In the formula, F represents the final classifier;

[0177] F t (x) represents a weak classifier;

[0178] T represents the number of classifiers.

[0179] S36. Use the test set to test and output the strong classifier to obtain a multi-feature fusion recognition model.

[0180] Adaboost is an ensemble learning algorithm that iteratively trains different weak classifiers and combines them to form a powerful strong classifier. Theory has proven that as long as the classification ability of each weak classifier is better than random guessing, when their number tends to infinity, the error rate of the strong classifier will tend to zero.

[0181] S4, inputting the butterfly image to be detected into the multi-feature fusion recognition model for recognition;

[0182] S5, output the recognition result and match and output the growth state image corresponding to the type of butterfly;

[0183] S6. Storing the butterfly image to be detected and its information data into the original image set.

[0184] In summary, by means of the above technical scheme of the present invention, by targeting the characteristics of different types of butterflies with strong diversity and high similarity in color, pattern and morphology, a multi-feature fusion recognition model is constructed, starting from the bright and colorful patterns of butterflies, the body characteristics and multi-dimensional pattern characteristics are calculated and utilized respectively, so as to ensure the high-precision extraction of different types of butterfly characteristics and the high-precision identification of types. By utilizing the RGB threshold segmentation algorithm, it is possible to perform high-precision regional segmentation and identification for the colorful patterns existing in the butterfly wing patterns, thereby extracting a clear butterfly pattern shape, and forming a grayscale image with high definition, high smoothness and low noise, which is convenient for extracting and identifying the butterfly morphology and pattern features in subsequent steps. By calculating the grayscale co-occurrence matrix and its five parameter values ​​in the grayscale image, it is possible to perform comprehensive and high-precision feature extraction for butterfly patterns, thereby ensuring the accuracy of butterfly image recognition; in addition, by iteratively optimizing the feature model and the classifier, the efficiency of feature recognition and the accuracy of classifier classification recognition are further improved. By synchronously recording the butterfly and growth status data, it is possible to synchronously output multi-state images of the butterfly type during its growth process after successful recognition, thereby helping users to understand and learn about butterflies more comprehensively; at the same time, the recorded images and recognition results are stored in the original image data set, which can realize continuous adaptive learning and training during the application process, thereby ensuring the high flexibility of the feature recognition model.

[0185] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A butterfly image recognition method based on convolutional neural network, characterized in that: The method comprises the following steps: S1, collecting original images of butterflies with species information annotation and images of their growth status; S2, expanding and processing the original butterfly image to form an original image data set; S3, using the original image data set to build a multi-feature fusion recognition model based on a convolutional neural network; S4, inputting the butterfly image to be detected into the multi-feature fusion recognition model for recognition; S5, output the recognition result and match and output the growth state image corresponding to the type of butterfly; S6, storing the butterfly image to be detected and its information data into the original image set; The butterfly and growth status data are recorded synchronously, and after successful recognition, multi-state images of the butterfly in the growth process can be output synchronously; The step of expanding and processing the original butterfly images to form an original image data set comprises the following steps: S21, rotating and mirroring the original butterfly image; S22, performing denoising filtering on the original butterfly image, and cutting it into an image of 64*64 size; S23, dividing the image into n windows, and removing noise from each of the n windows by using a median filter to obtain a noise-free image; S24, aggregating the noise-free images to form an original image data set; The original butterfly images are composed of multiple butterfly specimen images and multiple butterfly images taken on-site in nature as sample images of the database, and the above butterfly images have been classified according to different family levels in the preset butterfly database; the growth state images are multi-state images of the butterfly growth process obtained according to the growth state data of the butterfly at different developmental stages; by synchronously inputting the original butterfly images and growth state data, the multi-state images of the butterfly growth process of this type can be synchronously output after successful recognition, thereby helping users to understand and learn about butterflies more comprehensively; The obtaining of the noise-free image comprises: Arrange all pixels in a window in order of pixel value, and then replace the noisy pixels with the center pixel value; Calculate the median of the window. The calculation formula for the median filter is as follows: For a given image I(i,j), (r,s)∈(-(w-1) / 2,…,(w-1) / 2), (i,j)∈(1,2,…,H)×(1,2,…,L), H and L represent the width and height of the image respectively, w is the odd value of the window, w=(3,5,…), W is a set of coordinates in a rectangular sub-image window, centered at point (x, y), and all the central pixel values ​​in the window are replaced by the calculated median value; Then the remaining windows are subjected to median filtering to remove noise and obtain a noise-free image; The method of using the original image data set to construct a multi-feature fusion recognition model based on a convolutional neural network includes the following steps: S31, dividing the original image data set into a training image set and a test image set; S32, using an RGB threshold segmentation algorithm to process the training image in the training image set to obtain a grayscale image; S33, extracting the body features of the butterfly in the grayscale image; S34, extracting the pattern features of the butterfly in the grayscale image; S35, integrating the body shape feature and the pattern feature as a training set and importing them into a classifier for training to obtain a strong classifier; S36, using the test set to test and output the strong classifier to obtain a multi-feature fusion recognition model; The step of fusing the body shape feature and the pattern feature as a training set and importing it into a classifier for training to obtain a strong classifier comprises the following steps: S351, using a cascade fusion method to combine the body features and the pattern features into a butterfly feature model and perform iterative training; S352, importing the trained body shape features and pattern features into a classifier as a training set, and initializing the weight value of the training set; S353, iteratively optimizing the classifier to obtain a final strong classifier; The iterative optimization of the classifier to obtain a final strong classifier includes the following steps: S3531, selecting the weak classifier with the lowest current error rate as the tth basic classifier, and calculating the weak classifier; S3532. Calculate the weight value of the weak classifier on the final classifier, as follows: In the formula, α t Represents the weight value; e t Represents the error of the weak classifier on the distribution dt; S353, according to the weight value of each weak classifier, form the final strong classifier, as shown in the following formula: In the formula, F represents the final classifier; F t (x) represents a weak classifier; T represents the number of classifiers; different weak classifiers are iteratively trained and combined to form a powerful strong classifier.

2. The butterfly image recognition method based on convolutional neural network according to claim 1, characterized in that: The method of processing the training images in the training image set by using the RGB threshold segmentation algorithm to obtain an edge segmented image comprises the following steps: S321, performing filtering and noise reduction processing on the grayscale image using a median filtering method; S322, using a threshold segmentation algorithm in RGB color space to segment the R component, G component, and B component of the training image to form a color segmented image with different color regions; S323, removing the background color area in the color segmented image; S324, graying and normalizing the color segmented image to form a grayscale image.

3. The butterfly image recognition method based on convolutional neural network according to claim 2, characterized in that: The step of extracting the body features of butterflies in the training image set comprises the following steps: S332, calculating the gradient size and direction of each pixel in the grayscale image; S333, performing unit segmentation on the grayscale image to obtain N×N pixel units; S334, calculating the gradient histogram of each pixel unit; S335, merging four adjacent pixel units into a pixel block, and calculating a normalized gradient histogram in the pixel block; S336, cascading the histograms of all pixel blocks as the body features of the training image.

4. The butterfly image recognition method based on convolutional neural network according to claim 3, characterized in that: The step of calculating the gradient size and direction of each pixel in the grayscale image is as follows: The method comprises the following steps: S3321, using a first-order differential template and its dedicated function to calculate the horizontal gradient and vertical gradient of the grayscale image, as shown in the following formula: In the formula, G X (x,y) represents the gradient value in the x direction; G Y (x,y) represents the gradient value in the y direction; H represents the gray value of the pixel; (x,y) represents the pixel coordinates; S3322. Use the gradient template to directly perform a convolution operation to obtain the gradient amplitude and gradient direction of the grayscale image, as shown in the following formula: Where M(x,y) represents the gradient amplitude of the grayscale image; θ(x,y) represents the gradient direction of the grayscale image.

5. The butterfly image recognition method based on convolutional neural network according to claim 4, characterized in that: The step of extracting the pattern features of the butterfly in the edge detection image comprises the following steps: S341, selecting four directions of the grayscale image to generate four grayscale co-occurrence matrices; S342, respectively calculating five characteristic parameters of the gray level co-occurrence matrix; S343, respectively calculating the means and variances of the five similar feature parameters of the four gray-level co-occurrence matrices, and using them as the speckle features of the current gray-level image.

6. The butterfly image recognition method based on convolutional neural network according to claim 5, characterized in that: The four directions are respectively 0°, 45°, 90° and 135° directions of the grayscale image; the characteristic parameters include contrast, energy, entropy, local uniformity and correlation.