Method, system and medium for automatic image annotation based on attention disturbance

CN114359659BActive Publication Date: 2024-09-06SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111550104.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2024-09-06
Estimated Expiration
2041-12-17

Smart Images

  • Figure CN114359659B
    Figure CN114359659B
Patent Text Reader

Abstract

The present invention discloses an automatic image annotation method, system and medium based on attention perturbation, and the method includes the following steps: dividing a dataset to be annotated into a labeled dataset and an unlabeled dataset, performing image enhancement on the labeled dataset to expand the dataset, and annotating with corresponding labels; constructing a generative adversarial network based on an attention perturbation mechanism, wherein the generative adversarial network includes an image autoencoder, a generator and a discriminator; iteratively training the generative adversarial network using the dataset to be annotated, and optimizing the multi-task fully connected classification network of the discriminator using the expanded labeled dataset; and classifying and annotating the unlabeled images to be annotated using the trained discriminator. The method constructs a generative adversarial network based on an attention perturbation mechanism, and introduces a multi-task fully connected classification network. Through adversarial training, the image feature representation is optimized, the automatic annotation of the image is realized, and the diversity and quality of image generation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an automatic image annotation method, system and medium based on attention disturbance. Background Art

[0002] As an important information carrier in modern society, images are widely used in all walks of life due to their natural fit with human visual perception. However, in today's big data era of information explosion, it is precisely because of the widespread application of images that the amount and categories of image data have increased significantly, making it more difficult to screen and filter specific categories of images. For example, social platforms need to retrieve and delete bad content from the massive amount of images uploaded every day, while manually reviewing the content is not only too labor-intensive but also inefficient.

[0003] In recent years, with the emergence of artificial intelligence technology, neural networks have achieved remarkable results in complex tasks such as image classification, image generation, and image conversion in the field of computer vision. The success of most cutting-edge applications is based on the premise that the image dataset used to train the neural network contains a large number of labeled samples. Therefore, labeling data samples is an indispensable part of artificial intelligence applications. Existing methods for automatic image labeling can be roughly divided into two categories. The first type of method is the unsupervised labeling method, which uses feature engineering to label samples, such as using the k-means algorithm to divide images into k categories in a certain feature space. This type of method does not require the use of the actual category information of the image and is simple and efficient. However, the data sets labeled by this method often have large intra-class differences, and the label information has no practical meaning and cannot provide reliable guidance for the network; the second type of method is the supervised labeling method, which requires the use of the actual category information of the image. At the same time, depending on whether prior knowledge of other data sets is used, this type of method can be specifically divided into supervised labeling methods based on transfer learning and supervised labeling methods based on own features. The former requires that the features of different data sets must have an intersection, otherwise the effective information of other data sets cannot be transferred to the target data set. The latter relies entirely on the features of its own data and requires effective hands-on learning to improve the understanding of the features.

[0004] As a generative model at the forefront of computer vision in recent years, the Generative Adversarial Network has a strong feature learning ability. The Generative Adversarial Network consists of a discriminator and a generator. The task of the discriminator is to correctly distinguish the difference between the generated image and the real image, while the generator needs to generate sufficiently realistic images to deceive the discriminator. Through this adversarial training method, the neural network can fit the data distribution. Although the Generative Adversarial Network has a strong learning ability, if there is a lack of supervision information during training, problems such as mode collapse, catastrophic forgetting, and cyclic performance will occur, which will cause the network to be unable to learn an effective representation of the characteristics of the data set. Summary of the invention

[0005] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a method, system and medium for automatic image annotation based on attention perturbation. The method constructs a generative adversarial network based on the attention perturbation mechanism and introduces a multi-task fully connected classification network. The method completes the learning of complex features of the data set through adversarial training, and automatically annotates images based on the learned feature representation, thereby improving the diversity and quality of image generation.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] On one hand, the present invention provides an automatic image annotation method based on attention perturbation, comprising the following steps:

