Training method and device of image classification model, electronic equipment and storage medium

By acquiring classification information and initial features of unlabeled images, determining the target loss, and iteratively updating the image classification model parameters, the problems of insufficient training samples or low label accuracy are solved, thereby improving the training efficiency and accuracy of the model.

CN114332529BActive Publication Date: 2025-11-07BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111575684.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2025-11-07
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

In existing technologies, neural network models suffer from reduced training efficiency and lower image classification accuracy when the number of training samples is insufficient or the accuracy of manually assigned classification labels is low.

Method used

By acquiring classification information from multiple unlabeled images, combining it with initial features, determining the target loss, and iteratively updating the parameters of the image classification model, a target model with high prediction accuracy is obtained.

Benefits of technology

It improves the training efficiency and accuracy of image classification models, and can enhance the prediction accuracy of models in the absence of labeled data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332529B_ABST
    Figure CN114332529B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and device for training an image classification model, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises: obtaining a plurality of to-be-identified pictures; inputting the plurality of to-be-identified pictures into an initial image classification model respectively to obtain classification results corresponding to the plurality of to-be-identified pictures respectively; obtaining classification discrimination information of the plurality of to-be-identified pictures respectively based on the classification results; determining a target loss based on the classification discrimination information of at least two to-be-identified pictures with the same classification result and initial features of the at least two to-be-identified pictures respectively; and updating parameters of the initial image classification model based on the target loss to obtain a target image classification model. According to the scheme of the present disclosure, a target image classification model with high prediction accuracy can be obtained, and the accuracy of image classification can be improved based on the target image classification model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, and particularly relates to a training method and device of an image classification model, an electronic device and a storage medium. BACKGROUND

[0002] At present, neural networks are widely applied in the fields of image classification and image recognition. Specifically, a plurality of pictures and respective classification labels corresponding to the plurality of pictures can be acquired, and a neural network model is trained. Then, a to-be-recognized picture is input into the trained neural network model to obtain a category corresponding to the to-be-recognized picture.

[0003] However, the above process of training the neural network model may need to acquire a large number of pictures of different categories, and may need to assign respective classification labels to the large number of pictures of different categories by manual work. Thus, when the number of training samples is insufficient or the accuracy of manually assigning classification labels is low, the training efficiency of the neural network model may be affected, and then the accuracy of image classification is affected. SUMMARY

[0004] The present disclosure provides a training method and device of an image classification model, an electronic device and a storage medium, which solve the technical problem that when the number of training samples is insufficient or the accuracy of manually assigning classification labels is low, the training efficiency of the neural network model may be affected, and then the accuracy of image classification is affected.

[0005] The technical solutions of the embodiments of the present disclosure are as follows.

[0006] According to a first aspect of the embodiments of the present disclosure, a training method of an image classification model is provided. The method can include: acquiring a plurality of to-be-recognized pictures; inputting the plurality of to-be-recognized pictures into an initial image classification model respectively to obtain respective classification results of the plurality of to-be-recognized pictures; based on the classification results, acquiring respective classification discrimination information of the plurality of to-be-recognized pictures, wherein the classification discrimination information of each to-be-recognized picture is used to represent whether the classification result corresponding to the each to-be-recognized picture is correct; based on the respective classification discrimination information of at least two to-be-recognized pictures with the same classification result and respective initial features of the at least two to-be-recognized pictures, determining a target loss, wherein the initial feature of each to-be-recognized picture in the at least two to-be-recognized pictures is obtained by inputting the each to-be-recognized picture into the initial image classification model and then performing feature recognition; and based on the target loss, iteratively updating parameters of the initial image classification model to obtain a target image classification model.

[0007] Optionally, the classification discrimination information of each picture to be identified includes classification correct or classification error, and the classification discrimination information of each of the plurality of pictures to be identified is obtained based on the classification result, specifically including: inputting the target picture into the initial image classification model to perform feature recognition to obtain the initial feature of the target picture, the target picture being a picture corresponding to the same classification result as the real result corresponding to the first picture to be identified, the first picture to be identified being one of the plurality of pictures to be identified; when the similarity between the initial feature of the first picture to be identified and the initial feature of the target picture is greater than or equal to a similarity threshold, obtaining first classification discrimination information, the first classification discrimination information being used to represent that the classification discrimination information of the first picture to be identified is classification correct.

[0008] Optionally, the training method of the image classification model further includes: when the similarity between the initial feature of the first picture to be identified and the initial feature of the target picture is less than the similarity threshold, obtaining second classification discrimination information, the second classification discrimination information being used to represent that the classification discrimination information of the first picture to be identified is classification error.

[0009] Optionally, the training method of the image classification model further includes: obtaining a first loss, the first loss being used to represent the degree of inconsistency between the real result of each identified picture and the prediction result of the each identified picture in the initial image classification model; and the target loss is determined based on the classification discrimination information of each of the at least two pictures to be identified with the same classification result and the initial feature of each of the at least two pictures to be identified, specifically including: determining a second loss according to the classification discrimination information of each of the at least two pictures to be identified and the initial feature of each of the at least two pictures to be identified; determining a third loss according to the classification discrimination information of each of the at least two pictures to be identified; and determining the sum of the first loss, the second loss and the third loss as the target loss.

[0010] Optionally, the second loss is determined according to the classification discrimination information of each of the at least two pictures to be identified and the initial feature of each of the at least two pictures to be identified, specifically including: determining a distance function between the initial feature of the first picture to be identified and the initial feature of the second picture to be identified, the distance function being used to represent the degree of inconsistency between the initial feature of the first picture to be identified and the initial feature of the second picture to be identified, the first picture to be identified being one of the at least two pictures to be identified, and the second picture to be identified being a picture other than the first picture to be identified among the at least two pictures to be identified; and when the classification discrimination information of the first picture to be identified is the same as the classification discrimination information of the second picture to be identified, the distance function is determined as the second loss.

[0011] Optionally, the training method of the image classification model further includes: when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a difference between a preset constant and the distance function as the second loss.

[0012] Optionally, the determining the third loss according to the classification discrimination information of each of the at least two to-be-identified pictures specifically includes: when the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, determining a first loss threshold as the third loss, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; and when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a second loss threshold as the third loss, the second loss threshold being greater than the first loss threshold.

[0013] Optionally, the obtaining the first loss specifically includes: obtaining the at least one identified picture and a true result of each of the at least one identified picture; inputting a target identified picture into the initial image classification model to determine a target probability, the target probability being a probability that the target identified picture is predicted as a target true result, the target identified picture being one of the at least one identified picture, and the target true result being the true result of the target identified picture; determining a loss corresponding to the target identified picture based on the target probability; and determining a sum of the losses corresponding to the at least one identified picture respectively as the first loss, and obtaining the first loss.

