Image entropy constant data enhancement-based image classification method

By using a data enhancement method with constant image entropy in contrastive learning, the problem of traditional contrastive learning methods that generate simple contrasts and poor data enhancement effects is solved, achieving more efficient image classification accuracy and model robustness.

CN118587473APending Publication Date: 2024-09-03SHANGHAI UNIVERSITY OF ELECTRIC POWER
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410602354.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Traditional contrastive learning methods tend to produce simple or trivial contrasts when generating contrastive comparisons, resulting in insufficient accuracy when deploying models in real scenarios, and the lack of effective data augmentation standards results in poor image classification accuracy.

Method used

A data enhancement method based on constant image entropy is adopted. By calculating image entropy as the evaluation criterion, the P-stable distribution function is used to construct a random matrix and perform matrix multiplication with the image to ensure that the entropy value of the enhanced sample is constant, thereby increasing image diversity and reducing overfitting. Phenomenon.

Benefits of technology

It improves the accuracy and robustness of the image classification model, enhances the efficiency and accuracy of image processing, reduces the over-fitting phenomenon, and improves the accuracy of contrastive learning image classification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587473A
    Figure CN118587473A
Patent Text Reader

Abstract

The invention relates to an image classification method based on image entropy constant data enhancement, and the method comprises the following steps: S1, obtaining a sample image, defining an image entropy calculation formula, and calculating the image entropy of the sample image; s2, constructing a random matrix consistent with the sample picture in size by using a P stable distribution function; s3, dividing the sample image and the random matrix into slices with the same size; s4, performing matrix multiplication on the sample image slices and the corresponding random matrix slices to obtain enhanced samples with constant image entropy; and S5, acquiring an actual to-be-classified image, inputting the actual to-be-classified image into the classification model trained based on the enhanced sample, and outputting a classification result. Compared with the prior art, the method has the advantages of efficiently improving the classification accuracy of the classification model and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of image processing and contrast learning image classification, and in particular to a data enhancement and image classification method based on constant image entropy. Background Art

[0002] In recent years, contrastive learning, as a self-supervised learning technique, has achieved remarkable success in the field of visual representation learning. It cleverly uses unlabeled training data to generate paired augmented data, transforming the classification task into a pre-training task. By comparing similar and different pairs, the goal of contrastive learning is to learn universal and robust feature representations. Unlike traditional deep learning methods, contrastive learning is no longer limited to exploring perturbation invariance, but focuses on contrasting between local and global representations to capture structural information more accurately. In the absence of labeled data, contrastive learning gradually narrows the performance gap between unsupervised learning and supervised learning.

[0003] However, traditional contrastive learning methods tend to generate simple or trivial contrasts such as local patches, textures, high-frequency components, or even artificially added features when generating contrast pairs. These contrast pairs are not very effective in learning generalized feature representations, raising concerns about deploying these models in real scenarios.

[0004] To overcome this challenge, recent research on self-supervised learning has emphasized the importance of strong data augmentation in contrastive learning. Contrastive learning methods construct pairs through carefully designed augmentation techniques and tightly combine their representations. The core assumption of these enhancements is to preserve the semantics of the input image while interfering with other surface signals. However, when augmenting data, there is currently a lack of a unified standard to judge the effect of preserving the semantics of the input image, resulting in poor results of data augmentation. Even if data augmentation is performed, it is difficult to effectively improve the accuracy of subsequent image classification. Summary of the invention

[0005] The purpose of the present invention is to increase the diversity of training data, reduce overfitting phenomenon and thus efficiently improve the classification accuracy of the classification model, and provide an image classification method based on data enhancement with constant image entropy. The image entropy is used as a standard to evaluate the effect of retaining the semantics of the input image, accurately quantify the information content of the image, and provide a solid theoretical basis for the data enhancement process. In the process of slicing the image, the entropy value of the image is kept constant, and every detail of the image is processed more meticulously, thereby ensuring the stability and consistency of the image information, reducing the overfitting phenomenon to a certain extent, and further improving the efficiency and accuracy of image processing.

[0006] The purpose of the present invention can be achieved by the following technical solutions:

[0007] An image classification method based on data enhancement with constant image entropy, the method comprising the following steps:

[0008] S1. Obtain a sample image, define an image entropy calculation formula and calculate the image entropy of the sample image;

