Image classification method based on information bottleneck algorithm in image classification network

By using the information bottleneck algorithm and KL divergence loss function in the image classification network, the high-level feature matrix is ​​directly obtained and utilized, which solves the problem of complex structure and underutilization of high-level features, and improves the classification accuracy of adversarial samples and clean samples.

CN115019101BActive Publication Date: 2024-09-24XIDIAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210689203.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-16
Publication Date
2024-09-24
Estimated Expiration
2042-06-16

AI Technical Summary

Technical Problem

Existing technologies have problems in the adversarial training process of image classification networks, such as complex structures and underutilization of high-level features, resulting in misclassification of adversarial samples and clean samples.

Method used

The high-level feature matrix is ​​obtained through the feature extraction layer output of the image classification network, and the KL divergence loss function is used to calculate the divergence between the clean high-level features and the template high-level features and the divergence between the adversarial high-level features and the template high-level features to construct the total cost of the information bottleneck algorithm. Loss function, train the image classification network until the loss function converges.

Benefits of technology

It overcomes the problems of complex network structure and computational redundancy, makes full use of high-level features, and improves the classification accuracy of the image classification network for adversarial samples and clean samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115019101B
    Figure CN115019101B
Patent Text Reader

Abstract

The present invention discloses an image classification method based on an information bottleneck algorithm in an image classification network, which mainly solves the problem that the network structure is complex in the prior art and the high-level features of the deep learning network are not fully utilized during the training process. The implementation steps are: generating a clean sample set; constructing an image classification network; obtaining a trained template network by training the image classification network; generating an adversarial sample set; constructing a total cost loss function using the information bottleneck algorithm; training the image classification network to obtain a target network; and classifying the image to be classified. The present invention uses the output of the feature extraction layer in the image classification network to obtain the template high-level features, clean high-level features, and adversarial high-level features to iteratively optimize the image classification network, and uses the information bottleneck algorithm to construct a total cost loss function, which can be used to classify and identify targets in natural images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing technology, and further relates to an image classification method based on an information bottleneck algorithm in an image classification network in the field of image classification technology. The present invention can be used to classify and identify targets in natural images. Background Art

[0002] The most classic network in image classification is ResNet. ResNet effectively alleviates the gradient vanishing problem in neural network training by introducing "jump connections". The trained image classification network can achieve high accuracy in image classification tasks. However, image classification networks are actually quite fragile. When tiny perturbations that cannot be distinguished by the human eye are added to the input image, the network will make high-confidence misjudgments. This input with tiny perturbations that can interfere with the normal operation of the network is called an adversarial sample.

[0003] Nanjing University of Aeronautics and Astronautics disclosed an image classification method based on the combination of image preprocessing and adversarial training in an image classification network in its patent document "A method for defending against adversarial samples based on the combination of image preprocessing and adversarial training" (application number: CN202011383582.8, application publication number: CN112560901A). The implementation scheme of this method is: the original image and adversarial samples are divided into small blocks, DCT transformation is performed, and different compression ratios are applied to the original image to compress it to obtain different data sets, and then noise is added as a training adversarial sample to form a training data set together with the original image, and finally the training data set is input into the image classification network for training, thereby improving the network's image classification accuracy against adversarial attacks. However, the method still has the following shortcomings: in this method, adversarial training is only performed by image preprocessing, and only the input is modified, while the changes in the high-level features of the network caused by the modification of the input are ignored. Without the information in the high-level features of the network, the image classification network will not be able to obtain the connection between the adversarial sample and the clean sample, resulting in the image classification network misclassifying the image.

[0004] Kolchinsky proposed an image classification method based on variational autoencoders in image classification networks in his paper "Nonlinear Information Bottleneck" (InEntropy, 2019). This method adds a variational autoencoder structure to the image classification network to encode the high-level features of the image classification network, and uses variational inference to construct the lower bound of the optimization target and then uses clean samples for adversarial training, so that the image classification network can converge faster during training, while making it more difficult for the input to pass small perturbations through the information bottleneck, thereby improving the network's image classification accuracy against adversarial attacks. However, the method still has the following shortcomings: the method adds a variational autoencoder structure to the image classification network, and the variational autoencoder generates a large amount of normally distributed data when encoding high-level features, which will generate a large amount of redundant data in the calculation during training and make the structure of the image classification network complex. Summary of the invention

[0005] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose an image classification method based on the information bottleneck algorithm in an image classification network, aiming to solve the problems in the prior art that the network structure is complex during adversarial training and the high-level features of the image classification network are not fully utilized during the training process.

