Training method of image recognition model, image recognition method and device

CN116758374BActive Publication Date: 2026-09-08ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310772152.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-27
Publication Date
2026-09-08
Estimated Expiration
2043-06-27

AI Technical Summary

Benefits of technology

[0057] By utilizing one or more of the methods, apparatuses, devices, and media mentioned above, the representational features of an image can be obtained more accurately, thereby improving the recognition capability of the image recognition model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116758374B_ABST
    Figure CN116758374B_ABST
Patent Text Reader

Abstract

The embodiment of the specification provides a training method of an image recognition model, an image recognition method and device. The image recognition model comprises a first feature extraction network and a classification network. The training method comprises the following steps: inputting a first image sample into the first feature extraction network and a second feature extraction network respectively to obtain a first image feature and a second image feature respectively; the second feature extraction network is a pre-trained reference feature extraction network; determining a feature difference according to the first image feature and the second image feature; inputting the first image feature into the classification network to obtain a classification result, determining a classification loss according to the classification result and a classification label of the first image sample; and updating the image recognition model with the target of the classification loss tending to be smaller and the feature difference tending to be larger.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to one or more embodiments in the field of image recognition, and more particularly to a training method for an image recognition model, an image recognition method, and an apparatus. Background Technology

[0002] With the development of artificial intelligence technology, image recognition through training machine learning models is becoming increasingly widely used. An image recognition model is essentially an image classification model; its task is to accurately assign images to their corresponding categories. However, in some application scenarios, it is desirable to obtain image recognition models with higher recognition performance.

[0003] Therefore, a new training method for image recognition models is needed. Summary of the Invention

[0004] The embodiments in this specification aim to provide a training method for an image recognition model, as well as a corresponding image recognition method and apparatus. This method can extract the representational features of an image more accurately through the image recognition model, thereby improving the recognition ability of the image recognition model and overcoming the shortcomings of the prior art.

[0005] According to the first aspect, a training method for an image recognition model is provided, the image recognition model including a first feature extraction network and a classification network, the method comprising:

[0006] The first image sample is input into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network;

[0007] Based on the first image features and the second image features, determine the feature differences;

[0008] The first image features are input into the classification network to obtain the first classification result. Based on the first classification result and the classification label of the first image sample, the classification loss is determined.

[0009] The image recognition model is updated with the goal of reducing the classification loss and increasing the feature differences.

[0010] In one possible implementation, the first feature extraction network includes N first extraction layers, and the second feature extraction network includes N second extraction layers;

[0011] The first image sample is input into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features, including:

[0012] Based on the N first extraction layers, feature extraction is performed sequentially to obtain N third image features, the last of which is the first image feature; based on the N second extraction layers, feature extraction is performed sequentially to obtain N fourth image features, the last of which is the second image feature;

[0013] Based on the first image features and the second image features, the feature differences are determined, including:

[0014] Based on the N third image features and the N fourth image features, determine the N sub-layer differences;

[0015] The feature differences are determined by combining the differences of the N sub-layers.

[0016] In one possible implementation, determining the feature difference based on the first image feature and the second image feature includes:

[0017] The feature differences are determined at least based on the cosine similarity between the first image features and the second image features.

[0018] In one possible implementation, updating the image recognition model with the goal of reducing the classification loss and increasing the feature differences includes:

[0019] Based on the difference between the classification loss and the feature difference, a comprehensive loss is determined, and the image recognition model is updated with the goal of minimizing the comprehensive loss.

[0020] In one possible implementation, updating the image recognition model with the goal of reducing the classification loss and increasing the feature differences includes:

[0021] The classification network is updated with the goal of minimizing the classification loss; and,

[0022] The first feature extraction network is updated with the goal of reducing the classification loss and increasing the feature differences.

[0023] In one possible implementation, the image recognition model includes a face recognition model.

[0024] According to the second aspect, an image recognition method is provided, comprising:

[0025] The second image sample is input into the image recognition model trained according to the method described in the first aspect;

[0026] The second classification result output by the image recognition model is used as the recognition result corresponding to the second image sample.

[0027] According to a third aspect, an image recognition method is provided, comprising:

[0028] The third image sample is input into the first feature extraction network of the image recognition model trained according to claim 1 to obtain the fifth image feature; the fourth image sample is input into the first feature extraction network of the image recognition model to obtain the sixth image feature;