[0009] S2, using the P stable distribution function to construct a random matrix with the same size as the sample image;

[0010] S3, dividing the sample image and the random matrix into slices of equal size;

[0011] S4, performing matrix multiplication on the sample image slice and the corresponding random matrix slice to obtain an enhanced sample with constant image entropy;

[0012] S5. Acquire an actual image to be classified, input the actual image to be classified into a classification model trained based on the enhanced sample, and output a classification result.

[0013] Furthermore, the image entropy of the sample image is:

[0014]

[0015] Among them, A is the sample image, I is the maximum value of the pixel, ρ is the one-dimensional histogram of A, and i represents the value corresponding to the pixel.

[0016] Furthermore, the one-dimensional histogram of the sample image is:

[0017]

[0018] Where N is the total number of pixels in the image, n represents the nth pixel, and δ i,A(n) A convenience method for representing the discrete binning operations needed to generate ρ.

[0019] Furthermore, the P stable distribution function is a composite distribution.

[0020] Furthermore, the composite distribution is:

[0021] D=r×d j +(1-r)×d k

[0022] Among them, r is the temperature parameter, d j Take Gaussian distribution, d k Take the Cauchy distribution and D as the composite distribution.

[0023] Furthermore, the specific steps of performing matrix multiplication on the sample image slice and the corresponding random matrix slice to obtain an enhanced sample with constant image entropy are:

[0024] The sample image slices with the same serial number and the random matrix slices with the same serial number are subjected to matrix dot multiplication to obtain enhanced samples with constant image entropy.

[0025] Furthermore, the training process of the classification model is:

[0026] The enhanced samples with constant image entropy used for training are input into the BYOL network. The BYOL network outputs two features. The features output by the BYOL network are input into the multi-layer perceptron MLP. The multi-layer perceptron MLP outputs the prediction results. The loss function is calculated based on the prediction results. The BYOL network and the multi-layer perceptron MLP are optimized based on the loss function. The calculation is iterated until convergence to obtain the classification model.

[0027] Furthermore, the enhanced samples with constant image entropy for training are input into the BYOL network, the BYOL network outputs two features, the features output by the BYOL network are input into the multi-layer perceptron MLP, the multi-layer perceptron MLP outputs prediction results, the loss function is calculated based on the prediction results, and the specific steps of optimizing the BYOL network and the multi-layer perceptron MLP based on the loss function are as follows:

[0028] The enhanced samples with constant image entropy used for training are input into the BYOL network, and two different random image enhancement operations are performed on the enhanced samples to generate two views, namely, Figure 1 And Vision Figure 2 , input the two views into the online branch and target branch of the BYOL network respectively, and exchange the two inputs of the online branch and the target branch for forward propagation, calculate the BYOL network loss function based on the features output by the BYOL network, optimize the parameters of the BYOL network based on the BYOL network loss function, iteratively train to obtain the BYOL model, input the enhanced samples with constant image entropy for training into the BYOL model, input the features output by the BYOL model into the multi-layer perceptron MLP, calculate the classification loss based on the output of the multi-layer perceptron MLP, and optimize the weight parameters of the multi-layer perceptron MLP based on the classification loss.

[0029] Furthermore, the BYOL network loss function is used to optimize the parameters of the BYOL network, and the BYOL model is obtained by iterative training as follows:

[0030] The parameters of the BYOL network are optimized based on the BYOL network loss function. After convergence, only the encoder of the online branch in the BYOL network is retained, and the encoder of the online branch is used as the BYOL model.

[0031] Furthermore, the BYOL network loss function is:

[0032]

[0033] Among them, online(v1) and online(v2) are respectively Figure 1 ,See Figure 2 The output feature vectors of the online branch, target(v1) and target(v2), are respectively Figure 1 ,See Figure 2 Output feature vector in the target branch.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] The present invention uses image entropy as a standard for evaluating the effect of retaining the semantics of an input image, accurately quantifies the information content of an image, and keeps the entropy value of the image constant during the process of slicing the image. This allows for more detailed processing of every detail of the image, and not only can it change the local pixel value of the image to achieve a blurring effect, but it also increases the diversity of the image through the randomness of the matrix, increases the difficulty of training, and improves the accuracy of contrastive learning image classification. Due to the adoption of a strategy of constant image entropy, it can also reduce overfitting to a certain extent and improve the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a flow chart of the present invention;