[0006] The idea of ​​achieving the purpose of the present invention is: the present invention directly obtains the high-level feature matrix of the image classification network through the output of the feature extraction layer in the image classification network, without adding additional structures in the image classification network, thus avoiding the problem of complex network structure in the adversarial training process in the prior art. The KL divergence loss function is used to calculate the divergence between the clean high-level features and the template high-level features, and the divergence between the adversarial high-level features and the template high-level features, respectively. After introducing the above two divergences into the information bottleneck algorithm, a total cost loss function is constructed, and the image classification network is trained until the loss function of the network converges, so that the image classification network learns the connection between the adversarial samples and the clean samples, and can correctly classify both the clean samples and the adversarial samples. In this way, the problem that the prior art does not fully utilize the high-level features of the image classification network during the training process is solved.

[0007] The implementation steps of the present invention are as follows:

[0008] Step 1: Generate a clean sample set:

[0009] According to the task of the image to be classified, at least 2 categories and at least 5,000 images of each category are selected to form a clean sample set, and each image is presented in the form of a matrix with the same dimension as the image size;

[0010] Step 2: Build an image classification network:

[0011] Construct an image classification network corresponding to the task of the image to be classified, which consists of a feature extraction layer and a linear classification layer in series, and set the parameters of each layer of the image classification network;

[0012] Step 3: Get the trained template network by training the image classification network:

[0013] Input the clean sample set into the image classification network, output the predicted category probability of each sample, use the cross entropy loss function to calculate the loss between the predicted category probability of each sample and the category label corresponding to the sample, update the parameters of the iterative target network through the back propagation algorithm until the cross entropy loss function converges, obtain the trained template network, and save the template high-level feature matrix output by the feature extraction layer in the template network when the training ends;

[0014] Step 4: Generate adversarial sample set:

[0015] Step 4.1, select an unselected clean sample from the clean sample set, add the selected sample to the random number matrix to obtain an intermediate matrix, input the intermediate matrix into the image classification network, obtain the reverse gradient matrix of the intermediate matrix through the back propagation algorithm, add the reverse gradient matrix to the clean sample to obtain the adversarial sample, and each adversarial sample is presented in the form of a matrix with the same dimension as the clean sample;

[0016] Step 4.2, determine whether all clean samples in the clean sample set have been selected. If so, execute step 5 after all adversarial samples are assembled into an adversarial sample set. Otherwise, execute step 4.1.

[0017] Step 5: Use the information bottleneck algorithm to construct the total cost loss function as follows:

[0018]

[0019] in, represents the total cost loss function, N represents the total number of samples in the clean sample set, ∑ represents the summation operation, and Z i represents the template high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the trained template network. log represents the logarithmic operation with base 2. X i It represents the clean high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the image classification network, W i It represents the adversarial high-level feature matrix output by the feature extraction layer after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network, Y i represents the category label corresponding to the clean sample set of the current iteration and the i-th sample in the adversarial sample set, Q iIt represents the predicted category probability output after the i-th sample in the clean sample set of the current iteration is input into the image classification network, P i It represents the predicted category probability output after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network;

[0020] Step 6: Train the image classification network to obtain the target network:

[0021] Input clean samples and adversarial samples into the image classification network in turn, output the predicted category probability of each training image, use the gradient descent method to update the parameters of the iterative image classification network, and determine whether the total cost loss function converges. If so, obtain the trained target network and execute step 7. Otherwise, save the image classification network parameters of the current iteration and execute step 4.

[0022] Step 7: Classify the image to be classified:

[0023] Scale each image to be classified to the same size as the sample in the clean sample set in step 1, input each image into the trained target network, output the predicted probability of each target category in the image, and take the category corresponding to the probability with the highest median value among all predicted probabilities as the classification result of the image corresponding to the image.

[0024] Compared with the prior art, the present invention has the following advantages:

[0025] First, since the present invention utilizes the output of the feature extraction layer in the image classification network to obtain the template high-level features, clean high-level features and adversarial high-level features to iteratively optimize the image classification network, it overcomes the defects of the prior art in which an additional structure is added to the image classification network, resulting in a complex network structure and excessive computational redundant data. The present invention ensures that the high-level features of the image classification network are utilized without modifying the original network structure, greatly reducing the generation of computational redundant data, accelerating the training speed, and improving the efficiency of the image classification network for image classification.

[0026] Second, since the present invention uses the information bottleneck algorithm to construct the total cost loss function, it overcomes the deficiency in the prior art that the high-level features of the image classification network are not fully utilized during the training process. The present invention can fully utilize the high-level features of the image classification network, ensure that the image classification network fully learns adversarial samples and clean samples, and improves the accuracy of image classification network in image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0028] Reference Figure 1The specific steps for implementing the present invention are further described in detail with reference to the accompanying drawings and embodiments.