[0008] According to whether the dataset to be labeled has corresponding labels, the dataset to be labeled is divided into labeled dataset and unlabeled dataset; image enhancement is performed on the labeled dataset to expand the dataset, and the corresponding labels are used for labeling;

[0009] A generative adversarial network based on an attention perturbation mechanism is constructed, wherein the generative adversarial network includes an image autoencoder, a generator, and a discriminator; the image autoencoder is used to reconstruct a real image; an attention perturbation mechanism is added to the generator to generate pseudo labels for the image; and a multi-task fully connected classification network is introduced into the discriminator to predict the specific category of the image;

[0010] Iteratively train the generative adversarial network using the unlabeled dataset, and use the expanded labeled dataset to optimize the multi-task fully connected classification network of the discriminator;

[0011] Use the trained discriminator to classify and annotate the unlabeled images.

[0012] As a preferred technical solution, the image autoencoder includes an image encoding module and an image decoding module, both of which have 4 convolutional layers, perform batch normalization on the output, and adopt a ReLU activation function; the image encoder in the image encoding module is used to perform PCA on the input image to obtain feature coding, and the image decoder in the image decoding module is used to decode the feature coding of the image into the input of the generator.

[0013] As a preferred technical solution, the generator sequentially includes 3 consecutive convolutional layers, an attention perturbation layer and a final convolutional layer;

[0014] The input image feature encoding is passed through three consecutive convolutional layers to obtain a feature tensor, and batch normalization is performed before output. The activation value is calculated using the ReLU activation function, and the feature tensor is input into the attention perturbation layer for attention perturbation to obtain the output tensor and pseudo-label; the output tensor is input into the last convolutional layer for convolution operation to obtain the generated image.

[0015] As a preferred technical solution, the attention disturbance is specifically:

[0016] Use three independent convolutional layers to transform the dimension of the input feature tensor, and obtain three different dimensional representations of the input feature tensor, denoted as Q, K, and V;

[0017] Randomly select the input feature tensor, select two of the three different dimensional representations of the selected feature tensor to exchange, and obtain the converted representation Q t , K t 、V t ;

[0018] Using Q t , K t 、V t Calculate the attention map of the feature tensor, multiply it by the weight variable σ and add it to the feature tensor as the perturbed output tensor;

[0019] Set a pseudo label of 1 for the unperturbed output tensor that is not selected; for the selected perturbed output tensor, set a pseudo label of 1 for the unperturbed output tensor according to Q t , K t 、V t Set the pseudo label value to 2 to 4;

[0020] The convolution kernel size of the independent convolution layer is 1×1, and the number of output channels is consistent with the input feature tensor.

[0021] As a preferred technical solution, the discriminator includes 4 continuous convolutional layers, a multi-task fully connected classification network and 1 fully connected layer; the convolutional layer adopts the ReLU activation function; the multi-task fully connected classification network consists of a perturbation classification layer and an image classification layer, and the 1 fully connected layer is an image true and false discrimination layer;

[0022] The input image is mapped into a feature tensor in the latent space of the discriminator through four consecutive convolutional layers, and then the feature tensor is stretched into a vector through reconstruction operation and used as the input of the multi-task fully connected classification network and the fully connected layer. The output of the image true or false discrimination layer is a 1-dimensional vector, which represents the prediction of the authenticity of the input image; the output of the perturbation classification layer is a 4-dimensional vector, which represents the pseudo-label prediction of the input image; the output of the image classification layer is an n-dimensional vector, which represents the category prediction of the input image, where n is the number of specific categories of images contained in the dataset to be labeled.

[0023] As a preferred technical solution, when training the generative adversarial network, the objective functions used include the autoencoder objective function, the generator and discriminator adversarial training objective function, and the multi-task fully connected classification network objective function in the discriminator;

[0024] The objective function of the image autoencoder is:

[0025] L AE =λ r L recon +λ p L prior ,