[0029] Based on the fifth and sixth image features, determine whether the image object corresponding to the third image sample is the same as the image object corresponding to the fourth image sample.

[0030] According to the fourth aspect, a training apparatus for an image recognition model is provided, the image recognition model including a first feature extraction network and a classification network, the apparatus comprising:

[0031] The feature acquisition unit is configured to input the first image sample into the first feature extraction network and the second feature extraction network respectively, and obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network;

[0032] The first loss determination unit is configured to determine the feature difference based on the first image features and the second image features;

[0033] The second loss determination unit is configured to input the first image features into a classification network to obtain a first classification result, and determine a classification loss based on the first classification result and the classification label of the first image sample.

[0034] The update unit is configured to update the image recognition model with the goal of reducing the classification loss and increasing the feature differences.

[0035] In one possible implementation, the first feature extraction network includes N first extraction layers, and the second feature extraction network includes N second extraction layers;

[0036] The feature acquisition unit is further configured as follows:

[0037] Based on the N first extraction layers, feature extraction is performed sequentially to obtain N third image features, the last of which is the first image feature; based on the N second extraction layers, feature extraction is performed sequentially to obtain N fourth image features, the last of which is the second image feature;

[0038] The first loss determination unit is further configured as follows:

[0039] Based on the N third image features and the N fourth image features, determine the N sub-layer differences;

[0040] The feature differences are determined by combining the differences of the N sub-layers.

[0041] In one possible implementation, the first loss determination unit is further configured as follows:

[0042] The feature differences are determined at least based on the cosine similarity between the first image features and the second image features.

[0043] In one possible implementation, the updating unit is further configured as follows:

[0044] Based on the difference between the classification loss and the feature difference, a comprehensive loss is determined, and the image recognition model is updated with the goal of minimizing the comprehensive loss.

[0045] In one possible implementation, the updating unit is further configured as follows:

[0046] The classification network is updated with the goal of minimizing the classification loss; and,

[0047] The first feature extraction network is updated with the goal of reducing the classification loss and increasing the feature differences.

[0048] In one possible implementation, the image recognition model includes a face recognition model.

[0049] According to a fifth aspect, an image recognition device is provided, comprising:

[0050] The input unit is configured to input the second image sample into the image recognition model trained according to the method described in claim 1;

[0051] The recognition unit is configured to use the second classification result output by the image recognition model as the recognition result corresponding to the second image sample.

[0052] According to a sixth aspect, an image recognition device is provided, comprising:

[0053] The feature acquisition unit is configured to input a third image sample into the first feature extraction network of the image recognition model trained according to claim 1 to obtain a fifth image feature; and to input a fourth image sample into the first feature extraction network of the image recognition model to obtain a sixth image feature.

[0054] The determining unit is configured to determine, based on the fifth image feature and the sixth image feature, whether the image object corresponding to the third image sample is the same as the image object corresponding to the third image sample.

[0055] According to a seventh aspect, a computer-readable storage medium is provided, having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method described in claims 1, 2, and 3.

[0056] According to an eighth aspect, a computing device is provided, including a memory and a processor, characterized in that the memory stores executable code, and when the processor executes the executable code, it implements the methods described in the first, second, and third aspects.

[0057] By utilizing one or more of the methods, apparatuses, devices, and media mentioned above, the representational features of an image can be obtained more accurately, thereby improving the recognition capability of the image recognition model. Attached Figure Description

[0058] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0059] Figure 1 A schematic diagram of an image recognition scheme is shown;

[0060] Figure 2 This diagram illustrates how to determine whether an image corresponds to the same object.

[0061] Figure 3 A schematic diagram illustrating a training method for an image recognition model according to an embodiment of this specification is shown.

[0062] Figure 4 A flowchart illustrating a training method for an image recognition model according to an embodiment of this specification is shown.

[0063] Figure 5 A schematic diagram illustrating feature extraction and difference determination according to embodiments of this specification is shown;

[0064] Figure 6 A schematic diagram illustrating a training method for an image recognition model according to another embodiment of this specification is shown.

[0065] Figure 7 A schematic diagram illustrating the superposition of vertical vectors according to an embodiment of this specification is shown;

[0066] Figure 8 A flowchart illustrating an image recognition method according to an embodiment of this specification is shown;

[0067] Figure 9A flowchart of an image recognition method according to another embodiment of this specification is shown;