[0014] According to a second aspect of the embodiments of the present disclosure, a training device of an image classification model is provided. The device can include an obtaining module, a processing module, and a determining module. The obtaining module is configured to obtain a plurality of to-be-identified pictures. The processing module is configured to input the plurality of to-be-identified pictures into an initial image classification model respectively to obtain classification results corresponding to the plurality of to-be-identified pictures respectively. The obtaining module is further configured to obtain classification discrimination information of each of the plurality of to-be-identified pictures based on the classification results, wherein the classification discrimination information of each to-be-identified picture is used to represent whether the classification result corresponding to the each to-be-identified picture is correct. The determining module is further configured to determine a target loss based on the classification discrimination information of at least two to-be-identified pictures with the same classification result and initial features of the at least two to-be-identified pictures respectively, the initial feature of each of the at least two to-be-identified pictures being obtained by performing feature recognition after inputting the each of the at least two to-be-identified pictures into the initial image classification model. The processing module is further configured to update parameters of the initial image classification model based on the target loss to obtain a target image classification model.

[0015] Optionally, the classification discrimination information of each picture to be identified comprises classification correct or classification error; the processing module is specifically configured to input the target picture into the initial image classification model to perform feature recognition, and obtain an initial feature of the target picture, the target picture being a picture corresponding to the same classification result as a real result corresponding to a first picture to be identified, the first picture to be identified being one of the multiple pictures to be identified; and the determination module is further configured to obtain first classification discrimination information when a similarity between the initial feature of the first picture to be identified and the initial feature of the target picture is greater than or equal to a similarity threshold, the first classification discrimination information being used to represent that the classification discrimination information of the first picture to be identified is classification correct.

[0016] Optionally, the determination module is further configured to obtain second classification discrimination information when the similarity between the initial feature of the first picture to be identified and the initial feature of the target picture is less than the similarity threshold, the second classification discrimination information being used to represent that the classification discrimination information of the first picture to be identified is classification error.

[0017] Optionally, the obtaining module is further configured to obtain a first loss, the first loss being used to represent a degree of inconsistency between a real result of each identified picture and a predicted result of the each identified picture in the initial image classification model; the determination module is specifically configured to determine a second loss according to the classification discrimination information of each of the at least two pictures to be identified and the initial feature of each of the at least two pictures to be identified; the determination module is further specifically configured to determine a third loss according to the classification discrimination information of each of the at least two pictures to be identified; and the determination module is further specifically configured to determine a sum of the first loss, the second loss and the third loss as the target loss.

[0018] Optionally, the determination module is further specifically configured to determine a distance function between the initial feature of the first picture to be identified and the initial feature of a second picture to be identified, the distance function being used to represent a degree of inconsistency between the initial feature of the first picture to be identified and the initial feature of the second picture to be identified, the first picture to be identified being one of the at least two pictures to be identified, and the second picture to be identified being a picture other than the first picture to be identified among the at least two pictures to be identified; and the determination module is further specifically configured to determine the distance function as the second loss when the classification discrimination information of the first picture to be identified is the same as the classification discrimination information of the second picture to be identified.

[0019] Optionally, the determination module is further specifically configured to determine a difference between a preset constant and the distance function as the second loss when the classification discrimination information of the first picture to be identified is different from the classification discrimination information of the second picture to be identified.

[0020] Optionally, the determining module is specifically further configured to: when the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, determining the first loss threshold as the third loss, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; and the determining module is specifically further configured to: when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a second loss threshold as the third loss, the second loss threshold being greater than the first loss threshold.

[0021] Optionally, the obtaining module is specifically configured to: obtain the at least one identified picture and a true result of each identified picture in the at least one identified picture; the determining module is further configured to: input a target identified picture into the initial image classification model to determine a target probability, the target probability being a probability that the target identified picture is predicted as a target true result, the target identified picture being one of the at least one identified picture, and the target true result being the true result of the target identified picture; the determining module is further configured to: determine a loss corresponding to the target identified picture based on the target probability; and the determining module is further configured to: determine a sum of the losses corresponding to the at least one identified picture respectively as the first loss; and the obtaining module is specifically further configured to: obtain the first loss.

[0022] According to a third aspect of embodiments of the present disclosure, an electronic device can include a processor and a memory configured to store processor-executable instructions; and wherein the processor is configured to execute the instructions to implement any of the optional training methods of the image classification model in the first aspect.

[0023] According to a fourth aspect of embodiments of the present disclosure, a computer-readable storage medium is provided, and the computer-readable storage medium stores instructions, when the instructions in the computer-readable storage medium are executed by an electronic device, the electronic device can execute any of the optional training methods of the image classification model in the first aspect.

[0024] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, and the computer program product includes computer instructions, when the computer instructions are executed on an electronic device, the electronic device executes any of the optional training methods of the image classification model in the first aspect.

[0025] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:

[0026] In the above any aspect, in the present disclosure, the electronic device can obtain a plurality of to-be-recognized pictures, and input the plurality of to-be-recognized pictures into an initial image classification model respectively to obtain a classification result corresponding to each of the plurality of to-be-recognized pictures; then the electronic device obtains classification discrimination information of each of the plurality of to-be-recognized pictures based on the classification result, that is, the classification discrimination information represents whether the classification result corresponding to each of the plurality of to-be-recognized pictures is correct. The electronic device can determine a target loss based on the classification discrimination information of at least two to-be-recognized pictures with the same classification result and initial features of the at least two to-be-recognized pictures. It can be understood that the target loss is determined based on the classification discrimination information and the initial features, and the difference between the at least two to-be-recognized pictures is determined, and then the current loss of the initial image classification model is determined. Then, the parameters of the initial image classification model are iteratively updated based on the target loss to obtain a target image classification model. In the embodiment of the present disclosure, the electronic device can obtain the classification discrimination information of the plurality of to-be-recognized pictures without adding classification labels. Since the classification discrimination information of each of the plurality of to-be-recognized pictures represents whether the classification result corresponding to the each of the plurality of to-be-recognized pictures is correct, and the initial features of the at least two to-be-recognized pictures are combined, the electronic device can determine the current loss (that is, the target loss) of the initial image classification model, and iteratively update the parameters of the initial image classification model based on the target loss to obtain a target image classification model with high prediction accuracy. The training efficiency of the image classification model can be improved, and then the accuracy of image classification can be improved.

[0027] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0028] The accompanying drawings, which are incorporated into the specification and constitute part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, serve to explain the principles of the present disclosure, and do not constitute undue limitations on the present disclosure.

[0029] Figure 1 A flowchart of a method for training an image classification model is shown;

[0030] Figure 2 A flowchart of another method for training an image classification model is shown;

[0031] Figure 3 A flowchart of another method for training an image classification model is shown;

[0032] Figure 4 A flowchart of another method for training an image classification model is shown;

[0033] Figure 5 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure;

[0034] Figure 6 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure;

[0035] Figure 7 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure;

[0036] Figure 8 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure;

[0037] Figure 9 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure;

[0038] Figure 10 FIG. 3 shows a flowchart of a method for training an image classification model according to an embodiment of the present disclosure; DETAILED DESCRIPTION

[0039] In order to make the ordinary person skilled in the art better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings.