[0026] Among them, λ r , p is the coefficient of each loss, L recon is the L2 distance between the input image of the image autoencoder AE and the output image of the image decoder Dec in the latent space φ of the discriminator D, L prior The feature code z output by the image encoder Enc e Distribution And the feature space P that conforms to the 0-1 balanced distribution z The KL divergence, L recon With L prior The calculation method is as follows:

[0027] L recon =E x~p(x) ||φ(x)-φ(Dec(Enc(x)))|| 2 ,

[0028]

[0029] Where x represents the input image of the image codec AE, p(x) represents the probability distribution of the input image x, E represents the expectation, Pz (z e ) represents z e The probability of belonging to the feature space distribution, Indicates z e The probability of belonging to the feature encoding distribution;

[0030] The generator and discriminator adversarial training objective function is:

[0031] L GAN =E x~p(x) [log(D(x))]+E z~p(z) [log(1-D(G(z)))],

[0032] Among them, z is the code randomly sampled from the feature space, G is the generator, D is the discriminator, and p(z) represents the probability distribution of the feature space;

[0033] The objective function of the multi-task fully connected classification network in the discriminator is:

[0034]

[0035] Among them, λ f , s is the coefficient of each loss, cls f is the perturbation classification layer, cls s is the image classification layer, represents the perturbation classification loss function, Represents the image classification loss function, which is calculated as:

[0036]

[0037]

[0038] Among them, l f is the pseudo label generated by the attention perturbation mechanism, l s For the labeled dataset image x s The real label, Indicates that the perturbation classification layer output x belongs to l f The probability prediction of Represents the image classification layer output x s Belong to l s probability prediction.

[0039] As a preferred technical solution, the iterative training of the generative adversarial network is specifically as follows:

[0040] Using a batch of samples randomly sampled from the dataset to be labeled, calculate L AE , back propagation updates the image autoencoder AE once;

[0041] Using a batch of samples randomly sampled from the dataset to be labeled, calculate L GAN and Using a batch of randomly sampled samples from the labeled dataset, calculate Joint back propagation updates the discriminator D once;

[0042] Using a batch of samples randomly sampled from the dataset to be labeled, calculate L GAN , back propagation updates the generator G once;

[0043] Repeat the above steps to perform iterative training. After the training is completed, save the trained network parameters.

[0044] As a preferred technical solution, the trained discriminator is used to classify and annotate the unlabeled images to be annotated, specifically:

[0045] The discriminator loads the trained network parameters;

[0046] Input the unlabeled image to be annotated into the discriminator, and obtain the prediction value of the corresponding image through the image classification layer;

[0047] Annotate the image using the label corresponding to the dimension with the largest predicted value.

[0048] On the other hand, the present invention also provides an automatic image annotation system based on attention perturbation, which is applied to the above-mentioned automatic image annotation method based on attention perturbation, including a data processing module, a network construction module, a network training module and a result prediction module;

[0049] The data processing module is used to divide the data set to be labeled into a labeled data set and an unlabeled data set, and expand the labeled data set;

[0050] The network building module is used to construct a generative adversarial network based on the attention perturbation mechanism, including an image codec, a generator and a discriminator; the image codec is used to realize the reconstruction of the real image; the attention perturbation mechanism is added to the generator to generate pseudo labels of the image; the discriminator introduces a multi-task fully connected classification network to predict the specific category of the image;

[0051] The network training module is used to iteratively train the generative adversarial network using the to-be-labeled dataset, and simultaneously optimize the multi-task fully connected classification network of the discriminator using the expanded labeled dataset;

[0052] The result prediction module is used to classify and annotate unlabeled images using a trained discriminator.

[0053] Another aspect of the present invention provides a computer-readable storage medium storing a program, which, when executed, implements the above-mentioned automatic image annotation method based on attention perturbation.

[0054] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0055] (1) The method of the present invention realizes automatic image annotation by training a generative adversarial network based on the attention perturbation mechanism, reduces the workload of image annotators, and improves the efficiency of image annotation;

