CN-116090578-B - Model training method, image recognition method, device, equipment and storage medium
Abstract
The disclosure relates to a model training method, an image recognition device, a model training device, an image recognition device and a storage medium. The method comprises the steps of extracting historical knowledge from a historical image set through a machine learning model to be trained, spreading the historical knowledge to characteristic average values of various sample images in a first subset of the historical image set, spreading the historical knowledge to characteristic information of various sample images in a second subset of the historical image set, training the machine learning model according to similarity between the characteristic information updated by various sample images in the second subset and the characteristic average values updated by various sample images in the first subset, and enabling the machine learning model after training to spread the historical knowledge to the new type image, so that the characteristic information of the new type image is enhanced or supplemented, and the recognition accuracy of the new type image can be improved according to the characteristic information enhanced or supplemented by the new type image.
Inventors
- WANG YE
- MAO CHAOJIE
- Jiang Zi Yin
Assignees
- 阿里巴巴(中国)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20221202
Claims (12)
- 1. A model training method, wherein the method comprises: extracting historical knowledge from a historical image set through a machine learning model to be trained, wherein the historical image set comprises a plurality of historical images under each historical category in a plurality of historical categories, and the historical knowledge is used for representing image feature average values of the plurality of historical images under each historical category; Calculating the characteristic mean value of each sample image in a first subset of the historical image set and the characteristic information of each sample image in a second subset of the historical image set through the machine learning model to be trained; Spreading the historical knowledge to the characteristic average value of each sample image in the first subset to obtain the characteristic average value after each sample image in the first subset is updated, and spreading the historical knowledge to the characteristic information of each sample image in the second subset to obtain the characteristic information after each sample image in the second subset is updated; And training the machine learning model according to the similarity between the characteristic information updated by each sample image in the second subset and the characteristic average value updated by each sample image in the first subset.
- 2. The method of claim 1, wherein the extracting historical knowledge from the set of historical images by the machine learning model to be trained comprises: And calculating image feature mean values of a plurality of historical images under each historical category by the machine learning model to be trained according to each historical category in the plurality of historical categories to obtain a first feature mean value corresponding to each historical category.
- 3. The method of claim 2, wherein computing feature averages for the various sample images within the first subset of the set of historical images comprises: calculating image feature mean values of a plurality of sample images under each image category in the first subset to obtain second feature mean values corresponding to each image category in the first subset; calculating characteristic information of each sample image in the second subset of the historical image set, including: image features of each sample image in the second subset are calculated.
- 4. A method according to claim 3, wherein propagating the historical knowledge onto feature averages of the sample images of the types in the first subset to obtain updated feature averages of the sample images of the types in the first subset comprises: updating the second characteristic mean value corresponding to each image category in the first subset according to the first characteristic mean value corresponding to each history category, and obtaining an updated second characteristic mean value corresponding to each image category in the first subset; the historical knowledge is transmitted to the characteristic information of each sample image in the second subset to obtain the characteristic information updated by each sample image in the second subset, and the method comprises the following steps: and updating the image characteristics of each sample image in the second subset according to the first characteristic mean value corresponding to each history category to obtain the updated image characteristics of each sample image in the second subset.
- 5. The method of claim 1, wherein the first subset comprises the same image class as the second subset, and the first subset comprises a different sample image than the second subset.
- 6. The method of claim 1, wherein training the machine learning model based on similarity between the updated feature information for each sample image in the second subset and the updated feature mean for each sample image in the first subset comprises: And training the machine learning model according to the similarity between the updated second characteristic mean value corresponding to each image category in the first subset and the updated image characteristic of each sample image in the second subset and the actual category of each sample image in the second subset.
- 7. The method of claim 4, wherein updating the second feature mean value corresponding to each image category in the first subset according to the first feature mean value corresponding to each history category to obtain the updated second feature mean value corresponding to each image category in the first subset, comprises: weighting the first characteristic mean value corresponding to each history category according to the similarity between the second characteristic mean value corresponding to any image category in the first subset and the first characteristic mean value corresponding to each history category, so as to obtain a first weighted result; and adding the first weighted result and the second characteristic mean value corresponding to any image category to obtain an updated second characteristic mean value corresponding to any image category.
- 8. The method of claim 4, wherein updating the image feature of each sample image in the second subset according to the first feature mean value corresponding to each history category to obtain the updated image feature of each sample image in the second subset, comprises: Weighting the first characteristic mean value corresponding to each history category according to the similarity between the image characteristic of any sample image in the second subset and the first characteristic mean value corresponding to each history category, so as to obtain a second weighted result; And adding the second weighted result and the image characteristics of any sample image to obtain the updated image characteristics of any sample image.
- 9. A knowledge-based method of small sample class delta image recognition, wherein the method comprises: Acquiring historical knowledge in a historical image set, wherein the historical image set comprises a plurality of historical images under each of a plurality of historical categories, and the historical knowledge is used for representing image feature average values of the plurality of historical images under each historical category; Calculating the feature mean value of various sample images in the training set and calculating the target image features of the images to be identified in the testing set; Spreading the historical knowledge to the feature average value of each sample image in the training set to obtain the feature average value after each sample image in the training set is updated, and spreading the historical knowledge to the target image feature of the image to be identified to obtain the target image feature after the image to be identified is updated; And determining the target category corresponding to the content in the image to be identified according to the similarity between the target image characteristics updated by the image to be identified and the characteristic average values updated by various sample images in the training set.
- 10. An image recognition method, wherein the method comprises: acquiring a first characteristic mean value corresponding to each history category in a plurality of history categories, wherein the first characteristic mean value corresponding to each history category is an image characteristic mean value of a plurality of history images in each history category; Calculating target image characteristics of images to be identified in a test set through a machine learning model which is completed through training, and calculating image characteristic average values of a plurality of sample images under each image category in the training set to obtain a third characteristic average value corresponding to each image category in the training set, wherein the machine learning model is obtained through training by adopting the method as set forth in any one of claims 1-8; Updating the target image features according to the first feature mean value corresponding to each history category to obtain updated target image features; updating the third characteristic mean value corresponding to each image category in the training set according to the first characteristic mean value corresponding to each history category to obtain an updated third characteristic mean value corresponding to each image category in the training set; And determining the target category corresponding to the content in the image to be identified according to the updated target image characteristic and the updated third characteristic mean value corresponding to each image category in the training set.
- 11. An electronic device, comprising: a memory; Processor, and A computer program; Wherein the computer program is stored in the memory and configured to be executed by the processor to implement the method of any one of claims 1-10.
- 12. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the method of any of claims 1-10.
Description
Model training method, image recognition method, device, equipment and storage medium Technical Field The disclosure relates to the field of information technology, and in particular relates to a model training method, an image recognition method, a device, equipment and a storage medium. Background Under the support of massive data and strong computing power, machine learning models such as depth models have achieved great success in the field of image recognition. In order to avoid the problem of catastrophic forgetting and the problem of over-fitting after the training of the existing machine learning model is completed, the trained machine learning model is generally frozen, i.e. parameters of the trained machine learning model are fixed. But freezing the trained machine learning model may result in inaccurate image recognition of the new class by the machine learning model. Disclosure of Invention In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a model training method, an image recognition device, an apparatus and a storage medium, so as to improve recognition accuracy of a new class of images. In a first aspect, an embodiment of the present disclosure provides a model training method, including: Extracting historical knowledge from a historical image set through a machine learning model to be trained; Calculating the characteristic mean value of each sample image in a first subset of the historical image set and the characteristic information of each sample image in a second subset of the historical image set through the machine learning model to be trained; Spreading the historical knowledge to the characteristic average value of each sample image in the first subset to obtain the characteristic average value after each sample image in the first subset is updated, and spreading the historical knowledge to the characteristic information of each sample image in the second subset to obtain the characteristic information after each sample image in the second subset is updated; And training the machine learning model according to the similarity between the characteristic information updated by each sample image in the second subset and the characteristic average value updated by each sample image in the first subset. In a second aspect, an embodiment of the present disclosure provides an image recognition method, including: Acquiring a first characteristic mean value corresponding to each history category in a plurality of history categories, wherein the first characteristic mean value corresponding to each history category is an image characteristic mean value of a plurality of history images in the history category; calculating target image characteristics of images to be identified in a test set through a machine learning model which is completed through training, and calculating image characteristic average values of a plurality of sample images under each image category in the training set to obtain a third characteristic average value corresponding to each image category in the training set, wherein the machine learning model is obtained through training by adopting the method according to the first aspect; Updating the target image features according to the first feature mean value corresponding to each history category to obtain updated target image features; updating the third characteristic mean value corresponding to each image category in the training set according to the first characteristic mean value corresponding to each history category to obtain an updated third characteristic mean value corresponding to each image category in the training set; And determining the target category corresponding to the content in the image to be identified according to the updated target image characteristic and the updated third characteristic mean value corresponding to each image category in the training set. In a third aspect, an embodiment of the present disclosure provides a knowledge-based method for identifying small sample class delta images, including: Acquiring historical knowledge in a historical image set; Calculating the feature mean value of various sample images in the training set and calculating the target image features of the images to be identified in the testing set; Spreading the historical knowledge to the feature average value of each sample image in the training set to obtain the feature average value after each sample image in the training set is updated, and spreading the historical knowledge to the target image feature of the image to be identified to obtain the target image feature after the image to be identified is updated; And determining the target category corresponding to the content in the image to be identified according to the similarity between the target image characteristics updated by the image to be identified and the characteristic average values updated by various sample im