A method for horseshoe bat recognition based on coordinated attention deep neural network

By using the coordinated attention deep neural network in the horseshoe bat recognition task, combined with the Coordinate Attention module, the problem of low recognition accuracy and high manual annotation cost in traditional technology is solved, and high-precision and high-efficiency horseshoe bat recognition is achieved. It also provides improved ideas for other fine-grained image classification tasks.

CN114898417BActive Publication Date: 2024-09-10ZHONGXING CLOUD SERVICE (BEIJING) DATA TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210240644.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2024-09-10
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

The existing technology has the problems of low recognition accuracy and high manual annotation cost in the task of identifying and classifying horseshoe bats. Moreover, the traditional attention mechanism ignores position information and cannot establish global dependencies.

Method used

Using a method based on coordinated attention deep neural network, using EfficientNet-B0 combined with the Coordinate Attention module, through data enhancement and pre-training models, a horseshoe bat recognition model capable of capturing position information and global dependencies was established, replacing the SENet module with Coordinate Attention module for image classification.

Benefits of technology

It improves the accuracy and speed of horseshoe bat recognition and classification, enables better recognition and classification of horseshoe bats without increasing computational overhead, and provides a reference for other fine-grained image classification tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114898417B
    Figure CN114898417B
Patent Text Reader

Abstract

The invention discloses a method for identifying horseshoe bats based on a coordinated attention deep neural network, and relates to the technical field of zoological image recognition. The front and side face images of horseshoe bats are obtained as a data set; the data set is divided into a training set and a test set; the training data set images are preprocessed and data enhanced; an EfficientNet‑CA neural network model is constructed; the EfficientNet‑CA model is an EfficientNet‑CA model formed by replacing the Squeeze‑and‑Excitation module in the MBConv (mobile flip bottleneck convolution) module, the core module of the EfficientNet‑B0 model, with a Coordinate Attention module called coordinated attention; in order to improve the training accuracy and speed, the EfficientNet‑CA is pre-trained using the animal data set on ImageNet to obtain a pre-trained model, and the output category of the fully connected layer of the pre-trained model is changed to 8 categories; finally, the test set is input to test the trained model. The network overcomes the problem that the Squeeze‑and‑Excitation module only considers the information between the encoding channels, but ignores the position information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of zoological image recognition, and in particular to a method for recognizing horseshoe bats based on a coordinated attention deep neural network. Background Art

[0002] Strongly supervised learning methods that manually annotate key feature information can enable traditional image classification models to achieve good recognition accuracy in fine-grained image classification tasks. However, this requires zoological experts to manually annotate a large amount of image data, which consumes a lot of time and is difficult to achieve.

[0003] With the development of computer vision, people have found that the visual attention mechanism is a brain signal processing mechanism unique to human vision. Human vision can quickly scan the global image to obtain the target area that needs to be focused on, so the attention mechanism appears. The attention mechanism, such as SENet and CBAM, has replaced the work of manually labeling key feature information to a certain extent. However, SENet only considers encoding inter-channel information and ignores the importance of position information; although the later CBAM attempts to obtain position information by reducing the channel dimension of the input tensor and then using convolution to calculate spatial attention, the convolution calculation can only obtain local position information and cannot establish global dependencies. The Coordinate Attention module, called coordinated attention, solves this problem.

[0004] By utilizing the high accuracy and high rate of EfficientNet-B0 and combining it with the Coordinate Attention mechanism, it can effectively handle the task of recognizing horseshoe bats in fine-grained image classification tasks. This method can provide a reference for the classification and model improvement ideas between different species of other animals. Summary of the invention

[0005] 1. Technical issues to be solved

[0006] In view of the shortcomings of the existing technology, the present invention provides a horseshoe bat recognition method based on a coordinated attention deep neural network, which has the advantages of high recognition accuracy and solves the problem of the current gap in horseshoe bat recognition and classification technology.

[0007] (II) Technical solution

[0008] In order to achieve the purpose of filling the gap in the current horseshoe bat identification and classification technology, the present invention provides the following technical solution: a horseshoe bat identification method based on a coordinated attention deep neural network, comprising the following steps:

[0009] S1. Get the dataset

[0010] The front and side face images of horseshoe bats were obtained as a data set. The data set consisted of high-definition images taken by a team of zoological experts in mountainous areas across the country, including Yunnan and Jiangxi, and were obtained through strict classification by Chiroptera zoology experts.

[0011] S2. Summary dataset images

