A fine-grained image classification method, device, computer equipment and storage medium

Through the channel interactive attention network, the feature extraction and attention mechanism of image pairs are used to solve the problem of low accuracy of fine-grained image classification and achieve more accurate feature extraction and classification effects.

CN115131608BActive Publication Date: 2024-08-27GUANGDONG POLYTECHNIC NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210688274.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-17
Publication Date
2024-08-27
Estimated Expiration
2042-06-17

AI Technical Summary

Technical Problem

Existing fine-grained image classification technology has low accuracy and cannot effectively simulate humans to identify common features and learn to compare different features between different images, resulting in poor classification results.

Method used

Using the channel interactive attention network, through the channel interaction module, attention enhancement and suppression module and classification module, the intra-image enhancement features and cross-image enhancement features of the image pair are obtained, and the attention mechanism is used to enhance common features and suppress salient areas, improving Learning ability of feature extraction network.

Benefits of technology

The accuracy of fine-grained image classification is improved, and the accuracy of image classification is improved through accurate key area positioning and efficient feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115131608B
    Figure CN115131608B
Patent Text Reader

Abstract

The present application belongs to the field of image processing technology, and discloses a fine-grained image classification method, device, computer equipment and storage medium, the method comprising: obtaining a target image pair to be classified; inputting the target image pair into a channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; inputting the cross-image enhancement feature map corresponding to each target image into an attention enhancement and suppression module to obtain an attention enhancement feature map and an attention suppression feature map corresponding to each target image, and inputting the obtained two attention suppression feature maps into a feature extraction network to train the feature extraction network; inputting the feature map, the intra-image enhancement feature map and the attention enhancement feature map corresponding to each target image into a classification module to obtain the classification result of the target image pair. The present application can achieve the effect of improving the accuracy of fine-grained image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a fine-grained image classification method, apparatus, computer equipment and storage medium. Background Art

[0002] The purpose of fine-grained image classification is to make more detailed sub-classifications (such as bird species, car styles, aircraft models, etc.) based on the basic categories. Compared with traditional image classification tasks, fine-grained image classification tasks are more challenging because the sub-categories in fine-grained image classification have the characteristics of small inter-class differences and large intra-class differences. The classification effect depends on the positioning of key areas and the learning of fine-grained features.

[0003] Early fine-grained image classification methods often rely on a large amount of manually annotated information, resulting in high experimental costs and poor classification results in fine-grained classification tasks. Currently, weakly supervised learning methods are commonly used to achieve fine-grained image classification, without the need for additional bounding boxes and part annotations, and are more feasible in real-world scenarios. However, most existing fine-grained image classification techniques only take a single image as input, extract features from the image, and then classify it based on the extracted features. They cannot simulate the human ability to identify common features and learn to compare and contrast different features between different images, resulting in low classification accuracy. In summary, the existing technology has the problem of low accuracy in fine-grained image classification. Summary of the invention

[0004] The present application provides a fine-grained image classification method, apparatus, computer equipment and storage medium, which can improve the accuracy of fine-grained image classification.

[0005] In a first aspect, an embodiment of the present application provides a fine-grained image classification method, which is based on a channel interaction attention network, wherein the channel interaction attention network includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the method includes:

[0006] Obtain a target image pair to be classified, the target image pair comprising two different target images belonging to the same category;

[0007] Input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction module includes a feature extraction network and a channel interaction operation unit, the feature extraction network is used to extract features from each target image in the input target image pair to output a feature map corresponding to each target image, and the channel interaction operation unit operates on each feature map to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image;

[0008] Inputting the cross-image enhancement feature map corresponding to each target image into the attention enhancement and suppression module to obtain the attention enhancement feature map and the attention suppression feature map corresponding to each target image, and inputting the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network;

[0009] The feature maps, intra-image enhanced feature maps and attention enhanced feature maps corresponding to each target image are input into the classification module to obtain the classification results of the target image pairs.

[0010] In one embodiment, the feature map includes multiple channels of different features; the channel interaction operation unit operates each feature map to obtain an intra-image enhanced feature map and a cross-image enhanced feature map corresponding to each target image, including:

[0011] The channel interaction operation unit calculates the channel correlation between different features contained in each feature map to obtain the intra-image channel similarity matrix of each feature map and the cross-image channel similarity matrix between each feature map;

[0012] The channel interaction operation unit performs weighted calculation on each feature map according to the intra-image channel similarity matrix and the cross-image channel similarity matrix corresponding to each feature map, so as to obtain an intra-image interaction feature map and a cross-image interaction feature map corresponding to each feature map;