[0068] Figure 10 A structural diagram of a training apparatus for an image recognition model according to an embodiment of this specification is shown;

[0069] Figure 11 This diagram shows a structural diagram of an image recognition device according to an embodiment of this specification;

[0070] Figure 12 A structural diagram of an image recognition device according to another embodiment of this specification is shown. Detailed Implementation

[0071] The solution provided in this invention will now be described with reference to the accompanying drawings.

[0072] As mentioned earlier, with the development of artificial intelligence technology, image recognition through training machine learning models is becoming increasingly widely used. In some application scenarios, it is desirable to obtain image recognition models with higher recognition performance. An image recognition model is essentially an image classification model; its task is image classification, that is, accurately assigning an image to its corresponding category. Figure 1 A schematic diagram of an image recognition scheme is shown. (For example...) Figure 1 As shown, a typical image classification model can include a feature extraction network and a classification network. The feature extraction network extracts representation features from the image to be tested, while the classification network determines the classification result of the image based on these representation features. To improve the recognition performance of image recognition models, some image recognition schemes improve the calculation method of the training classification loss, obtaining more accurate classification boundaries during model training. This improves the accuracy of the classification result determined based on the representation features of the image to be tested, thereby enhancing the overall recognition performance of the model. In other words, the main technical approach of these schemes is to improve the classification performance of the classification network—that is, the performance of determining the classification result based on the image representation features—to improve the overall recognition performance of the model.

[0073] However, these technical solutions also have the following problems: On the one hand, simply relying on improving the classification performance of the classification network to improve the model's recognition performance cannot fully meet the requirements of model recognition capabilities in some application scenarios. On the other hand, in some application scenarios, specific image recognition tasks can be completed through the feature extraction network in the image recognition model (without using the classification network). For example, in one scenario, the feature extraction network can extract the representation features of two or more images respectively, and then determine whether these images correspond to the same object based on the extracted representation features. Figure 2 This diagram illustrates how to determine whether images correspond to the same object. Figure 2In the example shown, two images of people, such as image sample B and image sample C, whose correspondence with the same person is uncertain, can be input into the feature extraction network of an image recognition model to obtain their representation features—image feature 3 and image feature 4. Then, based on the difference between image feature 3 and image feature 4, it can be determined whether image sample B and image sample C correspond to the same person. This is done because the classification results output by the classification network are usually limited by a pre-defined number of categories and category items. In scenarios where multiple images need to be determined as belonging to the same object, if the determination is based on the classification results, the range of images that can be used for determination is limited by the aforementioned limitations on the number of categories and category items. However, determining based on the image representation features does not restrict the range of images that can be used. For example, in a specific scenario, the classification result output by the classification network might be one of ten thousand pre-defined people. If the object corresponding to the image to be determined is not or is uncertain within these ten thousand people, it is obviously difficult to determine whether these images belong to the same person based on the classification results. Regardless of whether the objects corresponding to these images are among the ten thousand people, it is possible to determine whether these images belong to the same person based on the image representation features (e.g., the cosine similarity of these representation features). In this scenario, simply improving the performance of the classification network will obviously not improve the recognition accuracy of this type of image recognition task.

[0074] To address the aforementioned problems, embodiments of this specification provide a training method for an image recognition model. The core idea of ​​this method is that, during model training, image samples are input into both the feature extraction network in the recognition model and a pre-trained reference feature extraction network to obtain the representation features and reference features of the image samples, thus determining the feature differences between the representation features and the reference features. The classification network in the recognition model obtains a classification result based on the representation features, and determines the classification loss based on the classification result. The parameters of the recognition model are updated with the aim of increasing feature differences and decreasing the classification loss. Specifically, Figure 3 This diagram illustrates the principle of a training method for an image recognition model according to an embodiment of this specification. Figure 3 As shown, an image recognition model can include a feature extraction network and a classification network. For example, image sample A can be input into the feature extraction network and the reference feature extraction network in the recognition model to obtain image feature 1 (the representation feature of image sample A) and image feature 2 (the reference feature of image sample A), respectively. Based on image feature 1 and image feature 2, the feature difference is determined. The classification network in the recognition model obtains the classification result 1 corresponding to image sample A based on image feature 1, and determines the classification loss based on the classification label (classification label 1) of image sample A and classification result 1. Furthermore, the parameters of the recognition model (e.g., the parameters of the feature extraction network) are updated with the aim of increasing the feature difference and decreasing the classification loss.