[0012] The dataset was randomly divided into a training set and a test set in a ratio of 3:1. The final number of training set images was 694, with approximately 85 images for each horseshoe bat category. Data augmentation was performed on the training set images, including but not limited to random rotation, cropping, flipping, changing transparency and brightness, and random deletion.

[0013] S3. Model building

[0014] The image classification model is improved based on EfficientNet-B0, including 9 stages from Stage 1 to Stage 9, where Stage 1 is a 3×3 convolution operation; the SENet module in the MBConv module, the core module of EfficientNet-B0, is replaced with a coordinated attention Coordinate Attention module, so Stage 2 to Stage 8 are MBConv-CA modules, which include a convolution layer, a CA layer (Coordinate Attention module) and a Dropout layer; Stage 9 is a 1×1 convolution operation, a pooling layer and a fully connected layer. The probability of the category to which the image belongs is obtained by the Softmax function. Finally, the two attention maps are multiplied with the input feature map to obtain the output feature map. Hannels represents the number of channels of the output feature image, Layers represents the number of modules in this stage, Stride represents the step size of each convolution kernel in each module, and Resolution represents the size of the output feature image.

[0015] S4. Image training

[0016] The EfficientNet-CA image classification model is pre-trained. Specifically, the animal dataset on ImageNet is used to train EfficientNet-CA to obtain a pre-trained model. The training set images are then input into the pre-trained EfficientNet-CA image classification model for learning and training, and the weights of each layer of the image classification model are iteratively updated using back propagation.

[0017] S5. Image Classification

[0018] The test set image is input into the trained EfficientNet-CA image classification model, and the probability of the image in a certain category is output. The category to which the output node with the largest probability value belongs is the predicted category of the image.

[0019] Preferably, in step S1, the images in the image data set are RGB color images, including 8 different types of horseshoe bat images, namely, big-eared horseshoe bat, greater horseshoe bat, iron horseshoe bat, Pitt's horseshoe bat, Chiang Mai horseshoe bat, lesser horseshoe bat, Chinese horseshoe bat and intermediate horseshoe bat.

[0020] Preferably, in the step S2, the size of all data set images is unified to 224×224. Since the main characteristic information of the horseshoe bat is concentrated on the face, it is necessary to screen out the front and side face images of the horseshoe bat through an artificial screening method.

[0021] Preferably, in the step S3, the channel attention CA layer first globally encodes the spatial information of the input feature map. Assuming the shape of the input feature image is C×H×W, global pooling is usually used to globally encode the input feature map in the vertical and horizontal directions respectively:

[0022]

[0023]

[0024] Among them, W and H represent the width and height of the input feature map respectively. represents the global pooling output corresponding to the hth row of the channel c feature map, Represents the global pooling output corresponding to the ωth column of the channel c feature map;

[0025] The global encoding can encode the input features into two feature mapping blocks of shape C×H×1 and C×1×W, respectively. The feature mapping blocks contain position information in the vertical and horizontal directions, respectively. The feature mapping block of shape C×1×W is dimensionally transformed into a feature mapping block of C×W×1. The two feature mapping blocks are aggregated in the H direction to obtain a feature mapping image of C×H+W×1, and a 1×1 dimensionality reduction convolution is performed, where the scaling factor is r and the number of output channels is:

[0026] C′=C / mip

[0027] mip=max(8,C / / r)

[0028] The shape of the feature map after dimensionality reduction is C / r×H+W×1, which is called feature map Figure 1 , the obtained feature map Figure 1 After inputting into the BN layer, the output of the BN layer is input into the nonlinear layer to obtain the output feature map Figure 2 ;

[0029] The nonlinear layer is represented by the following formula:

[0030] v = x*Sigmoid(x)

[0031]

[0032] Preferably, in step S4, the error loss function is back-propagated, and the parameters of each layer in the image classification model are iteratively updated using a gradient descent optimization algorithm until the Loss value curve of the loss function converges, and the training model is saved.

[0033] Preferably, in the step S4, x represents the input map, y represents the output map, and the obtained feature map Figure 2 Perform a Split block operation, which maps the feature map Figure 2 Decompose C / r×H+W×1 into two feature maps C / r×H×1 and C / r×W×1 in the H direction, transform the feature map of shape C / r×W×1 into a feature map of C / r×1×W, perform 1×1 dimensional convolution on the two feature maps of shape C / r×H×1 and C / r×1×W, and obtain two feature maps of shape C×H×1 and C×1×W respectively, and then input them into the Sigmoid function to obtain two final feature maps U h and U w