[0037] Figure 2 Schematic diagram of the data enhancement process of the present invention;

[0038] Figure 3 This is a comparison chart of data enhancement effects;

[0039] Figure 4 This is the BYOL network structure diagram for the comparative learning model;

[0040] Figure 5 It is a multi-layer perceptron MLP network structure diagram;

[0041] Figure 6 This is a bar graph of the experimental results accuracy. DETAILED DESCRIPTION

[0042] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0043] Image entropy, as a statistical measure of the information content of image signals, can reflect the richness of details displayed after image processing. In contrastive learning, carefully designed enhancement techniques are aimed at constructing positive pairs. The assumption behind these enhancement techniques is to maintain the semantics of the input image while disrupting other surface signals. This inspired us to use image entropy as an evaluation criterion to judge whether data enhancement effectively retains the semantics of the original image. However, after using image entropy as an evaluation criterion, we found that some common data enhancement methods, such as random cropping and random noise, do not always generate images with constant image entropy, which suggests that we need to further explore and optimize data enhancement strategies to better serve contrastive learning tasks. Therefore, the present invention proposes an image classification method based on data enhancement with constant image entropy. The flow chart of the method is as follows. Figure 1 As shown, the method comprises the following steps:

[0044] S1. Obtain a sample image, define an image entropy calculation formula and calculate the image entropy of the sample image;

[0045] S2, using the P stable distribution function to construct a random matrix with the same size as the sample image;

[0046] S3, dividing the sample image and the random matrix into slices of equal size;

[0047] S4, performing matrix multiplication on the sample image slice and the corresponding random matrix slice to obtain an enhanced sample with constant image entropy;

[0048] S5. Acquire an actual image to be classified, input the actual image to be classified into a classification model trained based on the enhanced sample, and output a classification result.

[0049] First, define image entropy. The image entropy of the sample image is:

[0050]

[0051] Among them, A is the sample image, I is the maximum value of the pixel, ρ is the one-dimensional histogram of A, and i represents the value corresponding to the pixel, which generally ranges from 1 to 256.

[0052] This formula accurately describes the average amount of information in the image source, that is, the average number of bits in the image grayscale set, and its unit of measurement is bits / pixel. The one-dimensional histogram of the sample image is:

[0053]

[0054] Where N is the total number of pixels in the image, n represents the nth pixel, and δ i,A(n)A convenient way to represent the discrete binning operation required to generate ρ is: 1 when (i=A(n)), otherwise 0. (A(n)) is the pixel value of the (n)th point in image A.

[0055] Through this formula, we can accurately quantify the information content of the image, providing a solid theoretical basis for the data enhancement process. In the process of data enhancement, we will strive to keep the entropy value of the image constant, thereby ensuring the stability and consistency of the image information and further improving the efficiency and accuracy of image processing.

[0056] In S2, sample images are selected from the CIFAR-10 dataset for classification, covering ten categories: airplanes, cars, birds, cats, deer, dogs, frogs, horses, sheep, and trucks. For each image, we accurately calculate its corresponding image entropy to gain a deeper understanding of its information richness.

[0057] The random matrix of S2 is generated by the enhanced P-stable distribution, which covers various types such as Gaussian distribution, Levy distribution, Cauchy distribution, etc. It is particularly worth mentioning that the size of the random matrix is ​​exactly matched with the image size in the CIFAR-10 dataset, both of which are 32×32 pixels, ensuring the accuracy and effectiveness of data enhancement.

[0058] The random matrix is ​​generated by the principle of P-stable distribution. First, the random matrix is ​​set to 32×32 pixels according to the size of the ten categories of images in the CIFAR-10 dataset. In order to meet the diversity of ten different categories of images, we use a compound distribution formula. The compound distribution formula is expressed as:

[0059] D=r×d j +(1-r)×d k