[0056] (2) The method of the present invention adds an attention perturbation mechanism in the generator to create pseudo labels for images, thereby combining self-supervised learning with generative adversarial networks, making the network distribution closer to the real data distribution;

[0057] (3) The method of the present invention optimizes the discriminator parameters and improves the classification network capability and discriminator quality by introducing a multi-task fully connected classification network into the discriminator;

[0058] (4) The method of the present invention is applicable to the development of applications with a large number of labeled images; in image representation learning, it provides the neural network with the ability to represent image features; in image generation, it improves the diversity and quality of image generation. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0060] Figure 1 A flowchart of an automatic image annotation method based on attention disturbance according to an embodiment of the present invention;

[0061] Figure 2 Schematic diagram of the structure of a generative adversarial network based on attention perturbation according to an embodiment of the present invention;

[0062] Figure 3 Schematic diagram of the structure of a generator based on the attention disturbance mechanism according to an embodiment of the present invention;

[0063] Figure 4 A schematic diagram of the structure of a discriminator of a multi-task fully connected classification network according to an embodiment of the present invention;

[0064] Figure 5 An iterative flow chart for training a generative adversarial network according to an embodiment of the present invention;

[0065] Figure 6A flow chart for classifying and labeling an embodiment of the present invention;

[0066] Figure 7 This is a structural diagram of an automatic image annotation system based on attention disturbance according to an embodiment of the present invention;

[0067] Figure 8 A structural diagram of a computer-readable storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION

[0068] In order to enable those skilled in the art to better understand the present application, the technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments and drawings in the present application. It should be understood that the drawings are only used for exemplary illustration and cannot be understood as limitations on this patent. 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 those skilled in the art without making creative work are within the scope of protection of this application.

[0069] Reference to "embodiment" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0070] Example

[0071] like Figure 1 As shown, this embodiment provides an automatic image annotation method based on attention disturbance, comprising the following steps:

[0072] S1. Divide the dataset to be labeled into a labeled dataset and an unlabeled dataset according to whether the dataset has a corresponding label; perform image enhancement on the labeled dataset to expand the dataset, and annotate it with the corresponding label;

[0073] This embodiment uses the public image dataset STL10 as an example for illustration, but this does not mean that the invention is limited to this dataset. The invention is applicable to any image dataset that meets the conditions.

[0074] In step S1, for the image dataset STL10, it is first divided into a labeled dataset and an unlabeled dataset according to whether STL10 has a corresponding label. The STL10 dataset contains 13,000 labeled images in 10 categories and 100,000 unlabeled images. After the division is completed, the labeled dataset is center cropped and rotated for image enhancement, and the enhanced samples are annotated with corresponding labels to expand the labeled dataset to 52,000.

[0075] S2. Construct a generative adversarial network based on the attention perturbation mechanism, such as Figure 2 As shown in the figure, the generative adversarial network includes an image autoencoder, a generator and a discriminator; the image autoencoder is used to reconstruct the real image; an attention perturbation mechanism is added to the generator to generate pseudo labels for the image; the discriminator introduces a multi-task fully connected classification network to predict the specific category of the image;

[0076] S3, iteratively train the generative adversarial network using the unlabeled dataset, and use the expanded labeled dataset to optimize the multi-task fully connected classification network of the discriminator;

[0077] S4. Use the trained discriminator to classify and annotate the unlabeled images.

[0078] More specifically, the image autoencoder includes an image encoding module and an image decoding module, both of which have 4 convolutional layers, perform batch normalization on the output, and use a ReLU activation function; the image encoder in the image encoding module is used to perform PCA on the input image to obtain feature coding, and the image decoder in the image decoding module is used to decode the feature coding of the image into the input of the generator.