[0034] Finally, the feature map U h and U w Multiply it with the original input feature map as shown below:

[0035] out=x*U h *U w

[0036] Among them, out represents the final output feature map, and x represents the initial feature map.

[0037] Preferably, the back propagation inputs the training set images into the image classification model, calculates the gap between the model prediction value and the true value, and obtains the error loss function, and the loss function adopts the cross entropy loss function.

[0038] Preferably, the coordinated attention CA layer (Coordinate Attention module) includes two one-dimensional global pooling operations, which aggregate the input feature map into two separate feature map blocks along the vertical and horizontal directions respectively, and then encode the two feature map blocks into two attention maps respectively, each attention map capturing the long-range dependency of the input feature map along a spatial direction.

[0039] (III) Beneficial effects

[0040] Compared with the prior art, the present invention provides a method for identifying horseshoe bats based on a coordinated attention deep neural network, which has the following beneficial effects:

[0041] 1. This horseshoe bat recognition method based on coordinated attention deep neural network aims at the gaps in the current horseshoe bat recognition and classification technology and the defects of the prior art. The present invention proposes a horseshoe bat recognition method based on a coordinated attention mechanism deep neural network, which improves the horseshoe bat recognition and classification technology by utilizing the high precision and high speed of EfficientNet.

[0042] 2. This horseshoe bat recognition method based on the coordinated attention deep neural network, combined with the global dependency of position information established by the coordinated attention mechanism, can better identify and classify different horseshoe bats without increasing the computational overhead, and has high recognition accuracy and fast speed, which can be used as a reference for other fine-grained image classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 is a flow chart of the horseshoe bat classification method of the present invention;

[0044] Figure 2 is a block diagram of the MBConv-CA module of the present invention;

[0045] Figure 3 It is a structural block diagram of the Coordinate Attention module of the present invention;

[0046] Figure 4 It is the Loss curve diagram of the training set of the present invention;

[0047] Figure 5 It is the Acc curve graph of the training set of the present invention;

[0048] Figure 6 It is a learning rate variation curve diagram of the present invention. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 are within the scope of protection of the present invention.

[0050] A method for identifying horseshoe bats based on a coordinated attention deep neural network comprises the following steps:

[0051] S1. Get the dataset

[0052] The front and side face images of horseshoe bats were obtained as a data set. The data set consists of high-definition images taken by a team of zoological experts in mountainous areas across the country, including Yunnan and Jiangxi, and has been strictly classified by Chiroptera zoology experts. The images in the image data set are RGB color images, including images of 8 different species of horseshoe bats, including big-eared horseshoe bat, great horseshoe bat, iron horseshoe bat, Pi's horseshoe bat, Chiang Mai horseshoe bat, small horseshoe bat, Chinese horseshoe bat and intermediate horseshoe bat.

[0053] S2. Summary dataset images

[0054] The dataset was randomly divided into a training set and a test set at a ratio of 3:1. The final number of training set images was 694, and each horseshoe bat category had about 85 images. Data enhancement was performed on the training set images, including but not limited to random rotation, cropping, flipping, changing transparency and brightness, and random deletion. The size of all dataset images was unified to 224×224. Since the main feature information of horseshoe bats is concentrated on the face, it is necessary to screen out the front and side face images of horseshoe bats through manual screening methods.

[0055] S3. Model building

[0056] The image classification model is improved based on EfficientNet-B0, including 9 stages from Stage 1 to Stage 9, where Stage 1 is a 3×3 convolution operation; the SENet module in the MBConv module, the core module of EfficientNet-B0, is replaced with the Coordinate Attention module, so Stage 2 to Stage 8 are MBConv-CA modules, which include convolution layer, CA layer (Coordinate Attention Attention module) and Dropout layer; Stage9 is a 1×1 convolution operation, pooling layer and fully connected layer. The probability of the category to which the image belongs is obtained through the Softmax function. Finally, the two attention maps are multiplied with the input feature map to obtain the output feature map. Hannels represents the number of channels of the output feature image, Layers represents the number of modules in this stage, Stride represents the step size of each convolution kernel in each module, and Resolution represents the size of the output feature image. The channel attention CA layer first globally encodes the spatial information of the input feature map. Assume that the shape of the input feature image is C×H×W. Global pooling is usually used to globally encode the input feature map in the vertical and horizontal directions respectively:

[0057]

[0058]