[0040] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0041] It should also be understood that the term "comprising" indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, and / or components.

[0042] The data involved in the present disclosure can be data authorized by the user or sufficiently authorized by all parties.

[0043] As described in the background, due to the technical problem that when the number of training samples is insufficient or the accuracy of manually assigned classification labels is low in the prior art, the training efficiency of the neural network model can be affected, and in turn the accuracy of image classification is affected.

[0044] Based on this, the embodiment of the present disclosure provides a training method of an image classification model. An electronic device can obtain classification discrimination information of each of a plurality of to-be-identified pictures which have not been added with a classification label. Since the classification discrimination information of each of the plurality of to-be-identified pictures is used to represent whether the classification result corresponding to the each of the to-be-identified pictures is correct, and in turn, in combination with the initial features of the at least two to-be-identified pictures, the electronic device can determine the current loss (i.e. target loss) of the initial image classification model, and update the parameters of the initial image classification model based on the target loss to obtain a target image classification model with high prediction accuracy. The training efficiency of the image classification model can be improved, and in turn the accuracy of image classification can be improved.

[0045] The training method of the image classification model, the device, the electronic device and the storage medium provided by the embodiment of the present disclosure are applied to the image classification scene. When the electronic device obtains a plurality of to-be-identified pictures, the parameters of the initial image classification model can be updated to obtain a target image classification model according to the method provided by the embodiment of the present disclosure.

[0046] The training method of the image classification model provided by the embodiment of the present disclosure is exemplarily described below in combination with the drawings:

[0047] It can be understood that the electronic device executing the training method of the image classification model provided by the embodiment of the present disclosure can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, and the like, which can install and use a content community application. The specific form of the electronic device is not specially limited in the present disclosure. It can interact with the user through one or more ways such as a keyboard, a touchpad, a touch screen, a remote control, voice interaction, or a handwriting device.

[0048] As shown in Figure 1 The training method of the image classification model provided by the embodiment of the present disclosure can include S101-S105.

[0049] S101, obtaining a plurality of to-be-identified pictures.

[0050] It should be understood that the plurality of to-be-recognized pictures are training data without assigned labels, that is, when the electronic device obtains the plurality of to-be-recognized pictures, the respective true results corresponding to the plurality of to-be-recognized pictures are not obtained.

[0051] S102, respectively input the plurality of to-be-recognized pictures to the initial image classification model to obtain a respective classification result corresponding to each of the plurality of to-be-recognized pictures.

[0052] It should be understood that the initial image classification model can be an image classification model trained by the electronic device based on at least one recognized picture and the respective true result (or classification label) corresponding to the at least one recognized picture. The respective classification result corresponding to each of the plurality of to-be-recognized pictures is a prediction result of the initial image classification model on the plurality of to-be-recognized pictures.

[0053] S103, based on the classification result, obtaining classification discrimination information of each of the plurality of to-be-recognized pictures.

[0054] Each classification discrimination information of each to-be-recognized picture is used to represent whether the classification result corresponding to the to-be-recognized picture is correct.

[0055] It can be understood that, since the plurality of to-be-recognized pictures are training data without true results (or classification labels), the electronic device cannot determine the respective true results corresponding to the plurality of to-be-recognized pictures. By obtaining the classification discrimination information of the plurality of to-be-recognized pictures, it can be determined whether the classification result (i.e., the prediction result) obtained by predicting each to-be-recognized picture in the plurality of to-be-recognized pictures via the initial image classification model is correct.

[0056] In an implementation manner of the embodiment of the present disclosure, the classification discrimination information of each of the plurality of to-be-recognized pictures can be obtained after artificial judgment, and the electronic device can obtain the classification discrimination information of each of the plurality of to-be-recognized pictures after artificial judgment.

[0057] In another implementation manner of the embodiment of the present disclosure, for each to-be-recognized picture, the electronic device can also compare the to-be-recognized picture with a target picture (the true result corresponding to the target picture is the same as the classification result corresponding to the to-be-recognized picture), and then determine and add classification discrimination information for the to-be-recognized picture based on the comparison result.

[0058] S104, based on the classification discrimination information of each of the at least two to-be-recognized pictures with the same classification result and the initial feature of each of the at least two to-be-recognized pictures, determining a target loss.

[0059] The initial feature of each of the at least two to-be-recognized pictures is obtained by inputting each of the at least two to-be-recognized pictures to the initial image classification model and performing feature recognition.

[0060] Specifically, the initial image classification model can include an initial feature extractor and an initial classifier. The electronic device inputs each of the to-be-identified pictures into the initial feature extractor to obtain initial features of each of the to-be-identified pictures, and then inputs the initial features of each of the to-be-identified pictures into the initial classifier to obtain a classification result corresponding to each of the to-be-identified pictures.

[0061] It can be understood that there can be to-be-identified pictures with the same classification result in the plurality of to-be-identified pictures. When the classification results corresponding to two to-be-identified pictures are the same, it indicates that the two to-be-identified pictures are determined or classified into the same category by the initial image classification model. In the embodiment of the present disclosure, the electronic device can select or determine the at least two to-be-identified pictures from any category of the plurality of categories.

[0062] It should be understood that although the classification results corresponding to the at least two to-be-identified pictures are the same, the classification discrimination information corresponding to the at least two to-be-identified pictures can be the same or different. When the classification discrimination information corresponding to the at least two to-be-identified pictures is the same, the initial features of the at least two to-be-identified pictures can have certain similarity. When the classification discrimination information corresponding to the at least two to-be-identified pictures is different, the initial features corresponding to the at least two to-be-identified pictures can have certain difference.

[0063] In the embodiment of the present disclosure, the electronic device can determine the difference between the at least two to-be-identified pictures based on the classification discrimination information corresponding to the at least two to-be-identified pictures and the initial features of the at least two to-be-identified pictures, and further determine the target loss, that is, determine the current loss of the initial image classification model.

[0064] S105, iteratively update the parameters of the initial image classification model based on the target loss to obtain a target image classification model.

[0065] In an implementation manner of the embodiment of the present disclosure, the electronic device iteratively updates the parameters of the initial image classification model based on the target loss until the prediction accuracy of the current image classification model is greater than or equal to the accuracy threshold, at which time the current image classification model can be determined as the target image classification model.