[0060] Where: d j and d k It is composed of P-stable distributions. For convenience, we specifically select three P-stable distributions, namely Gaussian distribution, Cauchy distribution and Levy distribution. r is the temperature parameter. We select the best one from the six distributions that generate stable random numbers and apply it to the image that needs data augmentation. In this method, the parameter d j Take Gaussian distribution, parameter d k The Cauchy distribution is taken, and the parameter r is taken as 0.9. This parameter increases the diversity of the distribution over the temperature parameter r, making the distribution more generalized for data enhancement, thereby achieving the purpose of improving the accuracy of image classification.

[0061] In the slicing method of S3, both the image and the random matrix are sliced ​​in 2×2 pixel size, ensuring that both the image and the random matrix are evenly cut into 16 pieces. This slicing method helps to process every detail of the image more carefully and further improve the effect of data enhancement. The image and the random matrix are divided into slices of equal size. According to the conclusion of the experiment, the highest accuracy can be achieved when the slice size is 2×2 pixels.

[0062] In S4, the image slice and the matrix slice are multiplied in the same order. The purpose of matrix dot multiplication is to simplify the time consumption caused by the pixel multiplication operation. An image slice of size 2×2 pixels multiplied by a matrix slice of size 2×2 pixels can obtain an enhanced image slice of size 2×2 pixels. By combining the enhanced image slices in the order of slices, an enhanced image with constant information entropy can be obtained.

[0063] In the present invention, S2 to S4 are data enhancement processes, and the data enhancement process diagram is shown in FIG. Figure 2 The effect of data enhancement is shown in Figure 3 shown.

[0064] In S5, the training process of the classification model is:

[0065] The enhanced samples with constant image entropy used for training are input into the BYOL network. The BYOL network outputs two features. The features output by the BYOL network are input into the multi-layer perceptron MLP. The multi-layer perceptron MLP outputs the prediction results. The loss function is calculated based on the prediction results. The BYOL network and the multi-layer perceptron MLP are optimized based on the loss function. The calculation is iterated until convergence to obtain the classification model. The structure of the BYOL network is as follows: Figure 4 As shown. The multi-layer perceptron MLP network structure diagram is as follows Figure 5 shown.

[0066] The enhanced samples with constant image entropy used for training are input into the BYOL network. The BYOL network outputs two features. The features output by the BYOL network are input into the multi-layer perceptron MLP. The multi-layer perceptron MLP outputs the prediction results. The loss function is calculated based on the prediction results. The specific steps of optimizing the BYOL network and the multi-layer perceptron MLP based on the loss function are as follows:

[0067] The enhanced samples with constant image entropy used for training are input into the BYOL network, and two different random image enhancement operations are performed on the enhanced samples to generate two views, namely, Figure 1 And Vision Figure 2, input the two views into the online branch and target branch of the BYOL network respectively, and exchange the two inputs of the online branch and the target branch for forward propagation, calculate the BYOL network loss function based on the features output by the BYOL network, optimize the parameters of the BYOL network based on the BYOL network loss function, iteratively train to obtain the BYOL model, input the enhanced samples with constant image entropy for training into the BYOL model, input the features output by the BYOL model into the multi-layer perceptron MLP, calculate the classification loss based on the output of the multi-layer perceptron MLP, and optimize the weight parameters of the multi-layer perceptron MLP based on the classification loss.

[0068] The contrastive learning model uses two different random image augmentation operations for the BYOL model to generate two different views, and then inputs these two views into two different branches of the network. Finally, the network maps the feature vector to the unit hypersphere. The BYOL network believes that two different views of the same image should be regarded as positive examples, and the mapping of their feature vectors on the unit hypersphere should be as close to each other as possible. Therefore, the goal of BYOL's loss function is to minimize the distance between the feature vectors of two different views of the same image on the unit hypersphere. BYOL's loss function is as follows:

[0069]

[0070] in: represents L2 regularization, and <·> represents vector dot multiplication. L1 is a deformation of cosine similarity, and its minimum value is equivalent to the maximum value of the cosine similarity of the two feature vectors. That is to say, as the loss function decreases, the distance between the mappings of the feature vectors of the two views on the unit hypersphere will become closer and closer. Since the online and target network branches are asymmetric, the BYOL network will exchange the two image-enhanced views and forward propagate along another branch to calculate the loss value L2. Therefore, the final loss function of the BYOL network is as follows:

[0071]