[0079] More specifically, Figure 3 As shown in the figure, the generator includes 3 consecutive convolutional layers, an attention perturbation layer and a last convolutional layer in sequence; the input image feature encoding is passed through 3 consecutive convolutional layers to obtain a feature tensor, and batch normalization is performed before output. The activation value is calculated using the ReLU activation function, and the feature tensor is input into the attention perturbation layer for attention perturbation to obtain the output tensor and pseudo-label; the output tensor is input into the last convolutional layer for convolution operation to obtain the generated image;

[0080] More specifically, the specific steps for attention perturbation are:

[0081] Use three independent convolutional layers to transform the dimension of the input feature tensor. The convolution kernel size is 1×1. The number of output channels is consistent with the input feature tensor. Three different dimensional representations of the input feature tensor are obtained, which are recorded as Q, K, and V.

[0082] Randomly select the input feature tensor, select two of the three different dimensional representations of the selected feature tensor to exchange, and obtain the converted representation Q t , K t 、V t ;

[0083] Using Q t , K t 、V t Calculate the attention map of the feature tensor, multiply it by the weight variable σ and add it to the feature tensor as the perturbed output tensor;

[0084] Set a pseudo label of 1 for the unperturbed output tensor that is not selected; for the selected perturbed output tensor, set a pseudo label of 1 for the unperturbed output tensor according to Q t , K t 、V t Set the pseudo label value to 2 to 4.

[0085] More specifically, Figure 4 As shown in the figure, the discriminator includes 4 layers of continuous convolutional layers, a multi-task fully connected classification network and 1 fully connected layer; the convolutional layer uses the ReLU activation function; the introduced multi-task fully connected classification network consists of a perturbation classification layer and an image classification layer, and the 1 fully connected layer in the discriminator is an image true and false discrimination layer; the image true and false discrimination layer is used to output the binary classification prediction value of the image true and false, the perturbation classification layer is used to classify the image into pseudo labels, and the image classification layer is used to predict the true category of the image;

[0086] The input image is mapped into a feature tensor in the latent space of the discriminator through four consecutive convolutional layers, and then the feature tensor is stretched into a vector through reconstruction operation and used as the input of the multi-task fully connected classification network and the fully connected layer. The output of the image true or false discrimination layer is a 1-dimensional vector, which represents the prediction of the authenticity of the input image; the output of the perturbation classification layer is a 4-dimensional vector, which represents the pseudo-label prediction of the input image; the output of the image classification layer is an n-dimensional vector, which represents the category prediction of the input image, where n is the number of specific categories of images contained in the dataset to be labeled.

[0087] More specifically, when training a generative adversarial network, the objective functions used include the image autoencoder objective function, the generator and discriminator adversarial training objective function, and the multi-task fully connected classification network objective function in the discriminator, specifically:

[0088] The objective function of the image autoencoder is:

[0089] L AE =λ r L recon +λ p L prior ,

[0090] Among them, λ r ,p is the coefficient of each loss, L recon is the L2 distance between the input image of the image autoencoder AE and the output image of its image decoder Dec in the latent space φ of the discriminator D, L prior The feature code z output by the image encoder Enc e Distribution And the feature space P that conforms to the 0-1 balanced distribution z The KL divergence, L recon With L prior The calculation method is as follows:

[0091] L recon =E x~p(x) ||φ(x)-φ(Dec(Enc(x)))|| 2 ,

[0092]

[0093] Where x represents the input image of the image codec AE, p(x) represents the probability distribution of the input image x, E represents the expectation, P z (z e ) represents z e The probability of belonging to the feature space distribution, Indicates z e The probability of belonging to the feature encoding distribution; through L recon The image autoencoder AE can be optimized to realize the basic function of image reconstruction. prior Regularizing the feature space makes the output of the image encoder Enc more compact.

[0094] The objective function of the adversarial training between the generator and the discriminator is:

[0095] L GAN =E x~p(x) [log(D(x))]+E z~p(z) [log(1-D(G(z)))],

[0096] Among them, z is the code randomly sampled from the feature space, G is the generator, D is the discriminator, and p(z) represents the probability distribution of the feature space;