[0013] The channel interaction operation unit performs convolution operation on the intra-image interaction feature map and the cross-image interaction feature map corresponding to each feature map, and aggregates each intra-image interaction feature map and each cross-image interaction feature map after the convolution operation with their corresponding feature maps to obtain the intra-image enhanced feature map and the cross-image enhanced feature map corresponding to each target image.

[0014] In one embodiment, the channel interaction operation unit calculates the channel correlation between different features included in each feature map to obtain the intra-image channel similarity matrix of each feature map and the cross-image channel similarity matrix between the feature maps, including:

[0015] The channel interaction operation unit performs bilinear operations between each feature map to obtain the channel correlation matrix between each feature map, and calculates the intra-image channel similarity matrix of each feature map itself and the cross-image channel similarity matrix between each feature map through a normalized exponential function based on the channel correlation matrix between each feature map.

[0016] In one embodiment, the cross-image enhancement feature map corresponding to each target image is input into the attention enhancement and suppression module to obtain the attention enhancement feature map and the attention suppression feature map corresponding to each target image, including:

[0017] The cross-image enhancement feature map corresponding to each target image is input into the attention enhancement and suppression module, and the attention enhancement and suppression module obtains the attention enhancement mask corresponding to each cross-image enhancement feature map according to each cross-image enhancement feature map, and obtains the attention suppression mask corresponding to each cross-image enhancement feature map according to the attention enhancement mask;

[0018] According to each cross-image enhancement feature map and its corresponding attention enhancement mask, the attention enhancement feature map corresponding to each target image is obtained, and according to each cross-image enhancement feature map and its corresponding attention suppression mask, the attention suppression feature map corresponding to each target image is obtained.

[0019] In one embodiment, the attention enhancement and suppression module obtains the attention enhancement mask corresponding to each cross-image enhancement feature map according to each cross-image enhancement feature map, including:

[0020] The attention enhancement and suppression module performs global average pooling operations on each cross-image enhanced feature map to obtain the channel importance of each feature in each cross-image enhanced feature map;

[0021] The feature map corresponding to the feature with the largest channel importance in each cross-image enhanced feature map is selected as the attention map, and the attention enhancement mask corresponding to each cross-image enhanced feature map is obtained according to the attention map.

[0022] In one embodiment, the classification module includes a back propagation neural network and a classifier, and the feature map corresponding to each target image, the image enhancement feature map and the attention enhancement feature map are input into the classification module to obtain the classification results of the target image pair, including:

[0023] The feature map, the intra-image enhanced feature map and the attention enhanced feature map corresponding to each target image are input into the back propagation neural network to obtain the classification prediction results corresponding to each target image;

[0024] Each classification prediction result is input into the classifier, and the classifier determines the classification result of the target image pair according to each classification prediction result.

[0025] In one embodiment, the method further comprises:

[0026] Randomly select two different images of the same type from the test image set to generate training image pairs;

[0027] Input the training image pairs into the channel interactive attention network to obtain the feature map corresponding to each image in the training image pair, the intra-image enhancement feature map, the attention enhancement feature map and the attention suppression feature map;

[0028] The feature map, in-image enhancement feature map, attention enhancement feature map and attention suppression feature map corresponding to each image are input into the last fully connected layer of the channel interaction attention network. The back propagation algorithm is used to train the parameters of the channel interaction attention network based on the preset target loss function to obtain the trained channel interaction attention network.

[0029] In a second aspect, an embodiment of the present application provides a fine-grained image classification device, which is based on a channel interaction attention network, and the channel interaction attention network includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the device includes:

[0030] An image acquisition module is used to acquire a target image pair to be classified, wherein the target image pair includes two different target images belonging to the same category;

[0031] A channel interaction structure module is used to input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction module includes a feature extraction network and a channel interaction operation unit, the feature extraction network is used to perform feature extraction on each target image in the input target image pair to output a feature map corresponding to each target image, and the channel interaction operation unit operates on each feature map to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image;

[0032] an attention processing module, used for inputting the cross-image enhancement feature map corresponding to each target image into the attention enhancement and suppression module, obtaining the attention enhancement feature map and the attention suppression feature map corresponding to each target image, and inputting the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network;

[0033] The image classification module is used to input the feature mapping diagram, the intra-image enhanced feature diagram and the attention enhanced feature diagram corresponding to each target image into the classification module to obtain the classification result of the target image pair.

[0034] In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the fine-grained image classification method as described in any of the above embodiments.