[0075] This method enables the extracted image features to approach their optimal direction in the feature space during image recognition model training, resulting in more accurate representations of the image to be tested and more precise image recognition. Specifically, through analysis of image features, the inventors discovered that image features (usually in vector form) typically possess an optimal direction in their feature space. The closer the feature direction (i.e., vector direction) of the image features extracted by the feature extraction network is to this optimal direction, the stronger the image feature's representational ability, thus enabling accurate image recognition. However, conventional training methods that update model parameters based on classification loss often result in a discrepancy between the extracted image feature direction and this optimal direction due to factors such as network overfitting. If the image features can be continuously guided towards this optimal direction in the feature space during model training, more accurate image representations can be extracted. This method, which updates the recognition model parameters with the aim of increasing feature differences and decreasing classification loss, essentially guides the extracted image features towards their optimal direction in the feature space. Therefore, the image recognition model trained by this method can extract image features with stronger representation capabilities for the image under test, and then perform more accurate image recognition based on the image features.

[0076] The specific process of this method will be further explained below.

[0077] Figure 4 This diagram illustrates a training method for an image recognition model according to an embodiment of this specification. The image recognition model includes a first feature extraction network and a classification network. Figure 4 As shown, the method includes at least the following steps:

[0078] Step S41: Input the first image sample into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network;

[0079] Step S43: Determine the feature differences based on the first image features and the second image features;

[0080] Step S45: Input the first image features into the classification network to obtain the first classification result, and determine the classification loss based on the first classification result and the classification label of the first image sample;

[0081] Step S47: Update the image recognition model with the goal of reducing the classification loss and increasing the feature difference.

[0082] First, in step S41, the first image sample is input into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features respectively. The second feature extraction network is a pre-trained reference feature extraction network.

[0083] The second feature extraction network is a pre-trained reference feature extraction network whose parameters are not updated during model training. The specific method for pre-training the reference feature extraction network can vary in different embodiments, and this specification does not limit this. For example, in one embodiment, the reference feature extraction network can be pre-trained using the BP (Back Propagation) method. In different embodiments, the network types on which the first / second feature extraction networks are based can be different, such as Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM) networks, Transformer (TF) neural networks, and fully connected neural networks. In one embodiment, the network structures of the first and second feature extraction networks can be the same. In different embodiments, the image recognition model can be different specific types of image recognition models. In one embodiment, the image recognition model can include a face recognition model.

[0084] In this step, the first image samples (model training samples) are input into the first feature extraction network and the second feature extraction network, respectively. These first image samples serve as training samples for the image recognition model. In different embodiments, different specific methods can be used to obtain the training samples for the image recognition model. This specification focuses on the training process of the image recognition model after obtaining the training samples, and does not limit the specific methods used to obtain these training samples.

[0085] A first image feature (representation feature) corresponding to a first image sample can be obtained through a first feature extraction network, and a second image feature (reference feature) of the first image sample can be obtained through a second feature extraction network. In different embodiments, the neural network used for feature extraction may include one or more feature extraction layers. In one embodiment, the first feature extraction network and the second feature extraction network may each include one or more feature extraction layers sequentially. In a specific embodiment, the first feature extraction network may include N first extraction layers, and the second feature extraction network may include N second extraction layers. Thus, feature extraction can be performed sequentially based on the N first extraction layers to obtain N third image features, and the last of these can be used as the first image feature; feature extraction can be performed sequentially based on the N second extraction layers to obtain N fourth image features, and the last of these can be used as the second image feature. Figure 5 A schematic diagram illustrating feature extraction and difference determination according to embodiments of this specification is shown. Figure 5 As shown, for example, image sample A can be input into the feature extraction network and the reference feature extraction network respectively to obtain image feature 1 and image feature 2 (as reference features).

[0086] In step S43, feature differences are determined based on the first image features and the second image features.