[0066] The technical solutions provided by the above embodiments can bring at least the following beneficial effects: as can be seen from S101-S105, the electronic device can obtain a plurality of to-be-identified pictures, and input the plurality of to-be-identified pictures into an initial image classification model respectively to obtain respective classification results corresponding to the plurality of to-be-identified pictures; then the electronic device obtains respective classification discrimination information of the plurality of to-be-identified pictures based on the classification results, that is, the respective classification discrimination information represents whether the respective classification results corresponding to the plurality of to-be-identified pictures are correct. The electronic device can determine a target loss based on the respective classification discrimination information of at least two to-be-identified pictures with the same classification result and respective initial features of the at least two to-be-identified pictures. It can be understood that the target loss is determined based on the classification discrimination information and the initial features, and the difference between the at least two to-be-identified pictures is determined, and then the current loss of the initial image classification model is determined. Then, the parameters of the initial image classification model are iteratively updated based on the target loss to obtain a target image classification model. In the embodiment of the present disclosure, the electronic device can obtain the respective classification discrimination information of the plurality of to-be-identified pictures which are not added with classification labels. Since the classification discrimination information of each to-be-identified picture in the plurality of to-be-identified pictures represents whether the classification result corresponding to the each to-be-identified picture is correct, and the respective initial features of the at least two to-be-identified pictures are combined, the electronic device can determine the current loss (that is, the target loss) of the initial image classification model, and iteratively update the parameters of the initial image classification model based on the target loss to obtain a target image classification model with high prediction accuracy. The training efficiency of the image classification model can be improved, and then the accuracy of image classification can be improved.

[0067] In combination Figure 1 As Figure 2 shown, in an implementation manner of the embodiment of the present disclosure, the classification discrimination information of each to-be-identified picture includes classification correct or classification error, and the obtaining of the respective classification discrimination information of the plurality of to-be-identified pictures based on the classification results includes S1031-S1032.

[0068] S1031, input the target picture into the initial image classification model to perform feature recognition and obtain the initial feature of the target picture.

[0069] The target picture is a picture with the same corresponding true result as the classification result corresponding to the first to-be-identified picture, and the first to-be-identified picture is one of the plurality of to-be-identified pictures.

[0070] It should be understood that the target picture can be one of the at least one identified picture, that is, the target picture has a corresponding true result (or classification label). In the embodiment of the present disclosure, the electronic device can determine a picture with the same true result as the classification result corresponding to the first to-be-identified picture from the at least one identified picture, and determine the picture as the target picture, and then obtain the initial feature of the target picture.

[0071] S1032. When the similarity between the initial features of the first image to be identified and the initial features of the target image is greater than or equal to the similarity threshold, the first classification information is obtained.

[0072] The first classification information is used to indicate that the classification of the first image to be identified is correct.

[0073] Based on the description of the above embodiments, it should be understood that the electronic device can input a first image to be identified into an initial image classification model to perform feature recognition and obtain the initial features of the first image to be identified. When the similarity between the initial features of the first image to be identified and the initial features of the target image is greater than or equal to the similarity threshold, it indicates that the initial features of the first image to be identified are relatively similar to the initial features of the target image, that is, the first image to be identified is relatively similar to the target image. Thus, the electronic device can determine that the classification result corresponding to the first image to be identified is correct, that is, obtain the first classification discrimination information.

[0074] The technical solution provided by the above embodiments can bring at least the following beneficial effects: As shown in S1031-S1032, the electronic device can input the target image (i.e., the image whose corresponding real result is the same as the classification result corresponding to the first image to be identified) into the initial image classification model to perform feature recognition and obtain the initial features of the target image; when the similarity between the initial features of the first image to be identified and the initial features of the target image is greater than or equal to the similarity threshold, it indicates that the initial features of the first image to be identified are relatively similar to the initial features of the target image, that is, the first image to be identified is relatively similar to the target image. Thus, the electronic device can determine that the classification result corresponding to the first image to be identified is correct, that is, obtain the first classification discrimination information that represents the first image to be identified as correctly classified. In this embodiment of the present disclosure, the electronic device can determine whether the classification result of the first image to be identified is correct based on the similarity between the target image and the first image to be identified, and obtain the first classification discrimination information when the classification result of the first image to be identified is correct. It can accurately and effectively obtain the classification discrimination information of each image to be identified, improve the training efficiency of the image classification model, and improve the prediction accuracy of the target image classification model.

[0075] Combination Figure 2 ,like Figure 3 As shown, the training method for the image classification model provided in this embodiment of the present disclosure further includes S1033.

[0076] S1033. When the similarity between the initial features of the first image to be identified and the initial features of the target image is less than the similarity threshold, the second classification information is obtained.

[0077] The second classification information is used to indicate that the classification information of the first image to be identified is a classification error.

[0078] It is understandable that when the similarity between the initial features of the first image to be identified and the initial features of the target image is less than the similarity threshold, it means that the initial features of the first image to be identified are not similar to the initial features of the target image. Specifically, the first image to be identified is not similar to the target image. In this way, the electronic device can determine that the classification result corresponding to the first image to be identified is incorrect, that is, obtain the second classification discrimination information.

[0079] The technical solution provided by the above embodiments can bring at least the following beneficial effects: As shown in S1033, when the similarity between the initial features of the first image to be identified and the initial features of the target image is less than the similarity threshold, it indicates that the initial features of the first image to be identified are not similar to the initial features of the target image, that is, the first image to be identified is not similar to the target image. Thus, the electronic device can determine that the classification result corresponding to the first image to be identified is incorrect, that is, obtain second classification discrimination information indicating that the first image to be identified is classified incorrectly. In this embodiment of the present disclosure, the electronic device can determine whether the classification result of the first image to be identified is correct based on the similarity between the target image and the first image to be identified, and obtain second classification discrimination information when the classification result of the first image to be identified is incorrect. It can accurately and effectively obtain the classification discrimination information of each image to be identified, improve the training efficiency of the image classification model, and improve the prediction accuracy of the target image classification model.

[0080] Combination Figure 1 ,like Figure 4 As shown, the training method for the image classification model provided in this embodiment of the present disclosure further includes S106.

[0081] S106, Receive the first loss.

[0082] The first loss is used to characterize the degree of inconsistency between the true result of each identified image in at least one identified image and the prediction result of each identified image in the above-mentioned initial image classification model.

[0083] Continue as Figure 4 As shown, the target loss is determined based on the classification information of at least two images to be identified with the same classification result and the initial features of at least two images to be identified, including S1041-S1043.

[0084] S1041. Determine the second loss based on the classification information of at least two images to be identified and the initial features of at least two images to be identified.

[0085] It should be understood that this second loss is used to characterize the degree of inconsistency between the features of the image to be identified that is correctly classified and the features of the image to be identified that is incorrectly classified.

[0086] S1042. Determine the third loss based on the classification information of at least two images to be identified.

[0087] Understandably, this third loss is used to characterize the loss caused by classification and discrimination information.

[0088] It should be noted that the execution order of S1041 and S1042 described above is not limited in this embodiment. For example, S1041 can be executed first and then S1042, or S1042 can be executed first and then S1041, or S1041 and S1042 can be executed simultaneously. For ease of explanation, Figure 3 The example is to execute S1041 first and then S1042.

[0089] S1043. The sum of the first loss, the second loss, and the third loss is determined as the target loss.

[0090] The technical solution provided by the above embodiments can bring at least the following beneficial effects: As can be seen from S106 and S1041-S1043, the electronic device can obtain a first loss; then, based on the classification information of each of the at least two images to be identified and the initial features of each of the at least two images to be identified, a second loss is determined, and a third loss is determined based on the classification information of each of the at least two images to be identified; subsequently, the electronic device determines the sum of the first loss, the second loss, and the third loss as the target loss. This allows for a complete and effective determination of the target loss, thereby improving the training efficiency of the image classification model.