[0097] The discriminator D needs to correctly distinguish between the real image x and the generated image G(z), while the generator G needs to make G(z) similar to x in order to deceive the discriminator. Through this adversarial training, the generator G can make the network distribution continuously approach the distribution of real data, while the discriminator D can continuously optimize the representation of the real data distribution.

[0098] The objective function of the multi-task fully connected classification network in the discriminator is:

[0099]

[0100] Among them, λ f , s is the coefficient of each loss, cls f is the perturbation classification layer, cls s is the image classification layer, represents the perturbation classification loss function, Represents the image classification loss function, which is calculated as:

[0101]

[0102]

[0103] Among them, l f is the pseudo label generated by the attention perturbation mechanism, l s For the labeled dataset image x s The real label, Indicates that the perturbation classification layer output x belongs to l f The probability prediction of Represents the image classification layer output x s Belong to l s This objective function not only improves the classification ability of the network, but also stabilizes and improves the representation quality of the discriminator learning by optimizing the discriminator parameters.

[0104] As shown in the following table, the trained generator is used to calculate the Fréchet Inception Distance (FID), thereby evaluating the gap between the network distribution and the real data distribution on the STL-10 dataset and verifying the effectiveness of the attention perturbation mechanism. The results are as follows:

[0105]

[0106] Compared with DistGAN and DAGAN, adding the attention perturbation mechanism in DistGAN can achieve lower FID, which verifies that the use of the attention perturbation mechanism can make the network distribution closer to the real data distribution.

[0107] More specifically, Figure 5 As shown in Figure 1, iterative training of the generative adversarial network is as follows:

[0108] First, use a batch of samples randomly sampled from the dataset to be labeled to calculate L AE , back propagation updates the image autoencoder AE once;

[0109] Then, a batch of samples randomly sampled from the dataset to be labeled are used to calculate L GAN and Using a batch of randomly sampled samples from the labeled dataset, calculate Joint back propagation updates the discriminator D once;

[0110] Finally, a batch of samples randomly sampled from the dataset to be labeled are used to calculate L GAN , back propagation updates the generator G once, thus completing one iteration of training;

[0111] Repeat the above iterative training steps. After the training is completed, save the trained network parameters for subsequent image annotation.

[0112] In this embodiment, the generative adversarial network uses the Adam optimizer for parameter optimization, with a learning rate of 0.0001, a batch size of 128, and a total of 300,000 iterations of training.

[0113] More specifically, Figure 6 As shown, the trained discriminator is used to classify and annotate the unlabeled images to be annotated, specifically:

[0114] The discriminator loads the trained network parameters;

[0115] Input the unlabeled image to be annotated into the discriminator, and obtain the prediction value of the corresponding image through the image classification layer;

[0116] Annotate the image using the label corresponding to the dimension with the largest predicted value.

[0117] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.

[0118] Based on the same idea as the automatic image annotation method based on attention disturbance in the above embodiment, the present invention also provides an automatic image annotation system based on attention disturbance, which can be used to perform the above automatic image annotation method based on attention disturbance. For ease of explanation, in the structural schematic diagram of the automatic image annotation system based on attention disturbance in this embodiment, only the parts related to the embodiment of the present invention are shown. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than the illustrated one, or combine certain components, or arrange the components differently.

[0119] like Figure 7 As shown, in another embodiment of the present application, a system for automatic image annotation based on attention disturbance is provided, and the system includes at least the following modules:

[0120] The data processing module is used to divide the data set to be labeled into a labeled data set and an unlabeled data set, and to expand the labeled data set;

[0121] The network building module is used to build a generative adversarial network based on the attention perturbation mechanism, including an image codec, a generator, and a discriminator. The image codec is used to reconstruct the real image. The attention perturbation mechanism is added to the generator to generate pseudo labels for the image. The discriminator introduces a multi-task fully connected classification network to predict the specific category of the image.