[0087] In this step, feature differences can be determined based on the first and second image features obtained in step S41. In different embodiments, the specific methods for determining feature differences can differ. In one embodiment, the feature differences can be determined at least based on the cosine similarity between the first and second image features. In embodiments where the first and second feature extraction networks each include multiple feature extraction layers, feature differences can be determined based on the last of the N third image features (i.e., the first image feature) and the last of the N fourth image features (i.e., the second image feature). For example... Figure 5 As shown, feature differences can be determined based on the image features (feature 1n) extracted by the last feature extraction layer in the feature extraction network and the image features (feature 1n) extracted by the last feature extraction layer in the reference feature extraction network. In another embodiment, N sub-layer differences can also be determined based on the N third image features and the N fourth image features; the feature differences are then determined by combining the N sub-layer differences. For example... Figure 5As shown, image features can be extracted through multiple feature extraction layers in the feature extraction network, such as feature 11, feature 12... feature 1n. Similarly, image features can be extracted through multiple feature extraction layers in the feature extraction network, such as feature 11, feature 22... feature 2n. Sub-layer difference 1 is determined based on feature 11 and feature 21, sub-layer difference 12 is determined based on feature 11 and feature 21, and so on, based on feature 1n and feature 2n. The feature difference is then determined by combining sub-layer difference 1, sub-layer difference 2... sub-layer difference 2. The method of combining sub-layer differences may vary in different specific examples, and this specification does not impose any limitations on this.

[0088] In step S45, the first image features are input into the classification network to obtain the first classification result. Based on the first classification result and the classification label of the first image sample, the classification loss is determined.

[0089] This step involves using the classification network to determine the classification result (first classification process) of the first image sample based on the first image features, and then determining the classification loss based on this classification result and the classification label of the first image sample. Different types of classification networks can be used in different embodiments, and this specification does not limit this. The specific method for determining the classification loss can also differ in different embodiments. In one embodiment, for example, the classification loss can be determined based on the difference between the value of the classification label and the value of the classification result.

[0090] In step S47, the image recognition model is updated with the goal of reducing the classification loss and increasing the feature difference.

[0091] After determining the classification loss and feature differences, the parameters of the image recognition model can be updated with the goal of reducing the classification loss and increasing the feature differences. As mentioned earlier, updating the parameters of the recognition model with the aim of increasing feature differences and reducing classification loss can produce the effect that the image features extracted by the feature extraction network during training continuously approach the optimal direction in the feature space. Figure 7 A schematic diagram illustrating the superposition of vertical vectors according to an embodiment of this specification is shown. For example... Figure 7 As shown, for example, vector a represents the image features that can be extracted according to the conventional recognition model training method (without a reference feature network). The direction of vector d is the optimal direction. To obtain a representation vector that is closer to vector d than vector a, we can, for example, introduce vector a... ⊥ , such that vector a ⊥ The direction is perpendicular to vector a and faces the direction where d is located, and a and a' are... ⊥ Synthesize a new vector a new So, this a newIt can get closer to the optimal direction (the direction of vector d), that is, through vector a ⊥ The introduction of this vector yields a better image representation vector. Updating the parameters of the recognition model with the aim of increasing feature differences and reducing classification loss essentially involves superimposing vector a onto the extracted vector a. ⊥ , thus obtaining vector a new Alternatively, by training an image recognition model using this method, since the training objective not only aims to reduce the classification loss but also limits the correlation between the image features extracted by the model and those extracted by the pre-trained network, the image features extracted by the model can be made to approach the optimal direction of features, thereby improving the accuracy of the recognition model and alleviating the problem of network overfitting.

[0092] In different embodiments, different specific methods can be used to make the classification loss tend to decrease and the feature differences tend to increase. In one embodiment, the comprehensive loss can be determined based on the difference between the classification loss and the feature differences, and the image recognition model can be updated with the goal of minimizing the comprehensive loss. Figure 7 A schematic diagram illustrates a training method for an image recognition model according to another embodiment of this specification. In such... Figure 7 In the illustrated embodiment, the classification network can also be updated with the goal of reducing the classification loss. Furthermore, the first feature extraction network can be updated with the goals of reducing the classification loss and increasing the feature differences.

[0093] According to an embodiment in another part of this specification, an image recognition method is also provided. Figure 8 A flowchart illustrating an image recognition method according to an embodiment of this specification is shown. Figure 7 As shown, the method includes at least the following steps:

[0094] Step S81: Input the second image sample into the image recognition model trained according to the above method;

[0095] Step S83: Use the second classification result output by the image recognition model as the recognition result corresponding to the second image sample.

[0096] The second image sample can be the image to be tested. In this embodiment, the image to be tested can be input into the first feature extraction network in the trained image recognition model to obtain the classification result (second classification result) of the classification network for the image to be tested, that is, the recognition result for the image to be tested.