[0091] Combination Figure 4 ,like Figure 5 As shown, in one implementation of this disclosure, the determination of the second loss based on the classification information of at least two images to be identified and the initial features of at least two images to be identified includes S1041a-S1041b.

[0092] S1041a. Determine the distance function between the initial features of the first image to be identified and the initial features of the second image to be identified.

[0093] The distance function is used to characterize the degree of inconsistency between the initial features of the first image to be identified and the initial features of the second image to be identified. The first image to be identified is one of the at least two images to be identified, and the second image to be identified is an image other than the first image to be identified among the at least two images to be identified.

[0094] S1041b, when the classification discrimination information of the first to-be-recognized picture is same as the classification discrimination information of the second to-be-recognized picture, determine the distance function as the second loss.

[0095] In combination with the description of the above embodiments, it should be understood that when the classification discrimination information of the first to-be-recognized picture is same as the classification discrimination information of the second to-be-recognized picture, it indicates that there is a certain similarity between the initial feature of the first to-be-recognized picture and the initial feature of the second to-be-recognized picture. In this way, the electronic device can determine the distance function between the initial feature of the first to-be-recognized picture and the initial feature of the second to-be-recognized picture as the second loss.

[0096] In an optional implementation, the above determining the distance function as the second loss can specifically include: determining that the second loss satisfies the following formula:

[0097] Loss contrastive =dist(F A ,F B )

[0098] Wherein, Loss contrastive represents the second loss, F A represents the initial feature of the first to-be-recognized picture, F B represents the initial feature of the second to-be-recognized picture, and dist(F A ,F B ) represents the distance function between the initial feature of the first to-be-recognized picture and the initial feature of the second to-be-recognized picture.

[0099] Specifically, dist() can be understood as a distance function for representing the difference between two elements (for example, F A and F B ). When the value obtained by dist(F A ,F B ), that is, the second loss (Loss contrastive ) is larger, it indicates that the difference between the initial feature (F A ) of the first to-be-recognized picture and the initial feature (F B ) of the second to-be-recognized picture is larger. Correspondingly, when the second loss is smaller, it indicates that the difference between the initial feature of the first to-be-recognized picture and the initial feature of the second to-be-recognized picture is smaller (that is, the two initial features are more similar).

[0100] The technical solutions provided by the above embodiments can bring at least the following beneficial effects: as can be known from S1041a-S1041b, the electronic device can determine a distance function between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture; when the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, it indicates that the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture have a certain similarity; since the distance function is used to represent the degree of inconsistency between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the electronic device can determine the distance function as the second loss. In the embodiment of the present disclosure, when the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture have a certain similarity, the electronic device can determine the distance function between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture as the second loss, which can accurately and effectively determine the second loss, thereby improving the determination accuracy of the target loss.

[0101] In combination Figure 5 As Figure 6 indicated, the method for training the image classification model provided by the embodiment of the present disclosure further includes S1041c.

[0102] S1041c, when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a difference value between the preset constant and the distance function as the second loss.

[0103] It should be understood that the distance function is the distance function between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture. When the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, it indicates that the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture have a certain difference. Therefore, the electronic device can determine the difference value between the preset constant and the distance function as the second loss.

[0104] In an optional implementation, the above-mentioned determination of the difference value between the preset constant and the distance function as the second loss can specifically include: determining that the second loss satisfies the following formula:

[0105] Loss contrastive =ε-dist(F A ,F B );

[0106] Wherein, Loss contrastive represents the second loss, F A represents the initial feature of the first to-be-identified picture, and F BThis represents the initial features of the second image to be identified, dist(F). A ,F B ) represents the distance function between the initial features of the first image to be identified and the initial features of the second image to be identified, and ε represents a preset constant, ε>0.

[0107] The technical solution provided by the above embodiments can bring at least the following beneficial effects: As shown in S1041c, when the classification information of the first image to be identified is different from the classification information of the second image to be identified, it indicates that there is a certain difference between the initial features of the first image to be identified and the initial features of the second image to be identified. Thus, the electronic device can determine the second loss by the difference between a preset constant and a distance function (specifically, the distance function between the initial features of the first image to be identified and the initial features of the second image to be identified), which can accurately and effectively determine the second loss, thereby improving the accuracy of the target loss determination.

[0108] Combination Figure 4 ,like Figure 7 As shown, in one implementation of this disclosure, the determination of the third loss based on the classification information of at least two images to be identified specifically includes S1042a-S1042b.

[0109] S1042a. When the classification information of the first image to be identified is the same as the classification information of the second image to be identified, the first loss threshold is determined as the third loss.

[0110] Based on the description of the above embodiments, it should be understood that the first image to be identified is one of the at least two images to be identified, and the second image to be identified is an image other than the first image to be identified among the at least two images to be identified.

[0111] S1042b: When the classification information of the first image to be identified is different from the classification information of the second image to be identified, the second loss threshold is determined as the third loss.

[0112] The second loss threshold is greater than the first loss threshold.

[0113] With the above description of the embodiments, it should be understood that, since the classification result corresponding to the first to-be-identified picture is the same as the classification result corresponding to the second to-be-identified picture. When the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, it indicates that there is a certain similarity between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture; when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, it indicates that there is a certain difference between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture.

[0114] In the embodiments of the present disclosure, when there is a certain difference between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the third loss can be larger (corresponding to the second loss threshold described above), and when there is a certain similarity between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the third loss can be smaller (corresponding to the first loss threshold described above).

[0115] Optionally, the first loss threshold can be 0, and the first loss threshold can be 1.

[0116] The technical solutions provided in the above embodiments can at least bring the following beneficial effects: as can be known from S1042a-S1042b, when the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, the electronic device can determine the first loss threshold as the third loss; on the contrary, when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, the electronic device can determine the second loss threshold as the third loss, and the second loss threshold is greater than the first loss threshold. In the embodiments of the present disclosure, the electronic device can assign different values (i.e., the first loss threshold or the second loss threshold) to the third loss based on the classification discrimination information of each of the at least two to-be-identified pictures, which can quickly and effectively determine the third loss, thereby improving the training efficiency of the image classification model.

[0117] In combination with Figure 4 As Figure 8 shown, in an implementation manner of the embodiments of the present disclosure, the above obtaining the first loss includes S1061-S1064.

[0118] S1061, obtaining at least one identified picture and a true result of each identified picture in the at least one identified picture.

[0119] With the above description of the embodiments, it should be understood that the at least one identified picture is a picture with a true result (i.e., a classification label), and the initial image classification model is obtained by the electronic device based on the at least one identified picture and the true result corresponding to each of the at least one identified picture.

[0120] S1062, input the target identified picture to the initial image classification model to determine a target probability.

[0121] The target probability is a probability that the target identified picture is predicted as a target real result, the target identified picture is one of the at least one identified picture, and the target real result is a real result of the target identified picture.