[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a fine-grained image classification method as in any of the above embodiments.

[0036] In summary, compared with the prior art, the technical solution provided in the embodiment of the present application has at least the following beneficial effects:

[0037] An embodiment of the present application provides a fine-grained image classification method, which is based on a channel interaction attention network, and the channel interaction attention network includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the method includes: obtaining a target image pair to be classified, the target image pair includes two different target images belonging to the same category, that is, the method can identify fine-grained objects by comparing image pairs instead of observing single images separately, which is helpful to identify common features and learn contrast difference features from different images; input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction operation unit operates on each feature map to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image The feature map can more accurately determine the key features in the image and the features of the common attention area of ​​the two images; the cross-image enhanced feature map corresponding to each target image is input into the attention enhancement and suppression module to obtain the attention enhancement feature map and attention suppression feature map corresponding to each target image, and the two attention suppression feature maps are input into the feature extraction network to train the feature extraction network. Attention enhancement can make the channel interaction attention network better focus on the common features of the image pair, while attention suppression can erase the common key features of the image pair, and re-input the suppressed image into the feature extraction network, so that the feature extraction network learns the difference features of the image pair; the feature map corresponding to each target image, the image enhancement feature map and the attention enhancement feature map are input into the classification module to obtain the classification result of the target image pair. The above method can use the target image pair for classification, use the channel interaction module to simultaneously focus on the channel correlation of the image pair and the image, more accurately locate the key features inside the image and the common attention features of the two images, and use the attention enhancement and suppression module to enhance the common features of the image pair and suppress the salient area of ​​the image, so that the feature extraction network can better learn the difference information in the image pair, thereby extracting features more accurately. In summary, this method has the ability to accurately locate key areas and efficiently extract features, which can improve the accuracy of fine-grained image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A flowchart of a fine-grained image classification method provided for an exemplary embodiment of the present application.

[0039] Figure 2 A structural diagram of a channel interaction attention network provided for an exemplary embodiment of the present application.

[0040] Figure 3 A flowchart of channel interaction operation steps provided for an exemplary embodiment of the present application.

[0041] Figure 4 A structural diagram of an attention enhancement and suppression module provided for an exemplary embodiment of the present application.

[0042] Figure 5 A flowchart of network training steps provided for an exemplary embodiment of the present application.

[0043] Figure 6 A structural diagram of a fine-grained image classification device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] See also Figure 1 and Figure 2 , the embodiment of the present application provides a fine-grained image classification method, which is based on a channel interaction attention network (CIA-NET), the channel interaction attention network includes a channel interaction module, an attention enhancement and suppression module and a classification module, and the channel interaction attention network is set in a terminal or a server, wherein the server can be implemented by an independent server or a server cluster composed of multiple servers, and the terminal can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The following is an example of an execution subject being a terminal with a channel interaction attention network, and the method specifically includes the following steps:

[0046] Step S1, obtaining a target image pair to be classified, where the target image pair includes two different target images belonging to the same category.

[0047] Here, a target image pair refers to a pair of images, which includes two different images belonging to the same category; for example, two different images of the same bird, the same car, or the same model of airplane.

[0048] Specifically, the terminal obtains two different target images to be classified and belonging to the same category as a target image pair.

[0049] In some implementations, the terminal may first obtain an original image pair, where the original image pair includes two different original images of the same category; and then preprocess each original image in the original image pair to obtain a target image pair to be classified.

[0050] Furthermore, each original image in the original image pair can be pre-processed by cropping each original image into an image of a preset size; for example, both original images can be randomly cropped into images of 448 pixels × 448 pixels in size; or the two original images can be first adjusted to images of the same size, and then an image of a preset size can be cropped from the above images as a target image; for example, both original images can be scaled to a size of 600 pixels × 600 pixels, and then an image area of ​​448 pixels × 448 pixels can be cropped with the center of the scaled image as the center.

[0051] Step S2: input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair.

[0052] Among them, the channel interaction module includes a feature extraction network and a channel interaction operation unit. The feature extraction network is used to extract features from each target image in the input target image pair to output a feature map corresponding to each target image. The channel interaction operation unit operates on each feature map to obtain an intra-image enhanced feature map and a cross-image enhanced feature map corresponding to each target image.