[0097] According to an embodiment in another part of this specification, an image recognition method is also provided. Figure 9 A flowchart illustrating an image recognition method according to another embodiment of this specification is shown. Figure 9As shown, the method includes at least the following steps:

[0098] Step S91: Input the third image sample into the first feature extraction network of the image recognition model trained according to the above method to obtain the fifth image feature; input the fourth image sample into the first feature extraction network of the image recognition model to obtain the sixth image feature;

[0099] Step S93: Based on the fifth image feature and the sixth image feature, determine whether the image object corresponding to the third image sample is the same as the image object corresponding to the third image sample.

[0100] In this embodiment, the third and fourth image samples are samples to be determined. In this embodiment, the third and fourth image samples can be input into the first feature extraction network of the trained image recognition model, and the representation features (fifth and sixth image features) of the third and fourth image samples output by the first feature extraction network can be obtained. Based on the fifth and sixth image features, it can be determined whether the third and fourth image samples correspond to the same object. In different embodiments, the specific object types corresponding to the third and fourth image samples may be different, and this specification does not limit this. In one example, the third and fourth image samples may be, for example, face images, so that it can be determined whether the third and fourth image samples are images of the same person based on the fifth and sixth image features.

[0101] According to yet another embodiment, a training apparatus for an image recognition model is also provided. Figure 10 This diagram illustrates a structural arrangement of a training apparatus for an image recognition model according to an embodiment of this specification. The generative model includes a first feature extraction network and a classification network, such as... Figure 10 As shown, the device 1000 includes:

[0102] The feature acquisition unit 1001 is configured to input the first image sample into the first feature extraction network and the second feature extraction network respectively, and obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network;

[0103] The first loss determination unit 1002 is configured to determine feature differences based on the first image features and the second image features;

[0104] The second loss determination unit 1003 is configured to input the first image features into a classification network to obtain a first classification result, and determine a classification loss based on the first classification result and the classification label of the first image sample.

[0105] The update unit 1004 is configured to update the image recognition model with the goal of reducing the classification loss and increasing the feature difference.

[0106] In one embodiment, the first feature extraction network may include N first extraction layers, and the second feature extraction network may include N second extraction layers; the feature acquisition unit may be further configured to: sequentially extract features based on the N first extraction layers to obtain N third image features, the last of which is the first image feature; and sequentially extract features based on the N second extraction layers to obtain N fourth image features, the last of which is the second image feature;

[0107] The first loss determination unit is further configured to: determine N sub-layer differences based on the N third image features and the N fourth image features; and determine the feature differences by combining the N sub-layer differences.

[0108] In one embodiment, the first loss determination unit can be further configured as follows:

[0109] The feature differences are determined at least based on the cosine similarity between the first image features and the second image features.

[0110] In one embodiment, the update unit can be further configured as follows:

[0111] Based on the difference between the classification loss and the feature difference, a comprehensive loss is determined, and the image recognition model is updated with the goal of minimizing the comprehensive loss.

[0112] In one embodiment, the update unit can be further configured as follows:

[0113] The classification network is updated with the goal of minimizing the classification loss; and,

[0114] The first feature extraction network is updated with the goal of reducing the classification loss and increasing the feature differences.

[0115] In one embodiment, the image recognition model may include a face recognition model.

[0116] According to another embodiment, an image recognition device is also provided. Figure 11 A structural diagram of an image recognition device according to an embodiment of this specification is shown. Figure 11 As shown, the device 1100 includes:

[0117] Input unit 1101 is configured to input the second image sample into the image recognition model trained according to the method described in claim 1;

[0118] The recognition unit 1102 is configured to use the second classification result output by the image recognition model as the recognition result corresponding to the second image sample.

[0119] According to yet another embodiment, an image recognition device is also provided. Figure 12 A structural diagram of an image recognition device according to another embodiment of this specification is shown. Figure 12 As shown, the device 1200 includes:

[0120] The feature acquisition unit 1201 is configured to input a third image sample into the first feature extraction network of the image recognition model trained according to claim 1 to obtain a fifth image feature; and to input a fourth image sample into the first feature extraction network of the image recognition model to obtain a sixth image feature.

[0121] The determining unit, configured as 1202, determines whether the image object corresponding to the third image sample is the same as the image object corresponding to the third image sample, based on the fifth image feature and the sixth image feature.

[0122] Another aspect of this specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform any of the methods described above.

[0123] This specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements any of the methods described above.