[0122] It should be understood that the target probability is a probability that the target identified picture is predicted by the initial image classification model as a real result corresponding to the target identified picture. In the embodiments of the present disclosure, the electronic device can input each identified picture in the at least one identified picture to the initial image classification model to determine a probability corresponding to each identified picture.

[0123] It can be understood that for the target identified picture, the electronic device inputs the target identified picture to the initial image classification model to obtain a plurality of classifications and probabilities of the plurality of classifications respectively; then the electronic device can determine a maximum value in the probabilities of the plurality of classifications respectively as the target probability, and determine a classification corresponding to the target probability as a classification result corresponding to the target identified picture, at this time the classification result is the target real result.

[0124] S1063, determine a loss corresponding to the target identified picture based on the target probability.

[0125] It can be understood that the electronic device can determine a loss corresponding to each identified picture based on the probability corresponding to each identified picture.

[0126] S1064, determine a sum of the losses corresponding to the at least one identified picture respectively as a first loss, and obtain the first loss.

[0127] The technical solutions provided by the above embodiments can bring at least the following beneficial effects: as can be seen from S1061-S1064, the electronic device can obtain at least one identified picture and a true result of each identified picture in the at least one identified picture, input a target identified picture (that is, one identified picture in the at least one identified picture) into an initial image classification model to determine a target probability (that is, a probability that the target identified picture is predicted as the true result corresponding to the target identified picture), and then determine a loss corresponding to the target identified picture based on the target probability. Thus, the electronic device can determine the loss corresponding to each of the at least one identified picture. Then, the electronic device can determine a sum of the losses corresponding to the at least one identified picture as a first loss, and obtain the first loss. In the present disclosure, the electronic device can accurately and effectively obtain the first loss, improve the efficiency of obtaining the first loss, and further improve the efficiency of determining the target loss and the prediction efficiency of the target image classification model.

[0128] In an implementation manner of the embodiments of the present disclosure, the determining of the loss corresponding to the target identified picture based on the target probability includes step A.

[0129] Step A, the loss corresponding to the target identified picture satisfies the following formula:

[0130]

[0131] wherein, Loss ce represents the loss corresponding to the target identified picture, c represents the total number of true results, y i represents the target probability.

[0132] Thus, the electronic device can determine the loss corresponding to each of the at least one identified picture based on the above formula.

[0133] The technical solutions provided by the above embodiments can bring at least the following beneficial effects: as can be seen from step A, the electronic device can accurately and effectively determine the loss corresponding to the target identified picture based on a specific formula, that is, can accurately determine the loss corresponding to each of the at least one identified picture. Thus, the efficiency of determining the first loss is improved, and the training efficiency of the image classification model is improved.

[0134] It can be understood that, in actual implementation, the electronic device described in the embodiments of the present disclosure can include one or more hardware structures and / or software modules for implementing the training method of the aforementioned corresponding image classification model, and these execution hardware structures and / or software modules can constitute an electronic device. Those skilled in the art should easily realize that, in combination with the algorithm steps of each example described in the embodiments disclosed herein, the present disclosure can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or computer software driven hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present disclosure.

[0135] Based on such understanding, the embodiments of the present disclosure also correspondingly provide an image classification model training device, Figure 9 The structure schematic diagram of the image classification model training device provided by the embodiments of the present disclosure is shown. As Figure 9 shown, the image classification model training device 10 can include an acquisition module 101, a processing module 102, and a determination module 103.

[0136] The acquisition module 101 is configured to acquire a plurality of to-be-identified pictures.

[0137] The processing module 102 is configured to input the plurality of to-be-identified pictures into an initial image classification model respectively, to obtain respective classification results corresponding to the plurality of to-be-identified pictures.

[0138] The acquisition module 101 is further configured to acquire classification discrimination information of each to-be-identified picture based on the classification result, wherein the classification discrimination information of each to-be-identified picture is used to represent whether the classification result corresponding to the each to-be-identified picture is correct.

[0139] The determination module 103 is further configured to determine a target loss based on the classification discrimination information of at least two to-be-identified pictures with the same classification result and respective initial features of the at least two to-be-identified pictures, wherein the initial feature of each to-be-identified picture in the at least two to-be-identified pictures is obtained by inputting the each to-be-identified picture into the initial image classification model and performing feature recognition.

[0140] The processing module 102 is further configured to iteratively update parameters of the initial image classification model based on the target loss, to obtain a target image classification model.

[0141] Optionally, the classification discrimination information of each to-be-identified picture includes classification correct or classification error.

[0142] The processing module 102 is specifically configured to input a target picture into the initial image classification model to perform feature recognition to obtain an initial feature of the target picture, the target picture being a picture corresponding to a classification result same as a real result corresponding to a first to-be-recognized picture, the first to-be-recognized picture being one of the plurality of to-be-recognized pictures.

[0143] The determining module 103 is further configured to obtain first classification discrimination information when a similarity between the initial feature of the first to-be-recognized picture and the initial feature of the target picture is greater than or equal to a similarity threshold, the first classification discrimination information being used to represent that classification discrimination information of the first to-be-recognized picture is correct.

[0144] Optionally, the determining module 103 is further configured to obtain second classification discrimination information when the similarity between the initial feature of the first to-be-recognized picture and the initial feature of the target picture is less than the similarity threshold, the second classification discrimination information being used to represent that the classification discrimination information of the first to-be-recognized picture is incorrect.

[0145] Optionally, the obtaining module 101 is further configured to obtain a first loss, the first loss being used to represent a degree of inconsistency between a real result of each recognized picture in the at least one recognized picture and a prediction result of the each recognized picture in the initial image classification model.

[0146] The determining module 103 is specifically configured to determine a second loss according to the classification discrimination information of each of the at least two to-be-recognized pictures and the initial feature of each of the at least two to-be-recognized pictures.

[0147] The determining module 103 is further configured to determine a third loss according to the classification discrimination information of each of the at least two to-be-recognized pictures.

[0148] The determining module 103 is further configured to determine a sum of the first loss, the second loss and the third loss as the target loss.

[0149] Optionally, the determining module 103 is further configured to determine a distance function between the initial feature of the first to-be-recognized picture and the initial feature of a second to-be-recognized picture, the distance function being used to represent a degree of inconsistency between the initial feature of the first to-be-recognized picture and the initial feature of the second to-be-recognized picture, the first to-be-recognized picture being one of the at least two to-be-recognized pictures, and the second to-be-recognized picture being a picture other than the first to-be-recognized picture in the at least two to-be-recognized pictures.

[0150] The determining module 103 is further configured to determine the distance function as the second loss when the classification discrimination information of the first to-be-recognized picture is same as the classification discrimination information of the second to-be-recognized picture.

[0151] Optionally, the determining module is specifically further configured to determine a difference between a preset constant and the distance function as the second loss when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture.