[0053] In the specific implementation process, the feature extraction network can use a convolutional neural network (CNN), and the two target images in the target image pair are respectively input into a branch of the convolutional neural network, and each branch outputs a feature map corresponding to the target image; each feature map can contain multiple different channels, and each channel of the feature map can be regarded as a representation of a specific feature, and its value is a response to the current feature strength. For example: given an image pair I1 and I2 of the same category, feature map F′1, Represents the feature map output by the convolutional neural network of two images, where c, w and h represent the number of channels, width and height of the feature map respectively. The output features can be reshaped l=w×h. The channel interaction operation unit can calculate the channel relationship within the image and the channel relationship across images of the two feature maps output by the two branches of the convolutional neural network, so as to better identify the common features between the target image pairs, and thus obtain the image-enhanced feature map and the cross-image enhanced feature map corresponding to the two feature maps. Among them, the channel relationship within the image refers to the channel correlation between the image and the image itself. The channel interaction operation unit can use bilinear operation to calculate the similarity between a certain channel and other channels within the image. The higher the similarity, the higher the correlation between the two channels, which plays a more decisive role in image classification; and the channel relationship across images refers to the channel correlation between an image and another image. The channel interaction operation unit can use bilinear operation to calculate the channel correlation between an image and another image.

[0054] Because fine-grained image classification mainly relies on the positioning of key areas and the learning of fine-grained features, by calculating the channel relationship within and across images, the common areas that both images focus on can be obtained. The features of the common areas help the model identify which category the object belongs to. For example, Image 1 and Image 2 are images of the same category, such as the same bird. Image 1 focuses on the head of the bird in the image, and Image 2 also focuses on the head of the bird in the image. Since both images focus on the head of the bird, it means that the head features of the bird can help the model identify which species the bird is.

[0055] In step S3, the cross-image enhancement feature map corresponding to each target image is input into the attention enhancement and suppression module to obtain the attention enhancement feature map and the attention suppression feature map corresponding to each target image, and the two attention suppression feature maps are input into the feature extraction network to train the feature extraction network.

[0056] Among them, the cross-image enhancement feature map enhances the features of the common attention area of ​​the two images in the image pair; and the attention enhancement and suppression module can further enhance the enhanced feature area in the cross-image enhancement feature map to obtain the attention enhancement feature map; on the other hand, it can also suppress the features of the common attention area of ​​the two images to obtain the attention suppression feature map. For example, when performing fine-grained classification of birds, the remaining features in the attention suppression feature map are generally the background, edge, tail, claws or beak of the bird. Since the tails, claws and beaks of different species of birds are different, it can help the model identify what kind of bird it is; the attention suppression feature map is input into the feature extraction network to train the feature extraction network, so that the feature extraction network can learn complementary information. Complementary information is generally a local feature with differences, such as the features of the tail, claws or beak, which helps to improve the accuracy of classification.

[0057] Step S4, inputting the feature mapping diagram, the intra-image enhanced feature diagram and the attention enhanced feature diagram corresponding to each target image into a classification module to obtain the classification result of the target image pair.

[0058] The classification module may include a dual-branch image classification network and a classifier. The feature map is the original feature map corresponding to the target image, the intra-image enhanced feature map is a feature map that enhances the key features inside the original feature map image, and the attention enhanced feature map is a feature map obtained by enhancing the features of the common areas of interest of the two images based on the cross-image enhanced feature map.

[0059] Specifically, the feature map, the image enhancement feature map, and the attention enhancement feature map corresponding to each target image can be input into a branch of the image classification network, each branch can output a predicted classification result, and the two predicted classification results output by the two branches of the image classification network are input into the classifier, and the classifier can calculate the two predicted classification results according to a preset weight ratio to obtain the final classification result. The above two predicted classification results are the classification results corresponding to the two target images.

[0060] In the specific implementation process, when the terminal executes the above steps S1 to S4, CIA-NET can be implemented through ResNet50 pre-trained on ImageNet, where the ImageNet project is a large-scale visual database for visual object recognition software research. ImageNet contains more than 20,000 categories, and a typical category, such as "balloon" or "strawberry", contains hundreds of images.

[0061] A fine-grained image classification method is provided in the above embodiment, and the method is based on a channel interaction attention network, and the channel interaction attention network includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the method includes: obtaining a target image pair to be classified, the target image pair includes two different target images belonging to the same category, that is, the method can identify fine-grained objects by comparing image pairs instead of observing a single image separately, which is helpful to identify common features and learn contrast difference features from different images; input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction operation unit operates on each feature map to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image. The method can more accurately determine the key features in the image and the features of the common attention area of ​​the two images; input the cross-image enhanced feature map corresponding to each target image into the attention enhancement and suppression module to obtain the attention enhancement feature map and attention suppression feature map corresponding to each target image, and input the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network. Attention enhancement can make the channel interaction attention network pay more attention to the common features of the image pair, while attention suppression can erase the common key features of the image pair, and re-input the suppressed image into the feature extraction network, so that the feature extraction network can learn the difference features of the image pair; input the feature map corresponding to each target image, the image enhancement feature map and the attention enhancement feature map into the classification module to obtain the classification result of the target image pair. The above method can use the target image pair for classification, use the channel interaction module to simultaneously pay attention to the channel correlation of the image pair and the image, more accurately locate the key features in the image and the common attention features of the two images, and use the attention enhancement and suppression module to enhance the common features of the image pair and suppress the salient area of ​​the image, so that the feature extraction network can better learn the difference information in the image pair, thereby extracting features more accurately. In summary, this method has the ability to accurately locate key areas and efficiently extract features, which can improve the accuracy of fine-grained image classification.