[0029] Step 1: Generate a clean sample set.

[0030] Since the image classification task of the embodiment of the present invention is a small-size color natural image classification task, the selected clean sample set adopts the training set in the CiFar-10 natural image dataset. The training set in the natural image dataset contains 10 categories of object images, each category contains 5000 images, each image size is 32*32, the number of channels is 3, and each image is presented in the form of a matrix with a dimension of 3*32*32.

[0031] Step 2: Build an image classification network.

[0032] Since the VGG16 image classification network is generally recognized as the network that can complete image classification tasks with high accuracy in small-size color natural image classification tasks, the image classification network of an embodiment of the present invention is a VGG16 image classification network using the prior art, which is composed of a feature extraction layer and a linear classification layer connected in series.

[0033] The feature extraction layer is composed of thirteen convolution modules connected in sequence. Among them, the first, third, fifth, sixth, eighth, ninth, eleventh and twelfth convolution modules have the same structure, which are all composed of a convolution layer, a batch normalization layer and an activation layer connected in series. The second, fourth, seventh, tenth and thirteenth convolution modules have the same structure, which are all composed of a convolution layer, a batch normalization layer, an activation layer and a maximum pooling layer connected in series.

[0034] The number of input channels of the convolutional layers in the first, third, fifth, sixth, eighth, ninth, eleventh, and twelfth convolutional modules are set to 3, 64, 128, 256, 256, 512, 512, 512, respectively, and the number of output channels of the convolutional layers are set to 64, 128, 256, 256, 512, 512, 512, 512, respectively. The size of the convolution kernel is set to 3×3, and the activation function of the activation layer adopts the ReLU activation function.

[0035] The number of input channels of the convolutional layers in the second, fourth, seventh, tenth and thirteenth convolutional modules are set to 64, 128, 256, 512, and 512 respectively, and the number of output channels of the convolutional layers are set to 64, 128, 256, 512, and 512 respectively. The size of the convolution kernel is set to 3×3, the activation function of the activation layer adopts the ReLU activation function, the window size of the maximum pooling layer is set to 2×2, and the step size of the maximum pooling layer is set to 2.

[0036] The structure of the linear classification layer is: a first fully connected layer, a first activation layer, a second fully connected layer, a second activation layer, and an output layer.

[0037] The number of input nodes of the first and second fully connected layers is set to 512 and 4096 respectively, and the number of output nodes is set to 4096 and 4096 respectively. The activation function of the first and second activation layers adopts the ReLU activation function.

[0038] Step 3: Get the trained template network by training the image classification network.

[0039] Input the clean sample set into the image classification network, output the predicted category probability of each training image, use the cross entropy loss function to calculate the loss between the predicted category probability of each image and the category label corresponding to the image, and update the parameters of the iterative image classification network through the back propagation algorithm until the cross entropy loss function converges to obtain the trained template network. Save the template high-level features Z output by the feature extraction layer in the template network when the training ends.

[0040] The cross entropy loss function is as follows:

[0041]

[0042] Among them, J represents the cross entropy loss function, N represents the total number of images in the clean sample set, Σ represents the summation operation, i represents the sequence number of the image in the clean sample set, and Y i represents the category label corresponding to the i-th image in the clean sample set, log represents the logarithmic operation with base 2, and P i It represents the predicted category probability output after the i-th image in the clean sample set is input into the image classification network.

[0043] Step 4: Generate adversarial sample sets.

[0044] Step 4.1, select an unselected clean sample from the clean sample set, add the selected sample to the random number matrix to obtain an intermediate matrix. Input the intermediate matrix into the image classification network, obtain the reverse gradient matrix of the intermediate matrix through the back propagation algorithm, and add the reverse gradient matrix to the clean sample to obtain the adversarial sample. Each adversarial sample is presented in the form of a matrix with a dimension of 3*32*32.

[0045] The size of the random number matrix is ​​3*32*32, and is composed of 1024 random numbers whose absolute values ​​are smaller than the disturbance factor.

[0046] Step 4.2, determine whether all clean samples in the clean sample set have been selected. If so, execute step 5 after all adversarial samples are assembled into an adversarial sample set. Otherwise, execute step 4.1.

[0047] Step 5: Use the information bottleneck algorithm to construct the total cost loss function.

[0048] The total cost loss function is constructed using the information bottleneck algorithm as follows:

[0049]