[0152] Optionally, the determining module 103 is specifically further configured to determine the first loss threshold as the third loss when the classification discrimination information of a first to-be-identified picture is the same as the classification discrimination information of a second to-be-identified picture, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures.

[0153] The determining module 103 is specifically further configured to determine a second loss threshold as the third loss when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, the second loss threshold being greater than the first loss threshold.

[0154] Optionally, the obtaining module 101 is specifically configured to obtain the at least one identified picture and a true result of each identified picture in the at least one identified picture.

[0155] The determining module 103 is further configured to input a target identified picture into the initial image classification model to determine a target probability, the target probability being a probability that the target identified picture is predicted as a target true result, the target identified picture being one of the at least one identified picture, and the target true result being the true result of the target identified picture.

[0156] The determining module 103 is further configured to determine a loss corresponding to the target identified picture based on the target probability.

[0157] The determining module 103 is further configured to determine a sum of the losses corresponding to the at least one identified picture respectively as the first loss.

[0158] The obtaining module 101 is specifically further configured to obtain the first loss.

[0159] As described above, the embodiments of the present disclosure can divide the functional modules of the training device of the image classification model according to the above method examples. Among them, the above integrated modules can be realized in the form of hardware or in the form of software functional modules. In addition, it needs to be explained that the division of modules in the embodiments of the present disclosure is illustrative, and is only a logical function division. When actually implemented, there can be another division manner. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated in one processing module.

[0160] As to the training apparatus of the image classification model in the foregoing embodiments, the specific manners in which various modules perform operations and the beneficial effects possessed by the training apparatus have been described in detail in the foregoing method embodiments, and thus will not be described here.

[0161] Figure 10 is a structural schematic diagram of another training apparatus of an image classification model provided by the present disclosure. As shown in FIG. FIG. image classification model training, the training apparatus 20 of the image classification model can include at least one processor 201 and a memory 203 for storing processor-executable instructions. Wherein the processor 201 is configured to execute the instructions in the memory 203 to implement the image classification model training method in the foregoing embodiments.

[0162] In addition, the training apparatus 20 of the image classification model can also include a communication bus 202 and at least one communication interface 204.

[0163] The processor 201 can be a central processing unit (CPU), a micro processing unit, an ASIC, or one or more integrated circuits for controlling program execution of the present disclosure scheme.

[0164] The communication bus 202 can include a channel for transmitting information between the above-mentioned components.

[0165] The communication interface 204 uses any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc.

[0166] The memory 203 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory may exist independently and be connected to the processing unit via a bus. The memory may also be integrated with the processing unit.

[0167] The memory 203 stores instructions for executing the present invention, and the processor 201 controls the execution of these instructions. The processor 201 executes the instructions stored in the memory 203 to implement the functions of the method disclosed herein.

[0168] In a specific implementation, as one embodiment, the processor 201 may include one or more CPUs, for example... Figure 10 CPU0 and CPU1 in the CPU.

[0169] In a specific implementation, as one example, the training device 20 for the image classification model may include multiple processors, such as... Figure 10 Processors 201 and 207 are described herein. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor here may refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0170] In a specific implementation, as an embodiment, the training apparatus 20 of the image classification model can further include an output device 205 and an input device 206. The output device 205 is in communication with the processor 201 and can display information in a variety of ways. For example, the output device 205 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector, etc. The input device 206 is in communication with the processor 201 and can accept user input in a variety of ways. For example, the input device 206 can be a mouse, a keyboard, a touch screen device, or a sensor device, etc.

[0171] Those skilled in the art can understand that Figure 10 The structure shown in the figure does not constitute a limitation on the training apparatus 20 of the image classification model, and can include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0172] In addition, the present disclosure also provides a computer readable storage medium comprising instructions which, when executed by an electronic device, cause the electronic device to perform the training method of the image classification model provided by the above embodiments.

[0173] In addition, the present disclosure also provides a computer program product comprising instructions which, when executed by an electronic device, cause the electronic device to perform the training method of the image classification model provided by the above embodiments.

[0174] Other embodiments of the present disclosure will be apparent to those skilled in the art upon consideration of the specification and practice of the present disclosure. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure following the general principles thereof and including such departures from the present disclosure that come within known, accepted, or customary practice in the art to which the present disclosure pertains. The specification and examples are to be regarded as illustrative only, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A method for training an image classification model, the method comprising: The method comprises: obtaining a plurality of to-be-identified pictures; inputting the plurality of to-be-identified pictures into an initial image classification model respectively to obtain a classification result corresponding to each of the plurality of to-be-identified pictures; based on the classification result, obtaining classification discrimination information of each of the plurality of to-be-identified pictures, wherein the classification discrimination information of each to-be-identified picture is used to represent whether the classification result corresponding to the to-be-identified picture is correct; the classification discrimination information of each to-be-identified picture is determined according to an initial feature of the to-be-identified picture and an initial feature of a target picture, wherein the real result of the target picture is the same as the classification result corresponding to the to-be-identified picture; based on the classification discrimination information of at least two to-be-identified pictures with the same classification result and the initial feature of each of the at least two to-be-identified pictures, determining a target loss, wherein the initial feature of each of the at least two to-be-identified pictures is obtained by inputting the to-be-identified picture into the initial image classification model and then performing feature recognition; iteratively updating parameters of the initial image classification model based on the target loss to obtain a target image classification model.

2. The method of claim 1, wherein, The classification discrimination information of each to-be-identified picture includes correct classification or incorrect classification, and the obtaining of the classification discrimination information of each of the plurality of to-be-identified pictures based on the classification result comprises: inputting a target picture into the initial image classification model to perform feature recognition and obtain an initial feature of the target picture, wherein the target picture is a picture with a corresponding real result that is the same as a classification result corresponding to a first to-be-identified picture, and the first to-be-identified picture is one of the plurality of to-be-identified pictures; when the similarity between the initial feature of the first to-be-identified picture and the initial feature of the target picture is greater than or equal to a similarity threshold, obtaining first classification discrimination information, wherein the first classification discrimination information is used to represent that the classification discrimination information of the first to-be-identified picture is correct classification.

3. The method of claim 2, wherein, The method further comprises: when the similarity between the initial feature of the first to-be-identified picture and the initial feature of the target picture is less than the similarity threshold, obtaining second classification discrimination information, wherein the second classification discrimination information is used to represent that the classification discrimination information of the first to-be-identified picture is incorrect classification.

4. The method of claim 1, wherein, The method further comprises: obtaining a first loss, wherein the first loss is used to represent the degree of inconsistency between the real result of each of at least one identified picture and the prediction result of the each of the identified picture in the initial image classification model; the determining of the target loss based on the classification discrimination information of at least two to-be-identified pictures with the same classification result and the initial feature of each of the at least two to-be-identified pictures comprises: determining a second loss according to the classification discrimination information of the at least two to-be-identified pictures and the initial feature of each of the at least two to-be-identified pictures; determining a third loss according to the classification discrimination information of the at least two to-be-identified pictures; determining the sum of the first loss, the second loss, and the third loss as the target loss.