[0062] In some embodiments, the feature map contains multiple channels for different features. Figure 3 , step S2 specifically includes the following steps:

[0063] In step S21, the channel interaction operation unit calculates the channel correlation between different features included in each feature map to obtain the intra-image channel similarity matrix of each feature map itself and the cross-image channel similarity matrix between the feature maps.

[0064] In some embodiments, the channel interaction operation unit performs a bilinear operation between each feature map to obtain a channel correlation matrix between each feature map, and calculates the intra-image channel similarity matrix of each feature map itself and the cross-image channel similarity matrix between each feature map according to the channel correlation matrix between each feature map through a normalized exponential function. m and F n Perform bilinear operations between them to obtain the channel correlation matrix between feature maps Where m = 1, 2, n = 1, 2. Then take its negative value and obtain the corresponding channel similarity matrix through the normalized exponential function (softmax function):

[0065]

[0066] Where i represents F m The i-th channel of F n The channel similarity matrix includes the channel similarity matrix W within the image of the feature map F1 11 , the cross-image channel similarity matrix W between the feature map F1 and the feature map F2 12 , the channel similarity matrix W within the image of the feature map F2 22 And the cross-image channel similarity matrix W between the feature map F2 and the feature map F1 21 , that is, W 11 , W 12 , W 21 , W 22 is the channel similarity matrix between feature map F1 and feature map F2. 11 and W 22 It reflects the channel relationship within the image. 12 and W 21 is the channel relationship between images. 11 represents the channel correlation between the feature map F1 and the feature map F1. Similarly, W 12 , W 21 , W 22 Indicates the meaning.

[0067] In step S22, the channel interaction calculation unit performs weighted calculation on each feature map according to the intra-image channel similarity matrix and the cross-image channel similarity matrix corresponding to each feature map to obtain an intra-image interaction feature map and a cross-image interaction feature map corresponding to each feature map.

[0068] For example: the channel similarity matrix W 11 , W 12 , W 22 and W21 Weighted to the corresponding feature map, the interactive feature map is obtained as follows:

[0069]

[0070]

[0071]

[0072]

[0073] in, is the intra-image interaction feature map of feature map F1, is the cross-image interaction feature map of feature map F1, is the intra-image interaction feature map of feature map F2, It is the cross-image interaction feature map of the feature map F2.

[0074] In step S23, the channel interaction operation unit performs convolution operation on the intra-image interaction feature map and the cross-image interaction feature map corresponding to each feature map, and aggregates each intra-image interaction feature map and each cross-image interaction feature map after the convolution operation with their corresponding feature maps to obtain the intra-image enhancement feature map and the cross-image enhancement feature map corresponding to each target image.

[0075] For example, since the generated interactive feature map focuses on the common features between the image pairs, which may cause it to lose some feature information of the original feature map, the generated interactive feature map is convolved and aggregated with the original feature map to form an enhanced feature map as follows:

[0076]

[0077]

[0078]

[0079]

[0080] Among them, f 3×3 (·) represents the convolution operation with a filter size of 3×3, F 11 is the in-image enhancement feature map of the feature map F1, F 12 is the cross-image interaction feature map of feature map F1, F 22 is the in-image enhancement feature map of feature map F2, F 21 It is the cross-image interaction feature map of the feature map F2.

[0081] In the above embodiment, the method can simultaneously focus on the channel correlation between image pairs and within images, use bilinear operations to calculate the channel relationship within the image and the channel relationship between image pairs, more accurately identify the key features within the image and the common features between different images, which is conducive to improving the performance of fine-grained image classification.

[0082] In some embodiments, step S3 specifically includes the following steps:

[0083] The cross-image enhanced feature maps corresponding to each target image are input into the attention enhancement and suppression module. The attention enhancement and suppression module obtains the attention enhancement mask corresponding to each cross-image enhanced feature map according to each cross-image enhanced feature map, and obtains the attention suppression mask corresponding to each cross-image enhanced feature map according to the attention enhancement mask.

[0084] In some embodiments, see Figure 4 The structure diagram of the attention enhancement and inhibition module. The function of the attention enhancement and inhibition module can be expressed as: ABSM(F) = (F b ,F s ), that is, given a feature map F, the ABSM module outputs an attention-enhanced feature map F b and attention suppression feature map F s .