[0059] Among them, W and H represent the width and height of the input feature map respectively. represents the global pooling output corresponding to the hth row of the channel c feature map, Represents the global pooling output corresponding to the ωth column of the channel c feature map;

[0060] Global encoding can encode the input features into two feature mapping blocks with shapes of C×H×1 and C×1×W respectively. The feature mapping blocks contain the position information in the vertical and horizontal directions respectively. The feature mapping block with the shape of C×1×W is dimensionally transformed into a feature mapping block of C×W×1. The two feature mapping blocks are aggregated in the H direction to obtain a feature mapping image of C×H+W×1, and a 1×1 dimensionality reduction convolution is performed, where the scaling factor is r and the number of output channels is:

[0061] C′=C / mip

[0062] mip=max(8,C / / r)

[0063] The shape of the feature map after dimensionality reduction is C / r×H+W×1, which is called feature map Figure 1 , the obtained feature map Figure 1 After inputting into the BN layer, the output of the BN layer is input into the nonlinear layer to obtain the output feature map Figure 2 ;

[0064] The nonlinear layer is represented by:

[0065] y=x*Sigmoid(x)

[0066]

[0067] The error loss function is back-propagated, and the parameters of each layer in the image classification model are iteratively updated using the gradient descent optimization algorithm until the loss value curve of the loss function converges, and the training model is saved. In step S4, x represents the input mapping, y represents the output mapping, and the obtained feature map is Figure 2 Perform Split block operation, which maps the feature map Figure 2 Decompose C / r×H+W×1 into two feature maps C / r×H×1 and C / r×W×1 in the H direction, transform the feature map of shape C / r×W×1 into a feature map of C / r×1×W, perform 1×1 dimensional convolution on the two feature maps of shape C / r×H×1 and C / r×1×W, and obtain two feature maps of shape C×H×1 and C×1×W respectively, and then input them into the Sigmoid function to obtain two final feature maps U h and U wFinally, the feature map U h and U w Multiply it with the original input feature map as shown below:

[0068] out=x*U h *U w , where out represents the final output feature map and x represents the initial feature map.

[0069] The structure of the EfficientNet-CA image classification model in this embodiment is shown in Table 1:

[0070] Table 1: EfficientNet-CA image classification model structure

[0071]

[0072] S4. Image training

[0073] The EfficientNet-CA image classification model is pre-trained. Specifically, the animal dataset on ImageNet is used to train EfficientNet-CA to obtain a pre-trained model. The training set images are then input into the pre-trained EfficientNet-CA image classification model for learning and training, and the weights of each layer of the image classification model are iteratively updated using back propagation.

[0074] S5. Image Classification

[0075] The test set image is input into the trained EfficientNet-CA image classification model, and the probability of the image in a certain category is output. The category to which the output node with the largest probability value belongs is the predicted category of the image.

[0076] Back propagation inputs the training set images into the image classification model, calculates the gap between the model prediction value and the true value, and obtains the error loss function. The loss function adopts the cross entropy loss function. The coordinated attention CA layer (CoordinateAttention module) includes two one-dimensional global pooling operations, which aggregate the input feature map into two separate feature mapping blocks in the vertical and horizontal directions respectively, and then encode the two feature mapping blocks into two attention maps respectively. Each attention map captures the long-range dependency of the input feature map along a spatial direction.

[0077] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for identifying horseshoe bats based on a coordinated attention deep neural network, characterized in that: The following steps are involved: S1. Get the dataset Obtaining front and side face images of horseshoe bats as a data set, wherein the data set is high-definition images of horseshoe bats taken in mountainous areas across the country and obtained through strict classification by experts in chiroptera zoology; S2. Summary dataset images The dataset was randomly divided into a training set and a test set at a ratio of 3:

1. The final number of training set images was 694, with approximately 85 images for each horseshoe bat category. Data augmentation was performed on the training set images, including but not limited to random rotation, cropping, flipping, changing transparency and brightness, and random deletion. S3. Model building The image classification model is improved based on EfficientNet-B0. The model includes 9 stages from Stage 1 to Stage 9, where Stage 1 is a 3×3 convolution operation. The Squeeze-and-Excitation module in the mobile flip bottleneck convolution module MBConv, the core module of EfficientNet-B0, is replaced with the coordinated attention module CoordinateAttention, called the CA layer. Therefore, Stage 2 to Stage 8 are all repeatedly stacked MBConv-CA modules, which include convolutional layers, CA layers, and Dropout layers. Different convolution kernels in the convolutional layers determine that Stage 2 to Stage 8 can be one or more stacked identical or different MBConv-CA modules. The stacking structure is based on EfficientNet-B0 and is not changed. Stage 9 is a 1×1 convolution operation, a pooling layer, and a fully connected layer. The probability of the category to which the image belongs is obtained through the Softmax function. S4. Image training Pre-train the EfficientNet-CA image classification model. Specifically, use the animal dataset on ImageNet to train EfficientNet-CA to obtain a pre-trained model, and change the output category of the fully connected layer of the pre-trained model to 8 categories. Then input the training set images into the pre-trained EfficientNet-CA image classification model for learning and training, and use back propagation to iteratively update the weights of each layer of the image classification model. S5. Image Classification The test set image is input into the trained EfficientNet-CA image classification model, and the probability of the image in a certain category is output. The category to which the output node with the largest probability value belongs is the predicted category of the image.