[0122] The network training module is used to iteratively train the generative adversarial network using the unlabeled dataset, and optimize the multi-task fully connected classification network of the discriminator using the expanded labeled dataset;

[0123] The result prediction module is used to classify and annotate unlabeled images using the trained discriminator.

[0124] It should be noted that the automatic image annotation system based on attention perturbation of the present invention corresponds one-to-one to the automatic image annotation method based on attention perturbation of the present invention. The technical features and beneficial effects described in the embodiment of the automatic image annotation method based on attention perturbation are applicable to the embodiment of the image annotation system based on attention perturbation. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.

[0125] In addition, in the implementation of the attention perturbation-based image annotation system in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the convenience of corresponding hardware configuration requirements or software implementation. That is, the internal structure of the attention perturbation-based image annotation system is divided into different program modules to complete all or part of the functions described above.

[0126] like Figure 8 As shown, in another embodiment, a computer-readable storage medium is further provided, in which a program is stored in a memory. When the program is executed by a processor, the above-mentioned automatic image annotation method based on attention disturbance is implemented, specifically:

[0127] According to whether the dataset to be labeled has corresponding labels, the dataset to be labeled is divided into labeled dataset and unlabeled dataset; the labeled dataset is image enhanced by using center cropping and rotation to expand the dataset, and the dataset is labeled with corresponding labels;

[0128] Construct a generative adversarial network based on the attention perturbation mechanism. The generative adversarial network includes an image autoencoder, a generator, and a discriminator. The image autoencoder is used to reconstruct the real image. The attention perturbation mechanism is added to the generator to generate pseudo labels for the image. The discriminator introduces a multi-task fully connected classification network to predict the specific category of the image.

[0129] Iteratively train the generative adversarial network using the unlabeled dataset, and use the expanded labeled dataset to optimize the multi-task fully connected classification network of the discriminator;

[0130] Use the trained discriminator to classify and annotate the unlabeled images.

[0131] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the 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.

[0132] 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.

[0133] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. The automatic image annotation method based on attention perturbation is characterized by: The steps include: According to whether the dataset to be labeled has corresponding labels, the dataset to be labeled is divided into labeled dataset and unlabeled dataset; image enhancement is performed on the labeled dataset to expand the dataset, and the corresponding labels are used for labeling; A generative adversarial network based on an attention perturbation mechanism is constructed, wherein the generative adversarial network includes an image autoencoder, a generator, and a discriminator; the image autoencoder is used to reconstruct a real image; an attention perturbation mechanism is added to the generator to generate pseudo labels for the image; and a multi-task fully connected classification network is introduced into the discriminator to predict the specific category of the image; Iteratively train the generative adversarial network using the unlabeled dataset, and use the expanded labeled dataset to optimize the multi-task fully connected classification network of the discriminator; Use the trained discriminator to classify and annotate the unlabeled images; The image autoencoder includes an image encoding module and an image decoding module, both of which have 4 convolutional layers, perform batch normalization on the output, and use a ReLU activation function; the image encoder in the image encoding module is used to perform PCA on the input image to obtain feature coding, and the image decoder in the image decoding module is used to decode the feature coding of the image into the input of the generator; The generator includes three consecutive convolutional layers, an attention perturbation layer and a final convolutional layer in sequence; The input image feature encoding is passed through three layers of continuous convolutional layers to obtain the feature tensor, and batch normalization is performed before output. The activation value is calculated using the ReLU activation function, and the feature tensor is input into the attention perturbation layer for attention perturbation to obtain the output tensor and pseudo-label; the output tensor is input into the last convolutional layer for convolution operation to obtain the generated image; The attention disturbance is specifically as follows: Use three independent convolutional layers to transform the dimension of the input feature tensor, and obtain three different dimensional representations of the input feature tensor, denoted as Q, K, and V; Randomly select the input feature tensor, select two of the three different dimensional representations of the selected feature tensor to exchange, and obtain the converted representation Q t , K t 、V t ; Using Q t , K t 、V t Calculate the attention map of the feature tensor, multiply it by the weight variable σ and add it to the feature tensor as the perturbed output tensor; Set a pseudo label of 1 for the unperturbed output tensor that is not selected; for the selected perturbed output tensor, set a pseudo label of 1 for the unperturbed output tensor according to Q t , K t 、V t Set the pseudo label value to 2 to 4; The convolution kernel size of the independent convolution layer is 1×1, and the number of output channels is consistent with the input feature tensor; The discriminator includes 4 continuous convolutional layers, a multi-task fully connected classification network and 1 fully connected layer; the convolutional layer adopts the ReLU activation function; the multi-task fully connected classification network consists of a perturbation classification layer and an image classification layer, and the 1 fully connected layer is an image true and false discrimination layer; The input image is mapped into a feature tensor in the latent space of the discriminator through four consecutive convolutional layers, and then the feature tensor is stretched into a vector through reconstruction operation and used as the input of the multi-task fully connected classification network and the fully connected layer. The output of the image true or false discrimination layer is a 1-dimensional vector, which represents the prediction of the authenticity of the input image; the output of the perturbation classification layer is a 4-dimensional vector, which represents the pseudo-label prediction of the input image; the output of the image classification layer is an n-dimensional vector, which represents the category prediction of the input image, where n is the number of specific categories of images contained in the dataset to be labeled.