[0085] Specifically, the attention enhancement and suppression module can perform global average pooling operations on each cross-image enhancement feature map to obtain the channel importance of each feature in each cross-image enhancement feature map; and select the feature map corresponding to the feature with the largest channel importance in each cross-image enhancement feature map as the attention map, and obtain the attention enhancement mask corresponding to each cross-image enhancement feature map according to the attention map. For example: the cross-image interaction feature map F output by the channel interaction module 12 、F 21 As F, first perform global average pooling on the feature map F to obtain the importance M of each channel F(k,x,y) in the feature map F k The formula is:

[0086] M k =GAP(F(k,x,y))

[0087] Among them, k represents the channel index, x, y represents the spatial index. Then select M k The feature map of the channel corresponding to the maximum value is used as the attention map, and the attention map is upsampled to the original feature map size to obtain the attention enhancement mask A b The (x,y) formula is as follows:

[0088]

[0089] Since attention enhancement aims to enhance attention to common features of similar images, but ignores other subtle clues containing complementary information, it is proposed to suppress salient areas in the image to capture subtle complementary features.

[0090] Based on the attention enhancement mask, we transform the elements A that are greater than the threshold θ into b (x, y) is set to 0 and other elements are set to 1 to obtain the attention suppression mask A s The (x,y) formula is as follows:

[0091]

[0092] According to each cross-image enhancement feature map and its corresponding attention enhancement mask, the attention enhancement feature map corresponding to each target image is obtained, and according to each cross-image enhancement feature map and its corresponding attention suppression mask, the attention suppression feature map corresponding to each target image is obtained.

[0093] For example: Get the attention-enhanced feature map F by boosting the most significant part b , the formula is as follows:

[0094]

[0095] Among them, α is a hyperparameter used to control the degree of feature enhancement. Indicates element-wise multiplication. In practical applications, when α<0.9, the gradual increase of α can improve the classification accuracy of the model, while when α>0.9, the performance of the model begins to decline. Therefore, when the hyperparameter α=0.9 is selected, CIA-NET has the best performance.

[0096] Place the suppressed attention mask on the original target image to obtain the attention suppression feature map F of the target image s , the formula is as follows:

[0097]

[0098] Because F s The most prominent key areas in the image are suppressed, and the potential local features in the image will be prominent in the feature extraction network, which is conducive to the learning and training of the feature extraction network.

[0099] In the above embodiment, the method can introduce an attention enhancement and suppression module after the channel interaction module. On the one hand, the common features of the image pair are further enhanced on the basis of the cross-image enhanced feature map to obtain the attention enhanced feature map; on the other hand, the salient area of ​​the image is suppressed, so that the feature extraction network is prompted to better learn the fine-grained difference information in the image pair, which is conducive to improving the accuracy of fine-grained image classification.

[0100] In some embodiments, the classification module includes a back propagation neural network (BPNN) and a classifier, and the feature map corresponding to each target image, the image enhancement feature map and the attention enhancement feature map are input into the classification module to obtain the classification results of the target image pair, including:

[0101] The feature maps, intra-image enhanced feature maps and attention enhanced feature maps corresponding to each target image are input into the back propagation neural network to obtain the classification prediction results corresponding to each target image.

[0102] Each classification prediction result is input into the classifier, and the classifier determines the classification result of the target image pair according to each classification prediction result.

[0103] In some implementations, the classifier may calculate an average of the classification prediction results, and determine the classification result of the target image pair based on the average.

[0104] In the above embodiment, the method can input the feature maps corresponding to each target image, the image-enhanced feature maps and the attention-enhanced feature maps into the back-propagation neural network, and then determine the final classification results of the target image pair through the classifier according to the classification prediction results corresponding to the two target images respectively. It combines the key features within the image, the common features between different images and the difference features in the image pairs, and can improve the accuracy of fine-grained image classification.

[0105] In some embodiments, see Figure 5 The method further comprises a network training step, which specifically comprises the following steps:

[0106] Step S51: randomly select two different images of the same type from the test image set to generate a training image pair.

[0107] Step S52, input the training image pair into the channel interactive attention network to obtain a feature map corresponding to each image in the training image pair, an intra-image enhancement feature map, an attention enhancement feature map, and an attention suppression feature map.

[0108] In step S53, the feature maps, in-image enhancement feature maps, attention enhancement feature maps and attention suppression feature maps corresponding to each image are input into the last fully connected layer of the channel interaction attention network, and the parameters of the channel interaction attention network are trained using the back propagation algorithm based on the preset target loss function to obtain a trained channel interaction attention network.