2. The method for identifying horseshoe bats based on a coordinated attention deep neural network according to claim 1, characterized in that: In the step S1, the images in the image data set are RGB color images, including 8 different types of horseshoe bat images, namely, big-eared horseshoe bat, greater horseshoe bat, iron horseshoe bat, Pi's horseshoe bat, Chiang Mai horseshoe bat, lesser horseshoe bat, Chinese horseshoe bat and intermediate horseshoe bat.

3. The method for identifying horseshoe bats based on a coordinated attention deep neural network according to claim 1, characterized in that: In the step S2, the size of all dataset images is unified to 224×224. Since the main characteristic information of the horseshoe bat is concentrated on the face, it is necessary to screen out the front and side face images of the horseshoe bat through an artificial screening method.

4. The method for identifying horseshoe bats based on a coordinated attention deep neural network according to claim 1, characterized in that: In the step S3, the coordinated attention CA layer is specifically as follows: first, the spatial information of the input feature map is globally encoded. Assuming the shape of the input feature image is C×H×W, the input feature map is globally encoded in the vertical and horizontal directions respectively using global average pooling: Among them, W and H represent the width and height of the input feature map respectively. represents the global average pooling output corresponding to the hth row of the feature map of channel c, represents the global average pooling output corresponding to the wth column of the channel c feature map, Represents the element value of the hth row and ith column in the feature map of channel c, Represents the element value in the jth row and wth column of the feature map of channel c; The global encoding can encode the input features into two feature mapping blocks with shapes of C×H×1 and C×1×W, respectively. The feature mapping blocks contain position information in the vertical and horizontal directions, respectively. To keep the shape consistent and facilitate subsequent calculations, the feature mapping block with a shape of C×1×W is dimensionally transformed into a feature mapping block of C×W×1. The two feature mapping blocks are aggregated in the H direction to obtain a feature mapping image of C×(H+W)×1, and a 1×1 dimensionality reduction convolution is performed, where the scaling factor is r and the number of output channels is: C'=C / mip mip=max(8,C / / r) The shape of the feature map after dimensionality reduction is C / r×(H+W)×1, which is called feature map 1. After the obtained feature map 1 is input into the BN layer, the output of the BN layer is input into the nonlinear layer to obtain the output feature map 2. The nonlinear layer is represented by the following formula: y=x*Sigmoid(x) Where x represents the input map, and y represents the output map; The obtained feature map 2 is subjected to a Split block operation, wherein the block operation decomposes the feature map 2 in the H direction into two feature maps C / r×(H+W)×1 and C / r×W×1, performs a dimension conversion on the feature map of shape C / r×W×1, and converts it into a feature map of C / r×1×W, performs a 1×1 dimensional convolution on the two feature maps of shape C / r×H×1 and C / r×1×W, and obtains two feature maps of shape C×H×1 and C×1×W respectively, and then inputs them into the Sigmoid function to obtain two final feature maps U h and U w ; Finally, the feature map U h and U w Multiply it with the original input feature map as shown below: out=x*U h *U w Among them, out represents the final output feature map, and x represents the initial feature map.

5. The method for identifying horseshoe bats based on a coordinated attention deep neural network according to claim 1, characterized in that: In the step S4, the error loss function is used for back propagation, and the parameters of each layer in the image classification model are iteratively updated using the gradient descent optimization algorithm until the Loss value curve of the loss function converges, and the training model is saved.

6. The method for identifying horseshoe bats based on a coordinated attention deep neural network according to claim 1, characterized in that: The back propagation inputs the training set images into the image classification model, calculates the gap between the model prediction value and the true value, and obtains the error loss function, which adopts the cross entropy loss function.