[0072] Among them: online(v1) and online(v2) are respectively Figure 1 ,See Figure 2 The output feature vectors of the online network, target(v1) and target(v2) are respectively Figure 1 ,See Figure 2 The output feature vector of the target network is trained using enhanced training samples, and then the image is classified and tested on the image as a test sample to obtain the final test result.

[0073] In the above steps, the enhanced images are used to train the contrastive learning model BYOL, so that the model can more accurately capture the features and rules of the image. The feature extraction network Resnet in the BYOL model is taken out, and a multi-layer perceptron MLP is added for training the image classification task. In this way, the advantages of data enhancement can be fully utilized to improve the accuracy and efficiency of image classification.

[0074] The training steps of the classification model are as follows:

[0075] (3a) Let the number of iterations be t, the maximum number of iterations be T, T ≥ 40;

[0076] (3b) Using the data-enhanced training samples as the input of the contrastive learning network, performing iterative training, and judging whether t=T holds. If so, obtaining a trained contrastive learning image classification network model, otherwise, executing step (3c);

[0077] (3c) Using the loss function L1 and the target prediction category output by the current contrastive learning image classification network model, the loss value l of the current contrastive learning image classification network model is calculated, and the weight of the current contrastive learning image classification network model is adjusted by l, and t=t+1 is set to execute step (3b).

[0078] Among them, the expression of the loss function L is:

[0079]

[0080]

[0081] In the formula: Represents a sample x from the future t+k The local representation extracted from , the function form can be understood as: the linear transformation W of the representation k c t As a prediction of the future, we use this prediction and future representation The inner product between them is used to estimate the mutual information, and we hope that it is as large as possible. Sample set X = {x1,...x N} are N randomly selected samples, including 1 from p(x t+k |c t ) sampled positive samples (i.e. x t+k It is the representation of c t corresponding future sequence), and N-1 from the distribution p(x t+k ) in the negative sample (i.e., sample x j is randomly selected from the t+kth step of the sample set).

[0082] (3d) After the training of the contrastive learning network in (3b) is completed, the target network encoder is discarded and only one encoder is retained. According to this encoder, all training data can generate a self-consistent representation. Because the learned representation is self-consistent, it remains almost unchanged after different data transformations. In this way, the model makes the representation of similar examples closer. Then we added a nonlinear projection head of a three-layer multi-layer perceptron with 512 hidden units for training image classification, using the activation function ReLU and the loss function L to adjust the weights of the current image classification network model.

[0083] The activation function ReLU function expression is:

[0084] ReLU(x)=max(0,w T x+b)

[0085] Where: w represents the weight of the image classification network model, x represents the image input to the image classification network model, b represents the random weight parameter, and the ReLU function is more efficient in gradient descent and back propagation: it avoids the problems of gradient explosion and gradient disappearance.

[0086] The activation function ReLU function expression is:

[0087]

[0088] Where: represents the true label of the image to be classified, y represents the predicted label output by the image classification network model, and b represents the random weight parameter. When y=1, The closer it is to 1, The closer it is to 0, the better the prediction effect; when y = 0, The closer to 0, The closer it is to 0, the better the prediction effect. Then our goal is to minimize the loss function, where the loss function is for a single sample.

[0089] Finally, the test samples are input into the trained image classification neural network to obtain the categories of all targets; then the categories of the images to be classified are calculated and used as the detection results of comparative learning image classification.

[0090] The dataset used in the present invention is based on the CIFAR-10 dataset, which contains ten categories of images to be classified, namely, airplanes, cars, birds, cats, deer, dogs, frogs, horses, sheep and trucks.

[0091] CIFAR-10 is a small dataset for identifying universal objects compiled by Hinton's students Alex Krizhevsky and Ilya Sutskever. It contains 10 categories of RGB color images: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck. The image size is 32×32, and there are 50,000 training images and 10,000 test images in the dataset. CIFAR-10 is a 3-channel color RGB image, while MNIST is a grayscale image. The image size of CIFAR-10 is 32×32 pixels. CIFAR-10 contains real objects in the real world. Not only is the noise very large, but the scale and features of the objects are also different, which brings great difficulties to recognition. Direct linear models such as Softmax perform poorly on CIFAR-10.