[0109] For example, during the training phase of the network, the feature information F corresponding to the image I in the training image pair can be row 、F w 、Fb 、F s Input to the fully connected layer with softmax function for final classification. row represents the feature map extracted from the original image, F w Represents the enhanced feature map within the image, F b represents the attention-enhanced feature map, F s Represents the attention suppression feature map. The preset objective loss function formula is as follows:

[0110]

[0111] in, represents the cross entropy loss between the predicted label and the true label, Representation based on feature F row 、F w 、F b and F s The predicted class label vector, Represents the true classification label vector.

[0112] In the above embodiment, the method can use the image feature map, the image enhancement feature map, the attention enhancement feature map and the attention suppression feature map to input the last fully connected layer of the channel interaction attention network, and consider the preset target loss function to use the back propagation algorithm to train the parameters of the channel interaction attention network, so that the channel interaction attention network can fully and effectively learn the global and local feature information, and obtain the channel interaction attention network with optimized parameters, which is conducive to improving the accuracy of classification.

[0113] See also Figure 6 The device is based on a channel interaction attention network, which includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the device includes:

[0114] An image acquisition module 100 is used to acquire a target image pair to be classified, wherein the target image pair includes two different target images belonging to the same category;

[0115] The channel interaction structure module 200 is used to input the target image pair into the channel interaction module to obtain the intra-image enhancement feature map and the cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction module includes a feature extraction network and a channel interaction operation unit, the feature extraction network is used to extract features from each target image in the input target image pair to output a feature map corresponding to each target image, and the channel interaction operation unit operates on each feature map to obtain the intra-image enhancement feature map and the cross-image enhancement feature map corresponding to each target image;

[0116] An attention processing module 300 is used to input the cross-image enhancement feature map corresponding to each target image into the attention enhancement and suppression module to obtain the attention enhancement feature map and the attention suppression feature map corresponding to each target image, and input the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network;

[0117] The image classification module 400 is used to input the feature mapping diagram, the intra-image enhancement feature diagram and the attention enhancement feature diagram corresponding to each target image into the classification module to obtain the classification result of the target image pair.

[0118] For the specific definition of the fine-grained image classification device provided in this embodiment, please refer to the embodiment of the fine-grained image classification method above, which will not be repeated here. Each module in the above-mentioned fine-grained image classification device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0119] The embodiment of the present application provides a computer device, which may include a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the processor executes the steps of the fine-grained image classification method as in any of the above embodiments.

[0120] The working process, working details and technical effects of the computer device provided in this embodiment can be found in the above embodiments of the fine-grained image classification method, which will not be described in detail here.

[0121] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the fine-grained image classification method as described in any of the above embodiments are implemented. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick, etc. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0122] The working process, working details and technical effects of the computer-readable storage medium provided in this embodiment can be found in the above embodiments of the fine-grained image classification method, and will not be described in detail here.

[0123] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0124] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0125] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A fine-grained image classification method, characterized in that: The method is based on a channel interaction attention network, which includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the method includes: Acquire a target image pair to be classified, wherein the target image pair includes two different target images belonging to the same category; Input the target image pair into the channel interaction module to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction module comprises a feature extraction network and a channel interaction operation unit, the feature extraction network is used to perform feature extraction on each target image in the input target image pair to output a feature map corresponding to each target image, and the channel interaction operation unit operates on each of the feature maps to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image; Inputting the cross-image enhancement feature map corresponding to each of the target images into the attention enhancement and suppression module to obtain an attention enhancement feature map and an attention suppression feature map corresponding to each of the target images, and inputting the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network; The feature maps, in-image enhancement feature maps and attention enhancement feature maps corresponding to each of the target images are input into the classification module to obtain the classification results of the target image pairs.

2. The method according to claim 1, characterized in that The feature map includes a plurality of channels with different features; the channel interaction operation unit operates each of the feature maps to obtain an intra-image enhanced feature map and a cross-image enhanced feature map corresponding to each target image, including: The channel interaction operation unit calculates the channel correlation between different features included in each feature map to obtain the intra-image channel similarity matrix of each feature map and the cross-image channel similarity matrix between the feature maps; The channel interaction calculation unit performs weighted calculation on each of the feature maps according to the intra-image channel similarity matrix and the cross-image channel similarity matrix corresponding to each of the feature maps to obtain an intra-image interaction feature map and a cross-image interaction feature map corresponding to each of the feature maps; The channel interaction operation unit performs convolution operation on the intra-image interaction feature map and the cross-image interaction feature map corresponding to each of the feature maps, and aggregates each of the intra-image interaction feature map and each of the cross-image interaction feature maps after the convolution operation with their corresponding feature maps to obtain the intra-image enhanced feature map and the cross-image enhanced feature map corresponding to each target image.