[0050] in, represents the total cost loss function, N represents the total number of samples in the clean sample set, ∑ represents the summation operation, and Z i represents the template high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the trained template network. log represents the logarithmic operation with base 2. X i It represents the clean high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the image classification network, W i It represents the adversarial high-level feature matrix output by the feature extraction layer after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network, Y i represents the category label corresponding to the clean sample set of the current iteration and the i-th sample in the adversarial sample set, Q i It represents the predicted category probability output after the i-th sample in the clean sample set of the current iteration is input into the image classification network, P i It represents the predicted category probability output after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network;

[0051] Step 6: Train the image classification network to obtain the target network.

[0052] Input the clean samples and adversarial samples into the image classification network in turn, output the predicted category probability of each training image, use the gradient descent method to update the parameters of the iterative image classification network, and determine whether the total cost loss function converges. If so, execute step 7 after obtaining the trained target network, otherwise, save the image classification network parameters of the current iteration and execute step 4.

[0053] Step 7: classify the image to be classified.

[0054] Step 6.1, the image to be classified in the embodiment of the present invention adopts the test set images in the CiFar-10 natural image dataset, which contains object images of 10 categories, each category contains 1000 images, and the size of each image is the same as the clean sample generated in step 1.

[0055] In step 6.2, each image is input into the trained target network, and the predicted probability of each target category in the image is output. The category corresponding to the probability with the highest median value of all predicted probabilities is taken as the classification result of the image corresponding to the image.

[0056] The effect of the present invention is further described below in conjunction with simulation experiments.

[0057] 1. Simulation conditions:

[0058] The hardware platform of the simulation experiment of the present invention is: the processor is AMD Ryzen 7 3700X, the main frequency is 4.05GHz, the memory is 16GB, the graphics card is NVIDIA GeForce RTX 3070, and the video memory is 8G.

[0059] The software platforms for the simulation experiment of the present invention are: Windows 10 operating system, Python 3.8 and Pytorch1.9.0.

[0060] The input images used in the simulation experiment of the present invention are the test set in the CiFar-10 natural image dataset. The test set contains 10 categories of small object images, each category contains 1000 images, and the size of each image is 3*32*32 pixels.

[0061] 2. Simulation content and result analysis:

[0062] The simulation experiment of the present invention adopts the present invention and three existing technologies (TRADES classification method, ADT classification method, Fast_AT classification method) to classify the input CiFar-10 natural image and the Cifar-10 natural image processed by FGSM algorithm, PGD algorithm and C&W algorithm respectively to obtain classification results.

[0063] In the simulation experiment, the three existing technologies used are:

[0064] The prior art TRADES classification method refers to the natural image classification method proposed by Zhang H et al. in “Theoretically principled trade-off between robustness and accuracy, International Conference on Machine Learning, pp. 7472-7482, 2019”, referred to as the TRADES classification method.

[0065] The prior art ADT classification method refers to the natural image classification method proposed by Deng Z et al. in “Adversarial Distributional Training for Robust Deep Learning, Advances in Neural Information Processing Systems, pp. 1-24, 2020”, referred to as the ADT classification method.

[0066] The prior art Fast_AT classification method refers to the natural image classification method proposed by Wong E, et al. in “Fast is better than free: Revisiting adversarial training, International Conference on Learning Representations (ICLR), pp. 1-17, 2020”, referred to as the Fast_AT classification method.

[0067] In order to verify the simulation effect of the present invention, the classification results of the four methods in the simulation experiment of the present invention are evaluated using the total image classification accuracy. The total image classification accuracy is calculated using the following formula, and all calculation results are plotted in Table 1:

[0068]

[0069] Table 1. Quantitative analysis of the classification results of the present invention and the prior art in the simulation experiment

[0070]

[0071] From Table 1, it can be seen that the total image classification accuracy of the clean samples of the present invention is 85.0%, the total image classification accuracy of the samples generated by the FGSM algorithm is 79.0%, the total image classification accuracy of the samples generated by the PGD-20 algorithm is 78.8%, the total image classification accuracy of the samples generated by the PGD-100 algorithm is 78.7%, and the total image classification accuracy of the samples generated by the C&W algorithm is 84.9%. The difference between the first indicator and the four prior art methods is less than 3.6%, and the last three indicators are all higher than the three prior art methods, proving that the present invention can obtain higher natural image classification accuracy.