[0092] The present invention adopts CIFAR-10+ data set consisting of 60,000 32*32 color pictures, with a total of 10 categories. Each category has 6,000 pictures. Among them, there are 50,000 training pictures and 10,000 test pictures. The data set is divided into 5 training blocks and 1 test block, each block has 10,000 pictures. The test block contains 1,000 pictures randomly selected from each category. The training block contains random remaining images, but some training blocks may contain more images for one category than other categories. The training block contains 5,000 pictures from each category. These classes are completely mutually exclusive, and pictures that appear in one category will not appear in other classes.

[0093] The following simulation experiment is used to further illustrate the effect of this method:

[0094] The results of the experiment are as follows Figure 6 shown.

[0095] The entire training and testing process of the present invention is run under the deep learning open source framework TensorFlow under the Ubuntu 16.04.6 system, the graphics card model is Nvidia GeForce RTX 2080TI, the CPU model is Intel Core i9-9900K, the CUDA version is CUDA 10.1, and the cuDNN version is cuDNN v7.5.0.

[0096] 2. Evaluation indicators

[0097] The detection accuracy evaluation indicators used in this simulation experiment are the average detection accuracy AP of each category of targets and the average detection accuracy mAP of all categories of targets. The larger the average accuracy AP and the average accuracy mAP, the better the image classification effect. The following is a detailed description of these two indicators:

[0098] Recall rate = total number of correctly classified targets / total number of targets;

[0099] Accuracy = total number of correctly classified targets / total number of classified targets;

[0100] Draw the accuracy-recall curve. The area enclosed by the curve and the coordinate axis of the recall rate represents the average detection accuracy AP of each type of target. The average detection accuracy of all types of targets is calculated to obtain the mean detection accuracy mAP.

[0101] 3. Results of this simulation test

[0102] Table 1 compares the experimental results of the enhanced dataset with the original dataset. The first row shows the results on the unenhanced dataset, and the second column shows the results on the enhanced dataset. It can be seen that the recognition accuracy of the ten categories has been improved after data enhancement. The overall accuracy mAP has also increased by 2.4, which is a significant effect.

[0103] Table 1 Comparison of experimental results on CIFAR-10 dataset

[0104]

[0105] In summary, the present invention performs image enhancement processing to obtain the enhanced dataset CIFAR-10+, expands the number of training sets and the number of targets in each image, enriches the training samples, and can increase the diversity of training samples, thereby improving the image classification accuracy of the contrastive learning network.

[0106] The present invention aims to solve the limitations of traditional image classification methods in terms of insufficient data, weak model generalization ability, and serious overfitting. First, the method introduces the concept of image entropy, and evaluates the amount of information by calculating the entropy value of the image, so as to understand the richness of information contained in the image. Then we adopt a new image blurring strategy to ensure that the entropy value is constant after enhancement. The specific steps are as follows: First, we use the P stable distribution function to construct a random matrix that is exactly the same size as the image to be enhanced. Each element of this matrix is ​​randomly generated according to the P stable distribution, so as to ensure that the matrix itself has sufficient randomness and stability. Then we divide the original image and the random matrix into slices of equal size. The key to this step is to ensure that each slice can retain part of the structure and information of the original image, while facilitating subsequent blurring. Then we perform matrix multiplication of each image slice with the corresponding matrix slice to obtain an enhanced image with a constant entropy value. This operation can not only change the local pixel value of the image to achieve a blurring effect, but also increase the diversity of the image through the randomness of the matrix. Then we use these enhanced images with constant entropy and rich information to train the BYOL (Bootstrap Your Own Latent) model, so that it can learn the essential features of the image and accurately capture the subtle differences between images. Then we take out the feature extraction network Resnet of the trained BYOL model and add a multi-layer perceptron MLP for image classification task training. Finally, the trained image classification model is applied to the images to be classified to achieve efficient and accurate image classification. Compared with the existing methods, the present invention not only improves the accuracy of image classification, but also enhances the generalization ability of the model, so that it can better cope with various complex image classification tasks. At the same time, due to the adoption of the strategy of constant image entropy, our method can also reduce overfitting to a certain extent and improve the robustness of the model.

[0107] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.

Claims