3. The method according to claim 2, characterized in that The channel interaction operation unit calculates the channel correlation between different features included in each feature map to obtain the intra-image channel similarity matrix of each feature map and the cross-image channel similarity matrix between the feature maps, including: The channel interaction operation unit performs a bilinear operation between each of the feature maps to obtain a channel correlation matrix between each of the feature maps, and calculates the intra-image channel similarity matrix of each feature map itself and the cross-image channel similarity matrix between each of the feature maps based on the channel correlation matrix between the feature maps through a normalized exponential function.

4. The method according to claim 1, characterized in that The step of inputting the cross-image enhancement feature map corresponding to each of the target images into the attention enhancement and suppression module to obtain the attention enhancement feature map and the attention suppression feature map corresponding to each of the target images comprises: Inputting the cross-image enhanced feature maps corresponding to each of the target images into the attention enhancement and suppression module, the attention enhancement and suppression module obtains the attention enhancement mask corresponding to each of the cross-image enhanced feature maps according to each of the cross-image enhanced feature maps, and obtains the attention suppression mask corresponding to each of the cross-image enhanced feature maps according to the attention enhancement mask; According to each of the cross-image enhancement feature maps and its corresponding attention enhancement mask, the attention enhancement feature map corresponding to each of the target images is obtained, and according to each of the cross-image enhancement feature maps and its corresponding attention suppression mask, the attention suppression feature map corresponding to each of the target images is obtained.

5. The method according to claim 4, characterized in that The attention enhancement and suppression module obtains the attention enhancement mask corresponding to each cross-image enhancement feature map according to each cross-image enhancement feature map, including: The attention enhancement and suppression module performs a global average pooling operation on each of the cross-image enhanced feature maps to obtain the channel importance of each feature in each of the cross-image enhanced feature maps; And the feature map corresponding to the feature with the largest channel importance in each cross-image enhanced feature map is selected as the attention map, and the attention enhancement mask corresponding to each cross-image enhanced feature map is obtained according to the attention map.

6. The method according to any one of claims 1 to 5, characterized in that: The classification module includes a back propagation neural network and a classifier, and the feature map corresponding to each of the target images, the image enhancement feature map and the attention enhancement feature map are input into the classification module to obtain the classification result of the target image pair, including: Inputting the feature map, the intra-image enhanced feature map and the attention enhanced feature map corresponding to each of the target images into the back propagation neural network to obtain the classification prediction results corresponding to each of the target images; Each of the classification prediction results is input into the classifier, and the classifier determines the classification result of the target image pair according to each of the classification prediction results.

7. The method according to claim 6, characterized in that The method further comprises: Randomly select two different images of the same type from the test image set to generate training image pairs; Inputting the training image pair into the channel interaction attention network to obtain a feature map, an intra-image enhancement feature map, an attention enhancement feature map, and an attention suppression feature map corresponding to each image in the training image pair; The feature maps, in-image enhancement feature maps, attention enhancement feature maps and attention suppression feature maps corresponding to each of the images are input into the last fully connected layer of the channel interaction attention network, and the parameters of the channel interaction attention network are trained using a back propagation algorithm based on a preset target loss function to obtain a trained channel interaction attention network.

8. A fine-grained image classification device, characterized in that: The device is based on a channel interaction attention network, which includes a channel interaction module, an attention enhancement and suppression module, and a classification module; the device includes: An image acquisition module, used to acquire a target image pair to be classified, wherein the target image pair includes two different target images belonging to the same category; A channel interaction structure module, used for inputting the target image pair into the channel interaction module, and obtaining an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image in the target image pair; wherein the channel interaction module comprises a feature extraction network and a channel interaction operation unit, the feature extraction network is used for performing feature extraction on each target image in the input target image pair to output a feature map corresponding to each target image, and the channel interaction operation unit operates on each of the feature maps to obtain an intra-image enhancement feature map and a cross-image enhancement feature map corresponding to each target image; an attention processing module, configured to input the cross-image enhancement feature map corresponding to each of the target images into the attention enhancement and suppression module, obtain an attention enhancement feature map and an attention suppression feature map corresponding to each of the target images, and input the obtained two attention suppression feature maps into the feature extraction network to train the feature extraction network; The image classification module is used to input the feature mapping diagram, the image enhancement feature diagram and the attention enhancement feature diagram corresponding to each of the target images into the classification module to obtain the classification result of the target image pair.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.