5. The method of claim 4, wherein, The determining the second loss according to the classification discrimination information of each of the at least two to-be-identified pictures and the initial feature of each of the at least two to-be-identified pictures comprises: determining a distance function between the initial feature of a first to-be-identified picture and the initial feature of a second to-be-identified picture, the distance function being used to represent a degree of inconsistency between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; when the classification discrimination information of the first to-be-identified picture is the same as the classification discrimination information of the second to-be-identified picture, determining the distance function as the second loss.

6. The method of claim 5, wherein, The method further comprises: when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a difference between a preset constant and the distance function as the second loss. 7.The method of claim 4, wherein, The determining the third loss according to the classification discrimination information of each of the at least two to-be-identified pictures comprises: when the classification discrimination information of a first to-be-identified picture is the same as the classification discrimination information of a second to-be-identified picture, determining a first loss threshold as the third loss, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; when the classification discrimination information of the first to-be-identified picture is different from the classification discrimination information of the second to-be-identified picture, determining a second loss threshold as the third loss, the second loss threshold being greater than the first loss threshold.

8. The method of any one of claims 4-7, wherein, The obtaining the first loss comprises: obtaining the at least one identified picture and a true result of each of the at least one identified picture; inputting a target identified picture into the initial image classification model to determine a target probability, the target probability being a probability that the target identified picture is predicted as a target true result, the target identified picture being one of the at least one identified picture, and the target true result being the true result of the target identified picture; determining a loss corresponding to the target identified picture based on the target probability; determining a sum of the losses corresponding to the at least one identified picture respectively as the first loss, and obtaining the first loss.

9. A training device for an image classification model, characterized in that, comprise: an obtaining module, a processing module, and a determining module; the obtaining module is configured to obtain a plurality of to-be-identified pictures; the processing module is configured to input the plurality of to-be-identified pictures into an initial image classification model respectively to obtain classification results corresponding to the plurality of to-be-identified pictures respectively; and The acquisition module is further configured to acquire classification discrimination information of each of the plurality of to-be-identified pictures based on the classification result, where the classification discrimination information of each to-be-identified picture is used to represent whether the classification result corresponding to the to-be-identified picture is correct, and the classification discrimination information of each to-be-identified picture is determined according to the initial feature of the to-be-identified picture and an initial feature of a target picture, where the target picture has the same classification result as the to-be-identified picture. The determination module is further configured to determine a target loss based on the classification discrimination information of at least two to-be-identified pictures having the same classification result and the initial feature of each of the at least two to-be-identified pictures. The processing module is further configured to iteratively update the parameters of the initial image classification model based on the target loss to obtain a target image classification model.

10. The image classification model training apparatus according to claim 9, characterized in that, The classification discrimination information of each to-be-identified picture includes correct classification or incorrect classification. The processing module is specifically configured to input a target picture into the initial image classification model to perform feature recognition and obtain an initial feature of the target picture, where the target picture is a picture having the same classification result as a first to-be-identified picture, and the first to-be-identified picture is one of the plurality of to-be-identified pictures. The determination module is further configured to acquire first classification discrimination information when the similarity between the initial feature of the first to-be-identified picture and the initial feature of the target picture is greater than or equal to a similarity threshold, where the first classification discrimination information is used to represent that the classification discrimination information of the first to-be-identified picture is correct classification.

11. The training apparatus of the image classification model according to claim 10, wherein The determination module is further configured to acquire second classification discrimination information when the similarity between the initial feature of the first to-be-identified picture and the initial feature of the target picture is less than the similarity threshold, where the second classification discrimination information is used to represent that the classification discrimination information of the first to-be-identified picture is incorrect classification.

12. The training apparatus of the image classification model according to claim 9, wherein The acquisition module is further configured to obtain a first loss, where the first loss is used to represent the degree of inconsistency between the real result of each of the at least one identified picture and the prediction result of the each of the at least one identified picture in the initial image classification model. The determination module is specifically configured to determine a second loss according to the classification discrimination information of the at least two to-be-identified pictures and the initial feature of each of the at least two to-be-identified pictures. The determination module is further specifically configured to determine a third loss according to the classification discrimination information of the at least two to-be-identified pictures. The determination module is further specifically configured to determine the sum of the first loss, the second loss, and the third loss as the target loss.

13. The image classification model training apparatus of claim 12, wherein the determining module is specifically configured to determine a distance function between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the distance function being used to represent a degree of inconsistency between the initial feature of the first to-be-identified picture and the initial feature of the second to-be-identified picture, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; and the determining module is specifically configured to determine the distance function as the second loss when the classification discriminant information of the first to-be-identified picture is the same as the classification discriminant information of the second to-be-identified picture.

14. The image classification model training apparatus of claim 13, wherein the determining module is specifically configured to determine a difference between a preset constant and the distance function as the second loss when the classification discriminant information of the first to-be-identified picture is different from the classification discriminant information of the second to-be-identified picture.

15. The image classification model training apparatus of claim 12, wherein the determining module is specifically configured to determine a first loss threshold as the third loss when the classification discriminant information of the first to-be-identified picture is the same as the classification discriminant information of the second to-be-identified picture, the first to-be-identified picture being one of the at least two to-be-identified pictures, and the second to-be-identified picture being a picture other than the first to-be-identified picture among the at least two to-be-identified pictures; and the determining module is specifically configured to determine a second loss threshold as the third loss when the classification discriminant information of the first to-be-identified picture is different from the classification discriminant information of the second to-be-identified picture, the second loss threshold being greater than the first loss threshold.

16. The image classification model training apparatus of any one of claims 12-15, wherein the obtaining module is specifically configured to obtain the at least one identified picture and a true result of each identified picture in the at least one identified picture; the determining module is further configured to input a target identified picture into the initial image classification model to determine a target probability, the target probability being a probability that the target identified picture is predicted as a target true result, the target identified picture being one of the at least one identified picture, and the target true result being the true result of the target identified picture; the determining module is further configured to determine a loss corresponding to the target identified picture based on the target probability; the determining module is further configured to determine a sum of the losses corresponding to the at least one identified picture as the first loss; and the obtaining module is specifically configured to obtain the first loss. The electronic device comprises: a processor; a memory configured to store instructions executable by the processor. ​ ​ ​ ​ ​ ​ ​ 17. An electronic device, comprising: ​ ​ ​ The processor is configured to execute the instructions to implement the training method of the image classification model according to any one of claims 1-8.

18. A computer-readable storage medium having stored thereon instructions, the instructions comprising, When the instructions in the computer readable storage medium are executed by the electronic device, the electronic device can execute the training method of the image classification model according to any one of claims 1-8.

19. A computer program product, characterised in that, The computer program product comprises computer instructions which, when run on an electronic device, cause the electronic device to execute the training method of the image classification model according to any one of claims 1-8.

Citation Information

Patent Citations

  • Image classification method and device, electronic equipment and computer readable storage medium

    CN112163110A

  • Image recognition method and device

    CN112766323A