Image classification method, system, device and storage medium
By introducing standard-free data into the image classification method and using pseudo-label and loss value computer system, the problem of feature space imbalance in the prior art is solved, and the accuracy and generalization ability of the image classification model are improved.
Patent Information
- Application Number
- CN202410994686.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-07-24
AI Technical Summary
The prior art is difficult to effectively utilize standard-free data in image classification tasks, resulting in feature space imbalance, insufficient generalization capabilities of the model, and easy to overfit.
An image classification method is proposed, by obtaining training data sets containing labels and labelless images, using the initial image classification model to generate pseudo-labels, and through the loss value calculation and update mechanism, the standard-free data is introduced to achieve balance in the feature space.
By introducing standard-free data, the balance of feature space is achieved, the accuracy and generalization ability of the image classification model are improved, and the risk of overfitting is reduced.
Smart Images

Figure CN118799642B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field related to image classification, and in particular to an image classification method, system, device and storage medium. Background Art
[0002] Image classification plays a vital role in the medical field, with a wide range of application scenarios and far-reaching significance. First, image classification can be used for disease diagnosis and classification, helping doctors quickly and accurately determine the type, extent and distribution of lesions, and providing important guidance for patients' treatment plans in clinical practice. Secondly, for tumor detection and grading, image classification can identify tumor types and determine their grades and stages, which helps doctors develop personalized treatment plans and conduct prognosis assessments. In addition, image classification can also be used to evaluate drug efficacy and disease prognosis, providing an important scientific basis for medical research and clinical practice.
[0003] Current traditional methods and existing deep learning methods face a series of challenges when dealing with image classification tasks. Traditional methods usually require manually designed feature extractors when performing image classification and adjust them according to specific problems. Due to the complex structure and rich details of the image, this method of manually designed features may find it difficult to capture effective feature information, and due to the limitations of professional knowledge and experience, it may not be able to capture all important feature information. On the other hand, the use of existing deep learning methods usually requires a large amount of labeled data for training, and the acquisition of labeled data in the medical field is time-consuming, labor-intensive and costly. The existing labeled datasets are relatively small, resulting in insufficient model generalization ability and easy overfitting. Moreover, there are a lot of unlabeled images in the medical field that are not utilized. Summary of the invention
[0004] The present application aims to at least solve the technical problems existing in the prior art. To this end, the present application proposes an image classification method, system, device and storage medium, which can introduce unlabeled data, achieve the balance of feature space, and improve the accuracy of image classification model.
[0005] In a first aspect of the present application, there is provided an image classification method, comprising the following steps:
[0006] Acquire an image training data set, wherein the image training data set includes a first image with a label and a second image without a label;
[0007] Inputting the images in the image training data set into a preset initial image classification model to obtain a first prediction value, and determining a pseudo label of the second image according to the first prediction value;
[0008] Calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image;
[0009] Calculate a first loss value and a second loss value according to the third image and the initial image classification model;
[0010] Calculate a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image;
[0011] Calculate a fifth loss value through the initial image classification model according to the second image and the third image;
[0012] A total loss value is calculated according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and the initial image classification model is updated according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
[0013] The control method according to the embodiment of the present application has at least the following beneficial effects:
[0014] The method obtains an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; inputs the image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determines a pseudo label of the second image according to the first prediction value; calculates a second prediction value according to the first prediction value and the pseudo label, and screens the second image according to the second prediction value and a preset confidence threshold to obtain a third image; calculates a first loss value and a second loss value according to the third image and the initial image classification model; calculates a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; calculates a fifth loss value through the initial image classification model according to the second image and the third image; calculates a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and updates the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model. The present application achieves a balance in the feature space by introducing unlabeled data, and updates the initial image classification model according to the total loss value, thereby improving the accuracy of the image classification model.
[0015] According to some embodiments of the present application, calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image includes:
[0016] Obtaining the total number of label categories of the first image, the maximum number of samples belonging to the same label category among all label categories, and the minimum number of samples belonging to the same label category among all label categories;
[0017] Calculate the imbalance ratio according to the maximum sample quantity and the minimum sample quantity;
[0018] The second prediction value is calculated according to the imbalance ratio and the pseudo label by the following formula:
[0019]
[0020] in, is the second predicted value of the i-th image, p i is the first prediction value of the i-th image, γ is the imbalance ratio, k is the total number of label categories of the first image, and j is the label category number of the sample after sorting by the number of samples belonging to the same label category;
[0021] All images in the second image whose second prediction value is greater than the preset confidence threshold are screened to obtain the third image.
[0022] According to some embodiments of the present application, calculating the first loss value and the second loss value according to the third image and the initial image classification model includes:
[0023] Weakly enhancing the third image to obtain a first weakly enhanced image; strongly enhancing the third image to obtain a first strongly enhanced image;
[0024] Inputting the first weakly enhanced image into the initial image classification model to obtain a first weakly enhanced prediction value; inputting the first strongly enhanced image into the initial image classification model to obtain a first strongly enhanced prediction value;
[0025] The first loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula:
[0026]
[0027] Among them, L CL(r) is the first loss value of the rth third image, is the first weakly enhanced prediction value of the rth third image, is the first strong enhancement prediction value of the rth third image, is the first weakly enhanced prediction value of the s-th third image, and N is the total number of third images;
[0028] The second loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula:
[0029]
[0030] Among them, L con(r) is the second loss value of the r-th third image.
[0031] According to some embodiments of the present application, calculating a fourth loss value through the initial image classification model according to the first prediction value and the first image includes:
[0032] Filtering the first image according to a preset tail ratio to obtain a fourth image;
[0033] Weakly enhancing the fourth image to obtain a second weakly enhanced image; strongly enhancing the fourth image to obtain a second strongly enhanced image;
[0034] Inputting the second weakly enhanced image into the initial image classification model to obtain a second weakly enhanced prediction value; inputting the second strongly enhanced image into the initial image classification model to obtain a second strongly enhanced prediction value;
[0035] The fourth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula:
[0036]
[0037] Among them, L t-dist(e) is the fourth loss value of the fourth image, is the second weakly enhanced prediction value of the e-th fourth image, is the second strongest enhanced prediction value of the e-th fourth image, for The Euclidean norm of , for The Euclidean norm of .
[0038] According to some embodiments of the present application, calculating a fifth loss value through the initial image classification model according to the second image and the third image includes:
[0039] Randomly intercept a rectangle from the first strongly enhanced image and cover it to a corresponding position of the second weakly enhanced image to obtain a first mixed image;
[0040] An image having the same position and size as the rectangle is intercepted from the first weakly enhanced image and covered to a corresponding position of the second strongly enhanced image to obtain a second mixed image;
[0041] The mixed label of the first mixed image and the mixed label of the second mixed image are calculated by the following formula:
[0042]
[0043] in, is the mixed label of the f-th mixed image, λ is the area ratio of the second image in the f-th mixed image, y A is the pseudo label of the second image corresponding to the f-th mixed image, with a value of 0 or 1, y B is the true label of the first image corresponding to the f-th mixed image, which is 0 or 1;
[0044] Inputting the first mixed image and the second mixed image into the initial image classification model to obtain a first mixed image prediction value and a second mixed image prediction value;
[0045] Calculating a divergence value according to the first mixed image prediction value and the second mixed image prediction value;
[0046] Screening the first mixed image and the second mixed image whose divergence values are greater than the preset confidence threshold to obtain a screened mixed image;
[0047] The fifth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula:
[0048]
[0049] Among them, L mixer(d) is the fifth loss value of the dth filtered mixed image, k is the total number of label categories of the first image, j is the label category number of the sample after sorting by the number of samples belonging to the same label category, is the mixed label of the dth filtered mixed image, The first mixed image prediction value for the dth filtered mixed image.
[0050] According to some embodiments of the present application, the divergence value is calculated by the following formula, including:
[0051]
[0052] Among them, D mix(c) is the divergence value of the c-th mixed image pair, is the prediction value of the first mixed image in the cth mixed image pair, is the predicted value of the second mixed image in the cth pair of mixed images, where the cth pair of mixed images is an image pair consisting of the cth first mixed image and the cth second mixed image.
[0053] According to some embodiments of the present application, the third loss value is calculated by the following formula:
[0054]
[0055] Among them, L CE(i) is the third loss value of the i-th image of the first image, k is the total number of label categories of the first image, y ij is the true label of the i-th first image in the j-th label category, p ij is the first predicted value of the i-th first image in the j-th label category.
[0056] In a second aspect of the present application, an image classification system is provided, the image classification system comprising:
[0057] A data acquisition module, used to acquire an image training data set, wherein the image training data set includes a first image with a label and a second image without a label;
[0058] a first prediction value calculation module, configured to input an image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determine a pseudo label of the second image according to the first prediction value;
[0059] a second prediction value calculation module, configured to calculate a second prediction value according to the first prediction value and the pseudo label, and to screen the second image according to the second prediction value and a preset confidence threshold to obtain a third image;
[0060] A first loss value and a second loss value calculation module, used to calculate the first loss value and the second loss value according to the third image and the initial image classification model;
[0061] A third loss value and a fourth loss value calculation module, configured to calculate a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image;
[0062] a fifth loss value calculation module, configured to calculate a fifth loss value according to the second image and the third image through the initial image classification model;
[0063] An iterative module is used to calculate a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and to update the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
[0064] The system obtains an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; inputs the image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determines a pseudo label of the second image according to the first prediction value; calculates a second prediction value according to the first prediction value and the pseudo label, and screens the second image according to the second prediction value and a preset confidence threshold to obtain a third image; calculates a first loss value and a second loss value according to the third image and the initial image classification model; calculates a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; calculates a fifth loss value through the initial image classification model according to the second image and the third image; calculates a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and updates the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model. The present application achieves a balance in the feature space by introducing unlabeled data, and updates the initial image classification model according to the total loss value to improve the accuracy of the image classification model.
[0065] According to a third aspect of the present application, an image classification electronic device is provided, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can perform the above-mentioned image classification method.
[0066] According to a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned image classification method.
[0067] It should be noted that the beneficial effects between the second to fourth aspects of the present application and the prior art are the same as the beneficial effects between the above-mentioned image classification system and the prior art, and will not be described in detail here.
[0068] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0070] Figure 1 is a flow chart of an embodiment of the image classification method provided by the present application;
[0071] Figure 2is a schematic diagram of a visualization result of a qualitative analysis of an embodiment of the image classification method provided by the present application;
[0072] Figure 3 is a structural schematic diagram of an embodiment of an image classification system provided by the present application;
[0073] Figure 4 It is a schematic diagram of the structure of an embodiment of the electronic device provided by the present application. DETAILED DESCRIPTION
[0074] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0075] In the description of this application, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0076] In the description of the present application, it should be understood that descriptions involving orientation, such as orientation or positional relationship indicated as up, down, etc., are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0077] In the description of this application, it should be noted that, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meaning of the above terms in this application based on the specific content of the technical solution.
[0078] Image classification plays a vital role in the medical field, with a wide range of application scenarios and far-reaching significance. First, image classification can be used for disease diagnosis and classification, helping doctors quickly and accurately determine the type, extent and distribution of lesions, and providing important guidance for patients' treatment plans in clinical practice. Secondly, for tumor detection and grading, image classification can identify tumor types and determine their grades and stages, which helps doctors develop personalized treatment plans and conduct prognosis assessments. In addition, image classification can also be used to evaluate drug efficacy and disease prognosis, providing an important scientific basis for medical research and clinical practice.
[0079] Current traditional methods and existing deep learning methods face a series of challenges when dealing with image classification tasks. Traditional methods usually require manually designed feature extractors when performing image classification and adjust them according to specific problems. Due to the complex structure and rich details of the image, this method of manually designed features may find it difficult to capture effective feature information, and due to the limitations of professional knowledge and experience, it may not be able to capture all important feature information. On the other hand, the use of existing deep learning methods usually requires a large amount of labeled data for training, and the acquisition of labeled data in the medical field is time-consuming, labor-intensive and costly. The existing labeled datasets are relatively small, resulting in insufficient model generalization ability and easy overfitting. Moreover, there are a lot of unlabeled images in the medical field that are not utilized.
[0080] In order to solve the above technical defects, the embodiments of the present application provide an image classification method, system, device and storage medium.
[0081] See also Figure 1 , is a flow chart of an image classification method provided in an embodiment of the present application, the method is applied to an electronic device, and the electronic device may be a server, etc. Figure 1 As shown, the image classification method includes:
[0082] Step S101, obtaining an image training data set, wherein the image training data set includes a first image with a label and a second image without a label;
[0083] Step S102: input an image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determine a pseudo label of the second image according to the first prediction value;
[0084] Step S103, calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image;
[0085] Step S104, calculating a first loss value and a second loss value according to the third image and the initial image classification model;
[0086] Step S105, calculating a third loss value and a fourth loss value through an initial image classification model according to the first prediction value and the first image;
[0087] Step S106, calculating a fifth loss value through the initial image classification model according to the second image and the third image;
[0088] Step S107, calculating the total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and updating the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
[0089] Specifically, in some embodiments, the initial image classification model is updated according to the total loss value, and when the number of iterations reaches a preset number, a trained image classification model is obtained.
[0090] Specifically, in some embodiments, the labeled data are sorted in descending order according to the number of categories of the label types, and then all the labeled data and the unlabeled data are divided into multiple batches. In each batch, the labeled data and the unlabeled data are input into the model together, and the model calculates these data to obtain the preliminary prediction value p i .
[0091] Specifically, in some embodiments, the baseline network used by the image classification model is a wide residual network (WRN), which performs feature extraction and preliminary prediction on the input samples. WRN is different from the traditional ResNet, and WRN has made significant improvements in the network structure. Specifically, the baseline model WRN improves the capacity and performance of the model by increasing the width of the network (i.e., the number of channels in each layer), where each residual block contains two convolutional layers. Compared with traditional deep neural networks such as ResNet, WRN has a wider network structure, uses more convolution kernels in the convolutional layer in each residual block, and increases the representation capacity of each layer. This change gives the image classification model more degrees of freedom when learning features and can capture more and more complex features. Compared with ResNet, the baseline model WRN uses residual blocks for more frequent jump connections. The baseline network WRN has jump connections in each residual block, allowing information to flow more freely in the network, so that gradients can be propagated more easily, which helps to alleviate the gradient disappearance problem.
[0092] The method obtains an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; inputs the image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determines a pseudo label of the second image according to the first prediction value; calculates a second prediction value according to the first prediction value and the pseudo label, and screens the second image according to the second prediction value and a preset confidence threshold to obtain a third image; calculates a first loss value and a second loss value according to the third image and the initial image classification model; calculates a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; calculates a fifth loss value through the initial image classification model according to the second image and the third image; calculates a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and updates the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model. The present application achieves a balance in the feature space by introducing unlabeled data, and updates the initial image classification model according to the total loss value, thereby improving the accuracy of the image classification model.
[0093] In some embodiments, in step S103, calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image includes:
[0094] Step S201, obtaining the total number of label categories of the first image, the maximum number of samples belonging to the same label category among all label categories, and the minimum number of samples belonging to the same label category among all label categories;
[0095] Step S202, calculating the imbalance ratio according to the maximum sample quantity and the minimum sample quantity;
[0096] Step S203: Calculate the second prediction value according to the imbalance ratio and the pseudo label using the following formula:
[0097]
[0098] in, is the second predicted value of the i-th image, p i is the first prediction value of the i-th image, γ is the imbalance ratio, k is the total number of label categories of the first image, and j is the label category number of the sample after sorting by the number of samples belonging to the same label category;
[0099] Step S204: Filter all images in the second image whose second prediction value is greater than a preset confidence threshold to obtain a third image.
[0100] Specifically, in some embodiments, more high-quality unlabeled data biased toward the tail class are screened out by inputting the first predicted value of the unlabeled data into the adaptive rebalancing contrastive learning module.
[0101] Specifically, the pseudo labels of unlabeled images in a batch are counted and sorted in descending order according to the number of categories. The number of the category to which the sorted sample belongs is recorded as j. The unlabeled data prediction value p is adaptively adjusted inversely according to the imbalance ratio γ of the original data distribution of the image. i get The adjusted forecast value Screen and select the data with a confidence threshold p from the unlabeled data. 0 The predicted value of the tail class is adaptively increased by rebalancing the distribution of the original pathological image dataset in the opposite direction. The probability that unlabeled data of the tail class will be selected for model training. The adaptive rebalanced contrast learning module selects high-quality unlabeled data that is biased towards the tail class for training, adaptively increases the number of samples in the model training process and alleviates the problem of imbalanced pathological image data.
[0102] In some embodiments, in step S104, calculating the first loss value and the second loss value according to the third image and the initial image classification model includes:
[0103] Step S301, weakly enhancing the third image to obtain a first weakly enhanced image; strongly enhancing the third image to obtain a first strongly enhanced image;
[0104] Step S302: input the first weakly enhanced image into the initial image classification model to obtain a first weakly enhanced prediction value; input the first strongly enhanced image into the initial image classification model to obtain a first strongly enhanced prediction value;
[0105] Step S303: Calculate a first loss value according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula:
[0106]
[0107] Among them, L CL(r) is the first loss value of the rth third image, is the first weakly enhanced prediction value of the rth third image, is the first strong enhancement prediction value of the rth third image, is the first weakly enhanced prediction value of the s-th third image, and N is the total number of third images;
[0108] Step S304: Calculate a second loss value according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula:
[0109]
[0110] Among them, L con(r) is the second loss value of the r-th third image.
[0111] Specifically, in some embodiments, the third image is weakly enhanced and strongly enhanced respectively to obtain a corresponding weakly enhanced unlabeled image I uw With strongly enhanced unlabeled image I us Among them, weak enhancement methods include random rotation, random horizontal or vertical flipping and other strategies. The strong enhancement method uses the automatic data enhancement method of AutoAugment to enhance the training data by searching for appropriate data enhancement strategies to improve the performance of the model.
[0112] Specifically, strategies may include random cropping, random distortion, color transformation, scale transformation, etc.
[0113] Specifically, the weak enhancement of the same unlabeled sample With strong enhancement They are positive sample pairs, and the corresponding predicted values are obtained after entering the model and The predicted values corresponding to all other weakly enhanced unlabeled images in the same batch It is regarded as a negative sample for contrastive learning and the first loss value is calculated.
[0114] By calculating the first loss value, the consistency of positive sample pairs generated by the same unlabeled data in the feature space can be maximized, thereby shortening the distance between positive sample pairs in the feature space. At the same time, by minimizing the consistency of negative samples generated by other unlabeled data, they can be pushed away in the feature space, thereby effectively expanding the distance between different categories, thereby improving the classification performance and robustness of the model.
[0115] Specifically, to obtain the same unlabeled enhanced image With weakly enhanced image The predicted value of and Further calculate the consistency loss L con(r) , complete the consistency estimation. From this process, we can constrain and screen out high-confidence unlabeled images and reduce the interference of noise data on the model. con(r) The consistency estimation of different enhanced images of the same sample can continuously narrow the distance between the features of the positive samples during the model training process, improve the compactness of features of the same category in the feature space, and improve classification accuracy.
[0116] In some embodiments, in step S105, calculating a fourth loss value through an initial image classification model according to the first prediction value and the first image includes:
[0117] Step S401, filtering the first image according to a preset tail ratio to obtain a fourth image;
[0118] Step S402: weakly enhance the fourth image to obtain a second weakly enhanced image; strongly enhance the fourth image to obtain a second strongly enhanced image;
[0119] Step S403: input the second weakly enhanced image into the initial image classification model to obtain a second weakly enhanced prediction value; input the second strongly enhanced image into the initial image classification model to obtain a second strongly enhanced prediction value;
[0120] Step S404: Calculate a fourth loss value according to the second weak enhancement prediction value and the second strong enhancement prediction value by using the following formula:
[0121]
[0122] Among them, L t-dist(e) is the fourth loss value of the fourth image, is the second weakly enhanced prediction value of the e-th fourth image, is the second strongest enhanced prediction value of the e-th fourth image, for The Euclidean norm of , for The Euclidean norm of .
[0123] Specifically, this embodiment inputs the labeled data into the tail distance module, screens the labeled tail data, and expands the feature boundary of the tail class by calculating the tail distance, thereby alleviating the situation where the feature space of the tail class is squeezed.
[0124] In some embodiments, in step S106, calculating a fifth loss value through an initial image classification model according to the second image and the third image includes:
[0125] Step S501, randomly intercepting a rectangle from the first strongly enhanced image and covering it to the corresponding position of the second weakly enhanced image to obtain a first mixed image;
[0126] Step S502, intercepting an image with the same position and size as the rectangle from the first weakly enhanced image and overlaying it to the corresponding position of the second strongly enhanced image to obtain a second mixed image;
[0127] Step S503: Calculate the mixed label of the first mixed image and the mixed label of the second mixed image by the following formula:
[0128]
[0129] in, is the mixed label of the f-th mixed image, λ is the area ratio of the second image in the f-th mixed image, y A is the pseudo label of the second image corresponding to the f-th mixed image, with a value of 0 or 1, y B is the true label of the first image corresponding to the f-th mixed image, which is 0 or 1;
[0130] Step S504, inputting the first mixed image and the second mixed image into the initial image classification model to obtain a first mixed image prediction value and a second mixed image prediction value;
[0131] Step S505, calculating a divergence value according to the first mixed image prediction value and the second mixed image prediction value;
[0132] Step S506, screening the first mixed image and the second mixed image whose divergence values are greater than a preset confidence threshold to obtain a screened mixed image;
[0133] Step S507: Calculate a fifth loss value according to the second weak enhancement prediction value and the second strong enhancement prediction value by using the following formula:
[0134]
[0135] Among them, L mixer(d) is the fifth loss value of the dth filtered mixed image, k is the total number of label categories of the first image, j is the label category number of the sample after sorting by the number of samples belonging to the same label category, is the mixed label of the dth filtered mixed image, The first mixed image prediction value for the dth filtered mixed image.
[0136] In some embodiments, in step S505, the divergence value is calculated by the following formula, including:
[0137]
[0138] Among them, D mix(c) is the divergence value of the c-th mixed image pair, is the prediction value of the first mixed image in the cth mixed image pair, is the predicted value of the second mixed image in the cth pair of mixed images, where the cth pair of mixed images is an image pair consisting of the cth first mixed image and the cth second mixed image.
[0139] Specifically, the prediction results of the model for two mixed images obtained by different enhancement combinations of the same data should be similar. mix(c) Make a judgment, if D mix(c) If the value is greater than the confidence threshold, the mixed image prediction value With the corresponding mixed label Calculate the semi-supervised mixer loss L mixer(d) On the contrary, if D mix(c) The value is less than the confidence level p 0 , it means that the highly recognizable features of the image are not retained during the mixing process, and the mixed image is discarded.
[0140] This application compares the mixed image D mix(c) By using the confidence threshold method, mixed images with highly discriminative features can be screened out. During the screening process, the labeled image part of the mixed image provides supervision information to avoid blind addition of the mixed image, ensuring that the mixed image retains the highly recognizable features of the labeled image and the unlabeled image, thereby improving the quality of the mixed image. The model further learns the high-quality semi-supervised mixed enhanced images, increasing the features in the feature space, especially enriching the features in the tail class category. The semi-supervised mixer improves the generalization ability of the model under limited labeled data, while maintaining efficient use of the tail labeled and unlabeled data.
[0141] In some embodiments, in step S105, the third loss value is calculated by the following formula:
[0142]
[0143] Among them, L CE(i) is the third loss value of the i-th image of the first image, k is the total number of label categories of the first image, y ij is the true label of the i-th first image in the j-th label category, p ij is the first predicted value of the i-th first image in the j-th label category.
[0144] Specifically, in this embodiment, the labeled data is input into the model to obtain the corresponding predicted value p i And calculate the third loss value. By calculating the third loss value of the labeled data, the model parameters are optimized and the model is fine-tuned to better fit the labeled data. The model can better distinguish different categories, thereby improving classification accuracy.
[0145] This application expands the feature space of the tail class, adaptively introduces unlabeled data, and innovatively mixes and enhances the labeled data with the unlabeled data to generate more new data that tends to be the tail class, thereby achieving a balance in the feature space and improving the accuracy of the classification model.
[0146] Specifically, in order to facilitate understanding by those skilled in the art, a set of optimal embodiments is provided below:
[0147] 1. Data acquisition:
[0148] An image to be classified and an image training data set are obtained, wherein the image training data set includes a first image with a label and a second image without a label.
[0149] 2. Calculation of the second predicted value:
[0150] Inputting an image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determining a pseudo label of a second image according to the first prediction value;
[0151] The second prediction value is calculated based on the first prediction value and the pseudo label, specifically:
[0152] Obtaining the total number of label categories of the first image, the maximum number of samples belonging to the same label category among all label categories, and the minimum number of samples belonging to the same label category among all label categories;
[0153] Calculate the imbalance ratio based on the maximum sample size and the minimum sample size;
[0154] The second prediction value is calculated according to the imbalance ratio and pseudo label by the following formula:
[0155]
[0156] in, is the second predicted value of the i-th image, p i is the first prediction value of the i-th image, γ is the imbalance ratio, k is the total number of label categories of the first image, and j is the label category number of the sample after sorting by the number of samples belonging to the same label category.
[0157] 3. Calculation of the first loss value:
[0158] The second image is screened according to the second prediction value and a preset confidence threshold to obtain a third image;
[0159] Weakly enhancing the third image to obtain a first weakly enhanced image; strongly enhancing the third image to obtain a first strongly enhanced image;
[0160] Inputting the first weakly enhanced image into the initial image classification model to obtain a first weakly enhanced prediction value; inputting the first strongly enhanced image into the initial image classification model to obtain a first strongly enhanced prediction value;
[0161] The first loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by the following formula:
[0162]
[0163] Among them, L CL(r) is the first loss value of the rth third image, is the first weakly enhanced prediction value of the rth third image, is the first strong enhancement prediction value of the rth third image, is the first weakly enhanced prediction value of the sth third image, and N is the total number of third images.
[0164] 4. Calculation of the second loss value:
[0165] The second loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by the following formula:
[0166]
[0167] Among them, L con(r) is the second loss value of the r-th third image.
[0168] 5. Calculation of the third loss value:
[0169] The third loss value is calculated according to the first prediction value and the first image through the initial image classification model, wherein the third loss value is calculated according to the first prediction value and the first image through the initial image classification model through the following formula:
[0170]
[0171] Among them, L CE(i) is the third loss value of the i-th image of the first image, k is the total number of label categories of the first image, y ij is the true label of the i-th first image in the j-th label category, p ij is the first predicted value of the i-th first image in the j-th label category.
[0172] 6. Calculation of the fourth loss value:
[0173] The first image is screened according to a preset tail ratio to obtain a fourth image;
[0174] Weakly enhancing the fourth image to obtain a second weakly enhanced image; strongly enhancing the fourth image to obtain a second strongly enhanced image;
[0175] Inputting the second weakly enhanced image into the initial image classification model to obtain a second weakly enhanced prediction value; inputting the second strongly enhanced image into the initial image classification model to obtain a second strongly enhanced prediction value;
[0176] The fourth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula:
[0177]
[0178] Among them, L t-dist(e) is the fourth loss value of the fourth image, is the second weakly enhanced prediction value of the e-th fourth image, is the second strongest enhanced prediction value of the e-th fourth image, for The Euclidean norm of , for The Euclidean norm of .
[0179] 7. Calculation of the fifth loss value:
[0180] A rectangle is randomly intercepted from the first strongly enhanced image and covers the corresponding position of the second weakly enhanced image to obtain a first mixed image;
[0181] An image having the same position and size as the rectangle is intercepted from the first weakly enhanced image and covered to a corresponding position of the second strongly enhanced image to obtain a second mixed image;
[0182] The mixed label of the first mixed image and the mixed label of the second mixed image are calculated by the following formula:
[0183]
[0184] in, is the mixed label of the f-th mixed image, λ is the area ratio of the second image in the f-th mixed image, y A is the pseudo label of the second image corresponding to the f-th mixed image, with a value of 0 or 1, y B is the true label of the first image corresponding to the f-th mixed image, which is 0 or 1;
[0185] Inputting the first mixed image and the second mixed image into the initial image classification model to obtain a first mixed image prediction value and a second mixed image prediction value;
[0186] The divergence value is calculated according to the first mixed image prediction value and the second mixed image prediction value, wherein the divergence value is calculated according to the first mixed image prediction value and the second mixed image prediction value by the following formula, including:
[0187]
[0188] Among them, D mix(c) is the divergence value of the c-th mixed image pair, is the prediction value of the first mixed image in the cth mixed image pair, is a predicted value of the second mixed image in the c-th pair of mixed images, where the c-th pair of mixed images is an image pair consisting of the c-th first mixed image and the c-th second mixed image;
[0189] Screening the first mixed image and the second mixed image whose divergence values are greater than a preset confidence threshold to obtain a screened mixed image;
[0190] The fifth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula:
[0191]
[0192] Among them, L mixer(d) is the fifth loss value of the dth filtered mixed image, k is the total number of label categories of the first image, j is the label category number of the sample after sorting by the number of samples belonging to the same label category, is the mixed label of the dth filtered mixed image, The first mixed image prediction value for the dth filtered mixed image.
[0193] 8. Model iteration update:
[0194] The total loss value is calculated according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and the initial image classification model is updated according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
[0195] 9. Image Classification:
[0196] The image to be classified is input into the trained image classification model to obtain the classification result of the image to be classified.
[0197] A set of experimental examples is provided below:
[0198] Referring to Table 1, which is a schematic diagram of quantitative analysis experimental results, this application has been experimented on two challenging data sets to evaluate the effectiveness of this application. The quantitative analysis experimental results are shown in Table 1:
[0199] Table 1
[0200]
[0201] Table 1 shows the quantitative analysis experimental results of different models when the pathological image dataset is extremely unbalanced (imbalance ratio is 100 to 1), that is, when the ratio of the maximum number of categories to the minimum number of categories is 100 to 1. In the table, the accuracy, precision, recall and F1 score indicators are all the larger the better. This application has completed high-performance classification on the pathological image dataset, and is superior to the existing technology in all evaluation indicators.
[0202] Reference Figure 2 , the visualization results of qualitative analysis are as follows Figure 2 As shown, Figure 2This is a UMAP visualization image of the method of this application and the FixMatch model at the feature level. From the visualized feature map, it can be seen that in the existing method FixMatch, there are many head-class features and tail-class features that are too close or confused inside the dotted box, and the unclear boundaries of the features may cause rare pathological images belonging to the tail class to be misclassified by the model. The different categories of features of the method of this application are more evenly distributed in the feature space, which effectively reduces the confusion of different types of features and improves the classification accuracy of pathological images of the tail class such as rare diseases.
[0203] In addition, refer to Figure 3 In one embodiment of the present application, an image classification system is provided, including a data acquisition module 1100, a first prediction value calculation module 1200, a second prediction value calculation module 1300, a first loss value and a second loss value calculation module 1400, a third loss value and a fourth loss value calculation module 1500, a fifth loss value calculation module 1600 and an iteration module 1700, wherein:
[0204] The data acquisition module 1100 is used to acquire an image training data set, wherein the image training data set includes a first image with a label and a second image without a label;
[0205] The first prediction value calculation module 1200 is used to input the image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determine the pseudo label of the second image according to the first prediction value;
[0206] The second prediction value calculation module 1300 is used to calculate the second prediction value according to the first prediction value and the pseudo label, and screen the second image according to the second prediction value and a preset confidence threshold to obtain a third image;
[0207] The first loss value and the second loss value calculation module 1400 is used to calculate the first loss value and the second loss value according to the third image and the initial image classification model;
[0208] The third loss value and the fourth loss value calculation module 1500 is used to calculate the third loss value and the fourth loss value through the initial image classification model according to the first prediction value and the first image;
[0209] The fifth loss value calculation module 1600 is used to calculate a fifth loss value according to the second image and the third image through the initial image classification model;
[0210] The iteration module 1700 is used to calculate the total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and update the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
[0211] The system obtains an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; inputs the image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determines a pseudo label of the second image according to the first prediction value; calculates a second prediction value according to the first prediction value and the pseudo label, and screens the second image according to the second prediction value and a preset confidence threshold to obtain a third image; calculates a first loss value and a second loss value according to the third image and the initial image classification model; calculates a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; calculates a fifth loss value through the initial image classification model according to the second image and the third image; calculates a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and updates the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model. The present application achieves a balance in the feature space by introducing unlabeled data, and updates the initial image classification model according to the total loss value to improve the accuracy of the image classification model.
[0212] It should be noted that the present system embodiment and the above-mentioned method embodiment are based on the same inventive concept, so the relevant contents of the above-mentioned method embodiment are also applicable to the present system embodiment and will not be repeated here.
[0213] Figure 4 A schematic diagram of the hardware structure of image classification provided in an embodiment of the present application is shown.
[0214] The image classification device may include a processor 401 and a memory 402 storing computer program instructions.
[0215] Specifically, the processor 401 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0216] Memory 402 may include a large capacity memory for data or instructions. By way of example and not limitation, memory 402 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, memory 402 may include a removable or non-removable (or fixed) medium. In appropriate cases, memory 402 may be inside or outside of an integrated gateway disaster recovery device. In a specific embodiment, memory 402 is a non-volatile solid-state memory.
[0217] In some embodiments, the memory 402 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0218] The processor 401 implements any one of the image classification methods in the above embodiments by reading and executing computer program instructions stored in the memory 402 .
[0219] In one example, the image classification device may further include a communication interface 403 and a bus 410. Figure 4 As shown, the processor 401, the memory 402, and the communication interface 403 are connected via a bus 410 and communicate with each other.
[0220] The communication interface 403 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0221] Bus 410 includes hardware, software or both, and the components of image classification equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 410 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0222] The image classification device can perform the image classification method in the embodiment of the present application based on the three-dimensional design model, thereby realizing the combination Figure 1 and Figure 3 Described is an image classification method and system.
[0223] In addition, in combination with the image classification method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the image classification methods in the above embodiment is implemented.
[0224] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0225] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0226] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0227] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0228] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. An image classification method, characterized in that: The image classification method comprises: Acquire an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; Inputting the images in the image training data set into a preset initial image classification model to obtain a first prediction value, and determining a pseudo label of the second image according to the first prediction value; Calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image; Calculate a first loss value and a second loss value according to the third image and the initial image classification model; Calculate a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; Calculate a fifth loss value through the initial image classification model according to the second image and the third image; A total loss value is calculated according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and the initial image classification model is updated according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
2. The image classification method according to claim 1, characterized in that: The step of calculating a second prediction value according to the first prediction value and the pseudo label, and screening the second image according to the second prediction value and a preset confidence threshold to obtain a third image includes: Obtaining the total number of label categories of the first image, the maximum number of samples belonging to the same label category among all label categories, and the minimum number of samples belonging to the same label category among all label categories; Calculate the imbalance ratio according to the maximum sample quantity and the minimum sample quantity; The second prediction value is calculated according to the imbalance ratio and the pseudo label by the following formula: in, is the second predicted value of the i-th image, p i is the first prediction value of the i-th image, γ is the imbalance ratio, k is the total number of label categories of the first image, and j is the label category number of the sample after sorting by the number of samples belonging to the same label category; All images in the second image whose second prediction value is greater than the preset confidence threshold are screened to obtain the third image.
3. The image classification method according to claim 1, characterized in that: The calculating the first loss value and the second loss value according to the third image and the initial image classification model comprises: Weakly enhancing the third image to obtain a first weakly enhanced image; strongly enhancing the third image to obtain a first strongly enhanced image; Inputting the first weakly enhanced image into the initial image classification model to obtain a first weakly enhanced prediction value; inputting the first strongly enhanced image into the initial image classification model to obtain a first strongly enhanced prediction value; The first loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula: Among them, L CL(r) is the first loss value of the rth third image, is the first weakly enhanced prediction value of the rth third image, is the first strong enhancement prediction value of the rth third image, is the first weakly enhanced prediction value of the s-th third image, and N is the total number of third images; The second loss value is calculated according to the first weak enhancement prediction value and the first strong enhancement prediction value by using the following formula: Among them, L con(r) is the second loss value of the r-th third image.
4. The image classification method according to claim 3, characterized in that: Calculating a fourth loss value through the initial image classification model according to the first prediction value and the first image includes: Filtering the first image according to a preset tail ratio to obtain a fourth image; Weakly enhancing the fourth image to obtain a second weakly enhanced image; strongly enhancing the fourth image to obtain a second strongly enhanced image; Inputting the second weakly enhanced image into the initial image classification model to obtain a second weakly enhanced prediction value; inputting the second strongly enhanced image into the initial image classification model to obtain a second strongly enhanced prediction value; The fourth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula: Among them, L t-dist(e) is the fourth loss value of the fourth image, is the second weakly enhanced prediction value of the e-th fourth image, is the second strongest enhanced prediction value of the e-th fourth image, for The Euclidean norm of , for The Euclidean norm of .
5. The image classification method according to claim 4, characterized in that: The calculating a fifth loss value according to the second image and the third image by using the initial image classification model comprises: Randomly intercept a rectangle from the first strongly enhanced image and cover it to a corresponding position of the second weakly enhanced image to obtain a first mixed image; An image having the same position and size as the rectangle is intercepted from the first weakly enhanced image and covered to a corresponding position of the second strongly enhanced image to obtain a second mixed image; The mixed label of the first mixed image and the mixed label of the second mixed image are calculated by the following formula: in, is the mixed label of the f-th mixed image, λ is the area ratio of the second image in the f-th mixed image, y A is the pseudo label of the second image corresponding to the f-th mixed image, with a value of 0 or 1, y B is the true label of the first image corresponding to the f-th mixed image, which is 0 or 1; Inputting the first mixed image and the second mixed image into the initial image classification model to obtain a first mixed image prediction value and a second mixed image prediction value; Calculating a divergence value according to the first mixed image prediction value and the second mixed image prediction value; Screening the first mixed image and the second mixed image whose divergence values are greater than the preset confidence threshold to obtain a screened mixed image; The fifth loss value is calculated according to the second weak enhancement prediction value and the second strong enhancement prediction value by the following formula: Among them, L mixer(d) is the fifth loss value of the dth filtered mixed image, k is the total number of label categories of the first image, j is the label category number of the sample after sorting by the number of samples belonging to the same label category, is the mixed label of the dth filtered mixed image, The first mixed image prediction value for the dth filtered mixed image.
6. The image classification method according to claim 5, characterized in that: The divergence value is calculated by the following formula, including: Among them, D mix(c) is the divergence value of the c-th mixed image pair, is the prediction value of the first mixed image in the cth mixed image pair, is the predicted value of the second mixed image in the cth pair of mixed images, where the cth pair of mixed images is an image pair consisting of the cth first mixed image and the cth second mixed image.
7. The image classification method according to claim 1, characterized in that: The third loss value is calculated by the following formula: Among them, L CE(i) is the third loss value of the i-th image of the first image, k is the total number of label categories of the first image, y ij is the true label of the i-th first image in the j-th label category, p ij is the first predicted value of the i-th first image in the j-th label category.
8. An image classification system, characterized in that: The image classification system comprises: A data acquisition module, used to acquire an image training data set, wherein the image training data set includes a first image with a label and a second image without a label; a first prediction value calculation module, configured to input an image in the image training data set into a preset initial image classification model to obtain a first prediction value, and determine a pseudo label of the second image according to the first prediction value; a second prediction value calculation module, configured to calculate a second prediction value according to the first prediction value and the pseudo label, and to screen the second image according to the second prediction value and a preset confidence threshold to obtain a third image; A first loss value and a second loss value calculation module, used to calculate the first loss value and the second loss value according to the third image and the initial image classification model; A third loss value and a fourth loss value calculation module, configured to calculate a third loss value and a fourth loss value through the initial image classification model according to the first prediction value and the first image; a fifth loss value calculation module, configured to calculate a fifth loss value according to the second image and the third image through the initial image classification model; An iterative module is used to calculate a total loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and to update the initial image classification model according to the total loss value until the total loss value reaches a preset value, thereby obtaining a trained image classification model.
9. An image classification device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute an image classification method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute an image classification method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Training method and device for image category classification
CN113011474A
Image classification method and device, electronic equipment and storage medium
CN113033689A