[0072] The above simulation experiments show that: the method of the present invention utilizes the output of the feature extraction layer in the image classification network to obtain the template high-level features, clean high-level features and adversarial high-level features to iteratively optimize the image classification network, which can ensure that the high-level features of the image classification network are utilized without modifying the original network structure, greatly reducing the generation of computationally redundant data, accelerating the training speed, and improving the efficiency of the image classification network for image classification. The total cost loss function is constructed using the information bottleneck algorithm, which can fully utilize the high-level features of the image classification network, ensuring that the image classification network fully learns adversarial samples and clean samples, and improving the accuracy of image classification network for image classification. It solves the defects of the prior art that additional structures are added to the image classification network, resulting in a complex network structure and excessive computational redundant data, and solves the deficiency of the prior art that the high-level features of the image classification network are not fully utilized during the training process. It is a very practical natural image classification method.

Claims

1. An image classification method based on information bottleneck algorithm in an image classification network, It is characterized in that The output of the feature extraction layer in the image classification network is used to obtain the template high-level features, clean high-level features and adversarial high-level features to iteratively optimize the image classification network, and the total cost loss function is constructed using the information bottleneck algorithm; the steps of the image classification method include the following: Step 1: Generate a clean sample set: According to the task of the image to be classified, at least 2 categories and at least 5,000 images of each category are selected to form a clean sample set, and each image is presented in the form of a matrix with the same dimension as the image size; Step 2: Build an image classification network: Construct an image classification network corresponding to the task of the image to be classified, which consists of a feature extraction layer and a linear classification layer in series, and set the parameters of each layer of the image classification network; Step 3: Get the trained template network by training the image classification network: Input the clean sample set into the image classification network, output the predicted category probability of each sample, use the cross entropy loss function to calculate the loss between the predicted category probability of each sample and the category label corresponding to the sample, update the parameters of the iterative target network through the back propagation algorithm until the cross entropy loss function converges, obtain the trained template network, and save the template high-level feature matrix output by the feature extraction layer in the template network when the training ends; Step 4: Generate adversarial sample set: Step 4.1, select an unselected clean sample from the clean sample set, add the selected sample to the random number matrix to obtain an intermediate matrix, input the intermediate matrix into the image classification network, obtain the reverse gradient matrix of the intermediate matrix through the back propagation algorithm, add the reverse gradient matrix to the clean sample to obtain the adversarial sample, and each adversarial sample is presented in the form of a matrix with the same dimension as the clean sample; Step 4.2, determine whether all clean samples in the clean sample set have been selected. If so, execute step 5 after all adversarial samples are assembled into an adversarial sample set. Otherwise, execute step 4.

1. Step 5: Use the information bottleneck algorithm to construct the total cost loss function as follows: in, represents the total cost loss function, N represents the total number of samples in the clean sample set, ∑ represents the summation operation, and Z i represents the template high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the trained template network. log represents the logarithmic operation with base 2. X i It represents the clean high-level feature matrix output by the feature extraction layer after the i-th sample in the clean sample set of the current iteration is input into the image classification network, W i It represents the adversarial high-level feature matrix output by the feature extraction layer after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network, Y i represents the category label corresponding to the clean sample set of the current iteration and the i-th sample in the adversarial sample set, Q i It represents the predicted category probability output after the i-th sample in the clean sample set of the current iteration is input into the image classification network, P i It represents the predicted category probability output after the i-th sample in the adversarial sample set of the current iteration is input into the image classification network; Step 6: Train the image classification network to obtain the target network: Input clean samples and adversarial samples into the image classification network in turn, output the predicted category probability of each training image, use the gradient descent method to update the parameters of the iterative image classification network, and determine whether the total cost loss function converges. If so, obtain the trained target network and execute step 7. Otherwise, save the image classification network parameters of the current iteration and execute step 4. Step 7: Classify the image to be classified: Scale each image to be classified to the same size as the sample in the clean sample set in step 1, input each image into the trained target network, output the predicted probability of each target category in the image, and take the category corresponding to the probability with the highest median value among all predicted probabilities as the classification result of the image corresponding to the image.

2. The image classification method based on the information bottleneck algorithm in the image classification network according to claim 1, It is characterized in that The cross entropy loss function described in step 3 is as follows: Among them, J represents the cross entropy loss function, N represents the total number of samples in the clean sample set, Σ represents the summation operation, i represents the sequence number of the sample in the clean sample set, and Y i represents the category label corresponding to the i-th sample in the clean sample set, log represents the logarithmic operation with base 2, and P i It represents the predicted category probability output after the i-th sample in the clean sample set is input into the image classification network.

3. The image classification method based on the information bottleneck algorithm in the image classification network according to claim 1, It is characterized in that The random number matrix described in step 4.1 means that the size of the random number matrix is ​​the same as that of the clean sample, and is composed of random numbers whose number is the same as the number of pixels in the clean sample and whose absolute value is less than the perturbation factor.