1. An image classification method based on data enhancement with constant image entropy, characterized in that: The method comprises the following steps: S1. Obtain a sample image, define an image entropy calculation formula and calculate the image entropy of the sample image; S2, using the P stable distribution function to construct a random matrix with the same size as the sample image; S3, dividing the sample image and the random matrix into slices of equal size; S4, performing matrix multiplication on the sample image slice and the corresponding random matrix slice to obtain an enhanced sample with constant image entropy; S5. Acquire an actual image to be classified, input the actual image to be classified into a classification model trained based on the enhanced sample, and output a classification result.

2. The image classification method based on data enhancement with constant image entropy according to claim 1, characterized in that: The image entropy of the sample image is: Among them, A is the sample image, I is the maximum value of the pixel, ρ is the one-dimensional histogram of A, and i represents the value corresponding to the pixel.

3. The image classification method based on data enhancement with constant image entropy according to claim 2, characterized in that: The one-dimensional histogram of the sample image is: Where N is the total number of pixels in the image, n represents the nth pixel, and δ i,A(n) A convenience method for representing the discrete binning operations needed to generate ρ.

4. The image classification method based on data enhancement with constant image entropy according to claim 3, characterized in that: The P-stable distribution function is a composite distribution.

5. The image classification method based on data enhancement with constant image entropy according to claim 4, characterized in that: The composite distribution is: D=r×d j +(1-r)×d k Among them, r is the temperature parameter, d j Take Gaussian distribution, d k Take the Cauchy distribution and D as the composite distribution.

6. The image classification method based on data enhancement with constant image entropy according to claim 5, characterized in that: The specific steps of performing matrix multiplication between the sample image slice and the corresponding random matrix slice to obtain an enhanced sample with constant image entropy are: The sample image slices with the same serial number and the random matrix slices with the same serial number are subjected to matrix dot multiplication to obtain enhanced samples with constant image entropy.

7. The image classification method based on data enhancement with constant image entropy according to claim 6, characterized in that: The training process of the classification model is: The enhanced samples with constant image entropy used for training are input into the BYOL network. The BYOL network outputs two features. The features output by the BYOL network are input into the multi-layer perceptron MLP. The multi-layer perceptron MLP outputs the prediction results. The loss function is calculated based on the prediction results. The BYOL network and the multi-layer perceptron MLP are optimized based on the loss function. The calculation is iterated until convergence to obtain the classification model.

8. The image classification method based on data enhancement with constant image entropy according to claim 7, characterized in that: The enhanced samples with constant image entropy for training are input into the BYOL network, the BYOL network outputs two features, the features output by the BYOL network are input into the multi-layer perceptron MLP, the multi-layer perceptron MLP outputs prediction results, the loss function is calculated based on the prediction results, and the specific steps of optimizing the BYOL network and the multi-layer perceptron MLP based on the loss function are as follows: The enhanced samples with constant image entropy used for training are input into the BYOL network, and two different random image enhancement operations are performed on the enhanced samples to generate two views, namely view 1 and view 2. The two views are respectively input into the online branch and target branch of the BYOL network, and the two inputs of the online branch and the target branch are exchanged for forward propagation. The BYOL network loss function is calculated based on the features output by the BYOL network, and the parameters of the BYOL network are optimized based on the BYOL network loss function. The BYOL model is obtained by iterative training, and the enhanced samples with constant image entropy used for training are input into the BYOL model. The features output by the BYOL model are input into the multi-layer perceptron MLP, and the classification loss is calculated based on the output of the multi-layer perceptron MLP. The weight parameters of the multi-layer perceptron MLP are optimized based on the classification loss.

9. The image classification method based on data enhancement with constant image entropy according to claim 8, characterized in that: The BYOL network loss function is used to optimize the parameters of the BYOL network and the BYOL model is obtained through iterative training. Specifically, the BYOL model is: The parameters of the BYOL network are optimized based on the BYOL network loss function. After convergence, only the encoder of the online branch in the BYOL network is retained, and the encoder of the online branch is used as the BYOL model.

10. The image classification method based on data enhancement with constant image entropy according to claim 9, characterized in that: The BYOL network loss function is: Among them, online(v1) and online(v2) are the output feature vectors of view 1 and view 2 in the online branch respectively, and target(v1) and target(v2) are the output feature vectors of view 1 and view 2 in the target branch respectively.

Citation Information

Cited By

  • Assessment and enhancement method and device for LLMs concept mutual exclusion recognition capability

    CN121543698A