2. The automatic image annotation method based on attention perturbation according to claim 1 is characterized in that: When training the generative adversarial network, the objective functions used include the autoencoder objective function, the generator and discriminator adversarial training objective function, and the multi-task fully connected classification network objective function in the discriminator.

3. The automatic image annotation method based on attention perturbation according to claim 1 is characterized in that: The iterative training of the generative adversarial network is specifically as follows: Use a batch of samples randomly sampled from the dataset to be labeled, calculate the autoencoder objective function, and back-propagate to update the image autoencoder AE once; Use a batch of samples randomly sampled from the dataset to be labeled to calculate the adversarial training objective function and the perturbation classification loss function of the generator and the discriminator. Use a batch of samples randomly sampled from the labeled dataset to calculate the image classification loss function, and jointly back-propagate to update the discriminator D once. Use a batch of samples randomly sampled from the dataset to be labeled, calculate the adversarial training objective function of the generator and the discriminator, and back-propagate to update the generator G once; Repeat the above steps to perform iterative training. After the training is completed, save the trained network parameters.

4. The automatic image annotation method based on attention perturbation according to claim 1 is characterized in that: The trained discriminator is used to classify and annotate the unlabeled images, specifically: The discriminator loads the trained network parameters; Input the unlabeled image to be annotated into the discriminator, and obtain the prediction value of the corresponding image through the image classification layer; Annotate the image using the label corresponding to the dimension with the largest predicted value.

5. An automatic image annotation system based on attention perturbation, applied to the automatic image annotation method based on attention perturbation according to any one of claims 1 to 4, characterized in that: It includes data processing module, network construction module, network training module and result prediction module; The data processing module is used to divide the data set to be labeled into a labeled data set and an unlabeled data set, and expand the labeled data set; The network building module is used to construct a generative adversarial network based on the attention perturbation mechanism, including an image codec, a generator and a discriminator; the image codec is used to realize the reconstruction of the real image; the attention perturbation mechanism is added to the generator to generate pseudo labels of the image; the discriminator introduces a multi-task fully connected classification network to predict the specific category of the image; The network training module is used to iteratively train the generative adversarial network using the to-be-labeled dataset, and simultaneously optimize the multi-task fully connected classification network of the discriminator using the expanded labeled dataset; The result prediction module is used to classify and annotate unlabeled images using a trained discriminator.

6. A computer-readable storage medium storing a program, characterized in that: When the program is executed, the automatic image annotation method based on attention perturbation described in any one of claims 1 to 4 is implemented.