[0124] It should be understood that the descriptions such as "first" and "second" in this article are merely for the sake of simplicity in description and to distinguish similar concepts, and do not have any other limiting function.

[0125] Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.

[0126] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. A training method for an image recognition model, the image recognition model comprising a first feature extraction network and a classification network, the method comprising: The first image sample is input into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network; Based on the first image features and the second image features, determine the feature differences; The first image features are input into the classification network to obtain the first classification result. Based on the first classification result and the classification label of the first image sample, the classification loss is determined. Based on the difference between the classification loss and the feature difference, a comprehensive loss is determined, and the first feature extraction network is updated with the goal of reducing the comprehensive loss.

2. The method according to claim 1, wherein, The first feature extraction network includes N first extraction layers, and the second feature extraction network includes N second extraction layers; The first image sample is input into the first feature extraction network and the second feature extraction network respectively to obtain the first image features and the second image features, including: Based on the N first extraction layers, feature extraction is performed sequentially to obtain N third image features, the last of which is the first image feature; based on the N second extraction layers, feature extraction is performed sequentially to obtain N fourth image features, the last of which is the second image feature.

3. The method according to claim 1, wherein, Based on the first image features and the second image features, the feature differences are determined, including: The feature differences are determined at least based on the cosine similarity between the first image features and the second image features.

4. The method according to claim 1, wherein, Also includes: The classification network is updated with the goal of minimizing the classification loss.

5. The method according to claim 1, wherein, The image recognition model includes a face recognition model.

6. An image recognition method, comprising: Input the second image sample into the image recognition model trained according to claim 1; The second classification result output by the image recognition model is used as the recognition result corresponding to the second image sample.

7. An image recognition method, comprising: The third image sample is input into the first feature extraction network of the image recognition model trained according to claim 1 to obtain the fifth image feature; The fourth image sample is input into the first feature extraction network in the image recognition model to obtain the sixth image feature; Based on the fifth and sixth image features, determine whether the image object corresponding to the third image sample is the same as the image object corresponding to the fourth image sample.

8. A training apparatus for an image recognition model, the image recognition model comprising a first feature extraction network and a classification network, the apparatus comprising: The feature acquisition unit is configured to input the first image sample into the first feature extraction network and the second feature extraction network respectively, and obtain the first image features and the second image features respectively; wherein, the second feature extraction network is a pre-trained reference feature extraction network; The first loss determination unit is configured to determine the feature difference based on the first image features and the second image features; The second loss determination unit is configured to input the first image features into a classification network to obtain a first classification result, and determine a classification loss based on the first classification result and the classification label of the first image sample. The update unit is configured to determine a comprehensive loss based on the difference between the classification loss and the feature difference, and update the first feature extraction network with the goal of reducing the comprehensive loss.

9. The apparatus according to claim 8, wherein, The first feature extraction network includes N first extraction layers, and the second feature extraction network includes N second extraction layers; The feature acquisition unit is further configured as follows: Based on the N first extraction layers, feature extraction is performed sequentially to obtain N third image features, the last of which is the first image feature; based on the N second extraction layers, feature extraction is performed sequentially to obtain N fourth image features, the last of which is the second image feature.

10. The apparatus according to claim 8, wherein, The first loss determination unit is further configured as follows: The feature differences are determined at least based on the cosine similarity between the first image features and the second image features.

11. The apparatus according to claim 8, wherein, The update unit is further configured as follows: The classification network is updated with the goal of minimizing the classification loss.

12. The apparatus according to claim 8, wherein, The image recognition model includes a face recognition model.

13. An image recognition device, comprising: The input unit is configured to input the second image sample. The image recognition model trained according to the method described in claim 1; The recognition unit is configured to use the second classification result output by the image recognition model as the recognition result corresponding to the second image sample.

14. An image recognition device, comprising: The feature acquisition unit is configured to input the third image sample. According to claim 1, the first feature extraction network in the image recognition model trained by the method is used to obtain the fifth image feature; the fourth image sample is input into the first feature extraction network in the image recognition model to obtain the sixth image feature; The determining unit is configured to determine, based on the fifth image feature and the sixth image feature, whether the image object corresponding to the third image sample is the same as the image object corresponding to the fourth image sample.

15. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-7.

16. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Image classification method and device and computer readable storage medium

    CN109753978A

  • A face recognition method and device based on deep learning

    CN109815801A