A method and apparatus for obtaining a recognition model, and an electronic device

By adjusting the parameters of the cluster center and feature extraction module, face images with similarity that meet the threshold are selected, which solves the problem of insufficient accuracy of existing recognition models in face image recognition and achieves higher quality image feature extraction and recognition.

CN115909442BActive Publication Date: 2026-02-27LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211398827.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-09
Publication Date
2026-02-27
Estimated Expiration
2042-11-09

AI Technical Summary

Technical Problem

Existing recognition models have shortcomings in optimization and are difficult to accurately distinguish and recognize face images.

Method used

By adjusting the parameters of the cluster centers and feature extraction modules, face images that meet the threshold similarity with the adjusted cluster centers are selected for use. Image features are then extracted based on the adjusted feature extraction module, and the parameters of the recognition model are adjusted to improve recognition accuracy.

Benefits of technology

It improves the recognition model's accuracy in recognizing face images, reduces the impact of noisy images, ensures more accurate extracted image features, and enhances the recognition model's recognition capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115909442B_ABST
    Figure CN115909442B_ABST
Patent Text Reader

Abstract

The application provides an obtaining method and device of a recognition model and an electronic device. The method comprises: adjusting a current cluster center corresponding to each object to obtain an adjusted cluster center corresponding to each object; adjusting parameters of a feature extraction module in an initial recognition model based on at least one first face image of at least one object and the adjusted cluster center corresponding to the at least one object in each object; screening at least one second face image to be used from at least one second face image of the at least one object based on the feature extraction module with adjusted parameters, the at least one second face image to be used meeting a similarity threshold with the adjusted cluster center corresponding to the object; extracting image features of the at least one second face image to be used based on the feature extraction module with adjusted parameters; obtaining new cluster centers of the at least one object based on the image features, and adjusting parameters of the initial recognition model, so as to perform image recognition through the initial recognition model with adjusted parameters.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a method and device for obtaining a recognition model and an electronic device. BACKGROUND

[0002] At present, the recognition model related to face recognition has been widely applied, however, how to optimize the recognition model becomes a problem. SUMMARY

[0003] The present application provides the following technical solutions:

[0004] In one aspect, the present application provides a method for obtaining a recognition model, comprising:

[0005] Adjusting the current cluster center corresponding to each object to obtain an adjusted cluster center corresponding to each object, wherein the difference between the adjusted cluster centers corresponding to each of two objects satisfies a set threshold, and the current cluster center can represent the identity of the object;

[0006] Adjusting the parameters of a feature extraction module in an initial recognition model based on at least one first face image of at least one object and the adjusted cluster center corresponding to the at least one object;

[0007] Based on the feature extraction module with adjusted parameters, screening at least one second face image to be used from at least one second face image of at least one object, wherein the similarity between the adjusted cluster center corresponding to the object satisfies a similarity threshold; wherein the first face image and the second face image are the same or different;

[0008] Extracting image features of the at least one second face image to be used based on the feature extraction module with adjusted parameters;

[0009] Obtaining new cluster centers of at least one object based on the image features, and adjusting the parameters of the initial recognition model to perform image recognition through the initial recognition model with adjusted parameters.

[0010] The method further comprises:

[0011] If the difference between the new cluster centers of each of two objects in the new cluster centers of at least one object does not satisfy the set threshold, returning to execute the adjusting of the current cluster center corresponding to each object to obtain the adjusted cluster center corresponding to each object.

[0012] The difference between the new cluster centers of each of two objects in the new cluster centers of at least one object does not satisfy the set threshold, comprising:

[0013] determine a first loss function value between each two of the new cluster centers of the at least one object based on the first set similarity threshold and the similarity between each two of the new cluster centers of the at least one object, wherein the first loss function value represents a degree of inconsistency between the similarity between each two of the new cluster centers of the at least one object and the first set similarity threshold.

[0014] wherein the first loss function value represents a degree of inconsistency between the similarity between each two of the new cluster centers of the at least one object and the first set similarity threshold.

[0015] adjust the current cluster center corresponding to each object to obtain an adjusted cluster center corresponding to each object, including:

[0016] determine the similarity between each two of the current cluster centers corresponding to the objects;

[0017] adjust the current cluster center corresponding to each object based on the first set similarity threshold and the similarity between each two of the current cluster centers corresponding to the objects to obtain an adjusted cluster center corresponding to each object.

[0018] the adjusting the current cluster center corresponding to each object based on the first set similarity threshold and the similarity between each two of the current cluster centers corresponding to the objects, including:

[0019] determine a second loss function value between each two of the current cluster centers corresponding to the objects based on the first set similarity threshold and the similarity between each two of the current cluster centers corresponding to the objects, wherein the second loss function value represents a degree of inconsistency between the similarity between each two of the current cluster centers corresponding to the objects and the first set similarity threshold.

[0020] if the second loss function value does not converge, adjust the current cluster center corresponding to each object.

[0021] adjust parameters of a feature extraction module in an initial recognition model based on at least one first face image of the at least one object and the adjusted cluster center corresponding to at least one object of the objects, including:

[0022] extract image features of the at least one first face image of the at least one object based on the feature extraction module in the initial recognition model;

[0023] determine a first similarity between the image features of the at least one first face image and the adjusted cluster center corresponding to at least one object of the objects, and adjust the parameters of the feature extraction module based on the first similarity.

[0024] screening, from at least one second face image of at least one object, at least one second face image to be used which satisfies a similarity threshold between the image feature of the second face image and the adjusted cluster center corresponding to the object, comprising:

[0025] extracting, by the feature extraction module after adjusting the parameters, the image feature of at least one second face image of at least one object;

[0026] screening, from at least one second face image of at least one object, at least one second face image to be used which satisfies a similarity threshold between the image feature of the second face image and the adjusted cluster center corresponding to the object.

[0027] obtaining a new cluster center of at least one object based on the image feature, and adjusting the parameters of the initial recognition model, comprising:

[0028] determining a second similarity between the image feature and the newly determined cluster center of at least one object;

[0029] determining a second set similarity threshold between the image feature and the newly determined cluster center of at least one object;

[0030] determining a third loss function value between the second similarity and the second set similarity threshold;

[0031] if the third loss function value does not converge, adjusting the newly determined cluster center of at least one object and the parameters of the initial recognition model, and returning to execute the step of extracting the image feature of the at least one second face image to be used by the feature extraction module after adjusting the parameters;

[0032] if the third loss function value converges, ending the adjustment, and obtaining a new cluster center of at least one object and an initial recognition model after adjusting the parameters.

[0033] Another aspect of the present application provides a device for obtaining a recognition model, comprising:

[0034] a first adjustment module for adjusting a current cluster center corresponding to each object to obtain an adjusted cluster center corresponding to each object, wherein the difference between the adjusted cluster centers corresponding to each of the two objects satisfies a set threshold, and the current cluster center can represent the identity of the object;

[0035] a second adjustment module for adjusting the parameters of a feature extraction module in an initial recognition model based on at least one first face image of at least one object and the adjusted cluster center corresponding to at least one object in each object;

[0036] a screening module configured to screen, based on the adjusted feature extraction module, at least one second face image of the at least one object from the at least one second face image of the at least one object to obtain at least one to-be-used second face image corresponding to the object and satisfying a similarity threshold between the adjusted cluster center corresponding to the object;

[0037] a feature extraction module configured to extract an image feature of the at least one to-be-used second face image based on the adjusted feature extraction module;

[0038] a third adjusting module configured to obtain a new cluster center of the at least one object based on the image feature, and adjust the parameters of the initial recognition model to perform image recognition by using the initial recognition model with the adjusted parameters.

[0039] The third aspect of the present application provides an electronic device, comprising:

[0040] a memory and a processor;

[0041] the memory is configured to store at least a set of instructions;

[0042] the processor is configured to call and execute the set of instructions in the memory, and execute the obtaining method of the recognition model according to any one of the above aspects by executing the set of instructions.

[0043] In the present application, the current cluster center corresponding to each object is adjusted to obtain an adjusted cluster center corresponding to each object, the parameters of the feature extraction module in the initial recognition model are adjusted based on at least one first face image of at least one object and the adjusted cluster center corresponding to the object, so that the feature extraction module can more accurately extract image features, and based on the adjusted feature extraction module, at least one to-be-used second face image corresponding to the object and satisfying a similarity threshold between the adjusted cluster center corresponding to the object is screened from at least one second face image of at least one object, to obtain a higher quality face image, and then based on the adjusted feature extraction module, an image feature of the at least one to-be-used second face image is extracted, to ensure that the extracted image feature is more accurate, a new cluster center of the at least one object is obtained based on the image feature, and the parameters of the initial recognition model are adjusted, to ensure that the adjusted initial recognition model can more accurately perform recognition. BRIEF DESCRIPTION OF DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0045] Figure 1 is a flowchart of a method for obtaining an identification model according to a first embodiment of the present application;

[0046] Figure 2 is a flowchart of a method for obtaining an identification model according to a second embodiment of the present application;

[0047] Figure 3 is a schematic diagram of a distribution scenario of clustering centers in space according to the present application;

[0048] Figure 4 is a flowchart of a method for obtaining an identification model according to a third embodiment of the present application;

[0049] Figure 5 is a schematic diagram of an adjustment process of a feature extraction module and clustering centers according to the present application;

[0050] Figure 6 is a flowchart of a method for obtaining an identification model according to a fourth embodiment of the present application;

[0051] Figure 7 is a schematic diagram of an adjustment of an initial identification model according to the present application;

[0052] Figure 8 is a flowchart of a method for obtaining an identification model according to a fifth embodiment of the present application;

[0053] Figure 9 is a schematic diagram of another adjustment of an initial identification model according to the present application;

[0054] Figure 10 is a schematic diagram of an obtaining device of an identification method according to the present application. DETAILED DESCRIPTION

[0055] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without any creative work fall within the scope of protection of the present application.

[0056] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0057] Reference Signs List Figure 1This is a flowchart illustrating a method for obtaining a recognition model according to the first embodiment of this application. This method can be applied to electronic devices. This application does not limit the product type of the electronic device, such as... Figure 1 As shown, the method may include, but is not limited to, the following steps:

[0058] Step S101: Adjust the current cluster center corresponding to each object to obtain the adjusted cluster center corresponding to each object. The difference between the adjusted cluster centers corresponding to any two objects meets the set threshold. The current cluster center can represent the identity of the object.

[0059] In this embodiment, the current cluster center corresponding to each object is obtained based on the image features of the face image of each object, and the current cluster center corresponding to each object can accurately express the image features of the face image of that object.

[0060] If the difference between the adjusted cluster centers of any two objects in the current cluster center of each object does not meet the set threshold, the current cluster center of each object can be adjusted by reducing the similarity between the current cluster centers of any two objects, thus obtaining the adjusted cluster center of each object.

[0061] Specifically, the difference between the adjusted cluster centers corresponding to each pair of objects meets the set threshold, while the difference between the current cluster centers corresponding to each pair of objects does not meet the set threshold. This ensures that the face image of each object can be distinguished more accurately based on the adjusted cluster centers corresponding to each object.

[0062] Step S102: Based on at least one first face image of at least one object and the adjusted cluster center corresponding to at least one object in each object, adjust the parameters of the feature extraction module in the initial recognition model.

[0063] At least one first face image of at least one object refers to at least one first face image of any one or more objects in each object. For example, if there are 100,000 objects, that is, there are 100,000 objects, 51,200 objects are selected from the 100,000 objects, and the identifiers of the 51,200 objects are from 1 to 51,200, and at least one first face image of the 51,200 objects identified as 1 to 51,200 is used.

[0064] The adjusted cluster center corresponding to at least one object in each object can be an adjusted cluster center corresponding to 51200 objects identified as 1 to 51200 in the 10W objects.

[0065] Of course, in the present embodiment, the adjusted cluster center corresponding to at least one object in each object is not limited to the adjusted cluster center corresponding to the object to which at least one first face image of at least one object belongs, and can be an adjusted cluster center corresponding to any multiple objects in each object. For example, it can be an adjusted cluster center corresponding to each object.

[0066] In the present embodiment, the parameters of the feature extraction module can be adjusted by selecting part of the first face images from at least one first face image of at least one object in batches. For example, 512 first face images are selected from at least one first face image of 51200 objects each time, and the selected first face images and the adjusted cluster center corresponding to at least one object in each object are used to adjust the parameters of the feature extraction module in the initial recognition model. The 512 first face images are not limited to belonging to the same object. Of course, one object of 51200 objects can also be selected from at least one first face image of 51200 objects each time, and the selected first face images and the adjusted cluster center corresponding to at least one object in each object are used to adjust the parameters of the feature extraction module in the initial recognition model.

[0067] It can be understood that the present step is specifically executed in the following manner:

[0068] The adjusted cluster center of each object (i.e., the parameter information of the cluster center) is fixed, and the parameters of the feature extraction module in the initial recognition model are adjusted based on at least one first face image of at least one object and the adjusted cluster center corresponding to at least one object in each object.

[0069] The feature extraction module is used to extract the image features of the face image.

[0070] Step S103, based on the adjusted parameters of the feature extraction module, at least one to-be-used second face image that satisfies the similarity threshold between the similarity and the adjusted cluster center corresponding to the object is selected from at least one second face image of at least one object.

[0071] The first face image and the second face image are the same or different.

[0072] The present step can include but is not limited to:

[0073] S1031, extracting, by the feature extraction module after the adjustment of the parameters, image features of the at least one second face image of the at least one object.

[0074] S1032, screening, from the at least one second face image of the at least one object, at least one second face image of the at least one object, whose image features and the adjusted cluster center corresponding to the object satisfy a similarity threshold.

[0075] The similarity between the image features of the second face image and the adjusted cluster center corresponding to the object can include, but is not limited to, a cosine value between characteristic features of the second face image and the adjusted cluster center corresponding to the object.

[0076] For example, the at least one object includes object 1, object 2 and object 3, at least one second face image of the object 1, whose image features and the adjusted cluster center corresponding to the object 1 satisfy a similarity threshold, is screened from the at least one second face image of the object 1; at least one second face image of the object 2, whose image features and the adjusted cluster center corresponding to the object 2 satisfy a similarity threshold, is screened from the at least one second face image of the object 2; at least one second face image of the object 3, whose image features and the adjusted cluster center corresponding to the object 3 satisfy a similarity threshold, is screened from the at least one second face image of the object 3.

[0077] Step S104, extracting, by the feature extraction module after the adjustment of the parameters, image features of the at least one second face image of the at least one object.

[0078] Step S105, obtaining a new cluster center of the at least one object based on the image features, and adjusting parameters of the initial recognition model to perform image recognition by the initial recognition model after the adjustment of the parameters.

[0079] It can be understood that, compared with obtaining the new clustering center of the at least one object and adjusting the parameters of the initial recognition model based on the at least one second face image of the at least one object, the similarity between the adjusted clustering center corresponding to the object and the at least one second face image of the at least one object satisfying the similarity threshold is screened out based on the adjusted feature extraction module, the image features of the at least one second face image are obtained based on the adjusted feature extraction module, the new clustering center of the at least one object is obtained based on the image features, and the parameters of the initial recognition model are adjusted, so that the noise image (i.e., the face image whose similarity between the image features and the adjusted clustering center corresponding to the object satisfies the similarity threshold) of the at least one object is reduced, the influence of the noise image on obtaining the new clustering center and adjusting the parameters of the initial recognition model is reduced, and the new clustering center of the at least one object and the parameters of the initial recognition model obtained are more accurate.

[0080] In the embodiment, the current clustering center corresponding to each object is adjusted to obtain the adjusted clustering center corresponding to each object, the parameters of the feature extraction module in the initial recognition model are adjusted based on the at least one first face image of the at least one object and the adjusted clustering center corresponding to the object, so that the feature extraction module can more accurately extract image features. On this basis, the at least one second face image to be used whose similarity between the adjusted clustering center corresponding to the object and the object satisfies the similarity threshold is screened out from the at least one second face image of the at least one object based on the adjusted feature extraction module, so as to obtain a face image of higher quality. Then, the image features of the at least one second face image to be used are extracted based on the adjusted feature extraction module, so as to ensure that the extracted image features are more accurate. The new clustering center of the at least one object is obtained based on the image features, and the parameters of the initial recognition model are adjusted, so as to ensure that the adjusted initial recognition model can more accurately perform recognition.

[0081] As another optional embodiment of the present application, referring to Figure 2 A flowchart of an obtaining method of a recognition model provided by the second embodiment of the present application is shown in the figure. The embodiment mainly refines the scheme of step S101 in the first embodiment described above. As shown in the figure, step S101 can include but is not limited to the following steps: Figure 2

[0082] Step S1011, determining the similarity between the current clustering centers corresponding to each two objects.

[0083] The step can include but is not limited to the following steps:

[0084] Determining the cosine value of the angle between the current clustering centers corresponding to each two objects.

[0085] ​If the cosine value is smaller, it indicates that the difference between the current clustering centers corresponding to each two objects is larger, and if the cosine value is larger, it indicates that the difference between the current clustering centers corresponding to each two objects is smaller.

[0086] S1012, based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects, adjusting the current clustering center corresponding to each object to obtain an adjusted clustering center corresponding to each object.

[0087] This step can include but is not limited to:

[0088] S10121, based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects, determining a second loss function value between the current clustering centers corresponding to each two objects, the second loss function value representing the degree of inconsistency between the similarity between the current clustering centers corresponding to each two objects and the first set similarity threshold.

[0089] Based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects, determining a second loss function value between the current clustering centers corresponding to each two objects can include but is not limited to:

[0090] S101211, determining the difference between the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects.

[0091] S101212, determining whether the difference is greater than 0.

[0092] If greater than 0, it indicates that the similarity between the current clustering centers corresponding to each two objects is higher than the first set similarity threshold, and then step S101213 is executed; if not greater than 0, it indicates that the similarity between the current clustering centers corresponding to each two objects is not higher than the first set similarity threshold, which can be understood as that the difference between the current clustering centers corresponding to each two objects has met the requirement, and then step S101214 is executed.

[0093] The first set similarity threshold can be set as needed and is not limited in the present application.

[0094] S101213, determining that the second loss function value between the current clustering centers corresponding to each two objects is the difference.

[0095] S101214, determining that the second loss function value between the current clustering centers corresponding to each two objects is 0.

[0096] For example, there are 10W (ten thousand) objects, and each object corresponds to a current cluster center after normalization processing of 256 dimensions of features. The current cluster center corresponding to the 10W objects is represented as a matrix A, and the matrix A is [10W*256], wherein 1*256 represents the features of the current cluster center corresponding to an object.

[0097] Corresponding to the matrix A, a [10W*10W] matrix Pred can be obtained by A*A.T, and the elements on the diagonal of the matrix Pred are all equal to 1. The elements other than the elements on the diagonal in the Pred represent the similarity between the current cluster centers corresponding to each two objects. A.T represents the transpose matrix of the matrix A. In the implementation where the similarity is the cosine of the angle, the elements other than the elements on the diagonal in the Pred can represent the cosine of the angle between the current cluster centers corresponding to each two objects.

[0098] Corresponding to the matrix Pred, a [10W*10W] matrix Label can be obtained, and the elements on the diagonal of the matrix Label are all equal to 1. The elements other than the elements on the diagonal in the matrix Label can be but are not limited to a first set similarity threshold. The first set similarity threshold can be but is not limited to 0.2. In the implementation where the similarity is the cosine of the angle, the first set similarity threshold can be set as a first set cosine threshold.

[0099] The first loss function value between the current cluster centers corresponding to each two objects can be determined by the following loss function formula:

[0100] Loss = |Pred-Label| +

[0101] Loss represents a first loss function value matrix, and the first loss function value matrix includes the first loss function value between the current cluster centers corresponding to each two objects. + represents that if the difference between the similarity between the current cluster centers corresponding to each two objects and the first set similarity threshold is greater than 0, the first loss function value generated is the above difference. If the difference between the similarity between the current cluster centers corresponding to each two objects and the first set similarity threshold is not greater than 0, the first loss function value generated is 0, that is, in the case that the similarity between the current cluster centers corresponding to each two objects is not higher than the first set similarity threshold, the degree of inconsistency between the similarity between the current cluster centers corresponding to each two objects and the first set similarity threshold is 0.

[0102] S10122, if the second loss function value does not converge, adjusting the current cluster center corresponding to each object.

[0103] Understandably, if the second loss function value does not converge, that is, if the degree of inconsistency between the similarity between the current cluster centers corresponding to each pair of objects and the first set similarity threshold does not meet the set threshold, it is necessary to adjust the current cluster centers corresponding to each object to reduce the similarity between the current cluster centers corresponding to each object, so that the difference between the current cluster centers corresponding to each pair of objects increases.

[0104] This application does not restrict the method for adjusting the current cluster center for each object. For example, it is possible, but not limited to, adjusting the current cluster center for each object based on the gradient descent algorithm.

[0105] S10123. If the value of the second loss function converges, stop adjusting the current cluster center corresponding to each object and obtain the adjusted cluster center corresponding to each object.

[0106] It is understandable that the degree of inconsistency between the adjusted cluster centers corresponding to each pair of objects and the first set similarity threshold is no higher than the set threshold.

[0107] In the implementation corresponding to steps S1011-S1012, the cosine value of the angle between the adjusted cluster centers of every two objects satisfies the first preset cosine threshold, that is, the spatial distribution of the adjusted cluster centers of each object is more reasonable. For example, as Figure 3 As shown in section (a), the cosine value of the angle between the current cluster center corresponding to the first object and the current cluster center corresponding to the second object is larger (i.e., the angle between the current cluster center corresponding to the first object and the current cluster center corresponding to the second object is smaller), and the cosine value of the angle between the current cluster center corresponding to the third object and the current cluster center corresponding to the fourth object is larger (i.e., the angle between the current cluster center corresponding to the third object and the current cluster center corresponding to the fourth object is smaller).

[0108] After adjusting the current cluster center for each object, such as Figure 3 As shown in section (b), the cosine value of the angle between the adjusted cluster centers corresponding to the first object and the adjusted cluster centers corresponding to the second object satisfies the first set cosine threshold (i.e., the angle between the adjusted cluster centers corresponding to the first object and the adjusted cluster centers corresponding to the second object is relatively large), and the cosine value of the angle between the adjusted cluster centers corresponding to the third object and the adjusted cluster centers corresponding to the fourth object satisfies the first set cosine threshold (i.e., the angle between the adjusted cluster centers corresponding to the third object and the adjusted cluster centers corresponding to the fourth object is relatively large), and the spatial distribution of the adjusted cluster centers of each object is more reasonable.

[0109] It should be noted that,Figure 3 The current cluster center and the adjusted cluster center of each object correspond to a point distributed in the spherical space. The connecting line (i.e., the connecting line between the current cluster center or the adjusted cluster center of the corresponding object and the origin in the spherical space) of the current cluster center or the adjusted cluster center of the corresponding object is used to represent the distribution of the current cluster center or the adjusted cluster center in the spherical space, which is not a limitation on the current cluster center and the adjusted cluster center. Moreover, Figure 3 This is only one example, which is not a limitation on the cluster center corresponding to each object.

[0110] As another optional embodiment of the present application, referring to Figure 4 The flowchart of the method for obtaining the recognition model provided by the third embodiment of the present application is shown in FIG. 10. The embodiment mainly refines the step S102 in the first embodiment. As shown in FIG. 10, the step S102 can include but is not limited to the following steps: Figure 4

[0111] The step S1021 comprises: extracting the image features of the at least one first face image of the at least one object based on the feature extraction module in the initial recognition model.

[0112] The step S1022 comprises: determining the first similarity between the image features of each first face image in the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object in each object, and adjusting the parameters of the feature extraction module based on the first similarity.

[0113] In the embodiment, the step of determining the first similarity between the image features of each first face image in the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object in each object can include but is not limited to:

[0114] The step S10221 comprises: determining the first cosine value between the image features of each first face image in the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object in each object.

[0115] For the embodiment in which the first similarity is the first cosine value, the third set similarity threshold value can be a third set cosine threshold value.

[0116] In the embodiment, the step of adjusting the parameters of the feature extraction module based on the first similarity can include but is not limited to:

[0117] The step S10222 comprises: obtaining the third set similarity threshold value between the image features of each first face image in the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object in each object.​

[0118] wherein the third set similarity threshold between the image feature of the first face image and the adjusted cluster center corresponding to the same object as the object to which the first face image belongs is higher than the third set similarity threshold between the image feature of the first face image and the adjusted cluster center corresponding to the different object as the object to which the first face image belongs.

[0119] The third set similarity threshold can be set as needed and is not limited in the present application. For example, the third set similarity threshold between the image feature of the first face image and the adjusted cluster center corresponding to the same object as the object to which the first face image belongs can be but is not limited to 1, and the third set similarity threshold between the image feature of the first face image and the adjusted cluster center corresponding to the different object as the object to which the first face image belongs can be but is not limited to 0.

[0120] S10223, determining a fourth loss function value between the first similarity and the third set similarity threshold between the image feature of the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object of each object, the fourth loss function value representing the degree of inconsistency between the first similarity and the third set similarity threshold.

[0121] In the present embodiment, the fourth loss function value between the first similarity and the third set similarity threshold between the image feature of the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object of each object can be but is not limited to determined based on a softmax loss function.

[0122] S10224, if the fourth loss function value does not converge, adjusting the parameters of the feature extraction module.

[0123] It can be understood that if the fourth loss function value does not converge, it means that the degree of inconsistency between the first similarity and the third set similarity threshold between the image feature of the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object of each object does not satisfy the second set degree threshold, and the parameters of the feature extraction module need to be adjusted so that the feature extraction module after adjusting the parameters can reduce the degree of inconsistency between the first similarity and the third set similarity threshold between the image feature of the at least one first face image of the at least one object and the adjusted cluster center corresponding to the at least one object of each object.

[0124] S10225, if the fourth loss function value converges, ending the adjustment of the parameters of the feature extraction module.

[0125] Based on the adjusted feature extraction module, at least one second face image corresponding to the object and satisfying the similarity threshold value between the adjusted clustering centers can be screened out from at least one second face image of at least one object.

[0126] Taking the data participating in adjusting the parameters of the feature extraction module each time as an example, 512 first face images of one object in 10W objects and the adjusted clustering centers corresponding to the 10W objects, the above steps S1021 and S1022 are described, for example, as shown in Figure 5 In the case of adjusting the current clustering center corresponding to each object in 10W objects to obtain the adjusted 256-dimensional clustering center [256*10W], each time 512 first face images of one object are selected from at least one first face image of 10W objects, the 256-dimensional image features of each first face image in the 512 first face images of the object are extracted based on the feature extraction module in the initial recognition model, the first similarity between the 256-dimensional image features of each first face image in the 512 first face images of the object and the adjusted 256-dimensional clustering center corresponding to each object in 10W objects is determined based on the similarity determination module, and a first similarity distribution matrix [512*10W] is obtained. Corresponding to the first similarity distribution matrix [512*10W], the One-Hot [512*10W] corresponding to the 10W objects is determined (i.e., one of the third similarity threshold values), the fourth loss function value between the first similarity distribution matrix [512*10W] and the One-Hot [512*10W] is determined based on the softmax loss function, and if the fourth loss function value does not converge, the parameters of the feature extraction module are adjusted until the fourth loss function value converges.

[0127] If the fourth loss function value converges, the parameter adjustment of the feature extraction module is ended, at least one second face image corresponding to the object and satisfying the similarity threshold value between the adjusted clustering centers is screened out from at least one second face image of at least one object based on the adjusted feature extraction module, and then the image features of the at least one second face image are extracted based on the adjusted feature extraction module.

[0128] In this embodiment, the parameters of the feature extraction module can be adjusted based on the gradient descent algorithm, but are not limited thereto.

[0129] As another optional embodiment of the present application, referring to Figure 6 A flowchart of an obtaining method of a recognition model provided by the fourth embodiment of the present application is shown, and the present embodiment mainly refines the scheme of step S105 in the above first embodiment, for example, as shown in Figure 6As shown, step S105 can include but is not limited to the following steps:

[0130] Step S1051, determining a second similarity between the image feature and the newly determined cluster center of the initial at least one object.

[0131] It should be noted that after obtaining the adjusted feature extraction module, the adjusted cluster center corresponding to each object can be removed (i.e., the parameter information of the adjusted cluster center is no longer fixed), and in the case of removing the adjusted cluster center corresponding to the object, the newly determined cluster center of the initial at least one object is determined, and in the case of determining the newly determined cluster center of the initial at least one object, the second similarity between the image feature of the second face image to be used and the newly determined cluster center of the initial at least one object is determined.

[0132] Step S1052, determining a second set similarity threshold between the image feature and the newly determined cluster center of the initial at least one object.

[0133] This step can determine the second set similarity threshold in the same way as obtaining the third set similarity threshold in step S10222 in the third embodiment, and will not be described here.

[0134] Step S1053, determining a third loss function value between the second similarity and the second set similarity threshold.

[0135] The third loss function value represents the degree of inconsistency between the second similarity and the second set similarity threshold.

[0136] Step S1054, if the third loss function value does not converge, adjusting the newly determined cluster center of the initial at least one object and the parameters of the initial recognition model, and returning to execute step S104.

[0137] If the third loss function value does not converge, the newly determined cluster center of the initial at least one object and the parameters of the initial recognition model can be adjusted based on the third loss function value and the gradient descent algorithm.

[0138] Step S1055, if the third loss function value converges, ending the adjustment, obtaining the newly determined cluster center of the at least one object and the initial recognition model with adjusted parameters.

[0139] Now taking 512 second face images to be used of one of the objects as an example, the above steps S1051 and S1055 are described, for example, as shown in FIG. 7. Figure 7As shown, the 512-dimensional image features of the 512 second face images to be used are extracted based on the adjusted feature extraction module, the second similarity between the 256-dimensional image features of each of the 512 second face images to be used of the object and the 256-dimensional new clustering centers of each of the 10W objects initially determined is determined based on the similarity determination module, a second similarity distribution matrix [512*10W] is obtained, the One-Hot [512*10W] corresponding to the second similarity distribution matrix [512*10W] is determined (i.e., an implementation of the second set similarity threshold), the third loss function value between the second similarity distribution matrix [512*10W] and the One-Hot [512*10W] is determined based on the softmax loss function, if the third loss function value does not converge, the new clustering centers of the 10W objects initially determined and the parameters of the initial recognition model are adjusted; if the third loss function value converges, the adjustment is ended, and the new clustering centers of the at least one object and the initial recognition model with the adjusted parameters are obtained.

[0140] As another optional embodiment of the present application, referring to Figure 8 The flowchart of the method for obtaining a recognition model according to the fifth embodiment of the present application is shown in the figure, and the present embodiment is mainly an extension of the method for obtaining a recognition model described in the first embodiment. As shown in the figure, the method can include but is not limited to the following steps: Figure 8

[0141] Step 201, adjusting the current clustering center corresponding to each object to obtain an adjusted clustering center corresponding to each object, the difference between the adjusted clustering centers corresponding to each two objects satisfies a set threshold, and the current clustering center can represent the identity of the object.

[0142] Step S202, adjusting the parameters of the feature extraction module in the initial recognition model based on the at least one first face image of the at least one object and the adjusted clustering center corresponding to each of the at least one object.

[0143] Step S203, based on the adjusted feature extraction module, screening at least one second face image to be used from the at least one second face image of the object, the similarity between the adjusted clustering centers corresponding to the object satisfies a similarity threshold; wherein the first face image and the second face image are the same or different.

[0144] Step S204, extracting image features of at least one second face image to be used based on the adjusted feature extraction module.

[0145] ​In step S205, a new clustering center of the at least one object is obtained based on the image features, and the parameters of the initial recognition model are adjusted to perform image recognition by the initial recognition model after the adjustment of the parameters.

[0146] The detailed processes of steps S201-S205 can refer to the related descriptions of steps S101-S105 in the above embodiments, which will not be repeated here.

[0147] In step S206, it is determined whether the difference between the new clustering centers of each two objects in the new clustering centers of the at least one object meets a set threshold.

[0148] In the embodiment, the difference between the new clustering centers of each two objects in the new clustering centers of the at least one object does not meet the set threshold, which can include but is not limited to:

[0149] The first loss function value between the new clustering centers of each two objects determined based on the first set similarity threshold and the similarity between the new clustering centers of each two objects in the new clustering centers of the at least one object is not converged.

[0150] The first loss function value represents the degree of inconsistency between the similarity between the new clustering centers of each two objects and the first set similarity threshold.

[0151] In the embodiment, whether the first loss function value between the new clustering centers of each two objects is converged can be determined in the same manner as step S10121 in the second embodiment. The detailed process of the first loss function value between the new clustering centers of each two objects determined based on the first set similarity threshold and the similarity between the new clustering centers of each two objects in the new clustering centers of the at least one object not being converged in this step will not be repeated here.

[0152] If not, return to execute step S201; if yes, end the obtaining process of the recognition model.

[0153] It can be understood that returning to execute step S201, the current clustering center corresponding to each object in step S201 is the new clustering center of the at least one object.

[0154] Now taking the 512 first face images of one object in 10W objects and the adjusted clustering centers corresponding to the 10W objects as an example of the data participating in the adjustment of the parameters of the feature extraction module each time, the above steps S201-S206 will be described, for example, as shown in Figure 9 The specific implementation process of extracting the image features of the at least one second face image based on the feature extraction module after the adjustment of the parameters can refer to the implementation process described in the third embodiment. Figure 5 ​

[0155] An implementation process of obtaining a new clustering center of at least one object based on image features and adjusting parameters of the initial recognition model to perform image recognition by the initial recognition model with adjusted parameters can be referred to the fourth implementation mode Figure 7 The implementation process is introduced as follows.

[0156] On the basis, if the difference between the new clustering center of each two objects in the 10W new clustering centers does not satisfy the set threshold, a specific implementation process of returning to perform the steps S201-S205 is performed until the difference between the new clustering center of each two objects in the 10W new clustering centers satisfies the set threshold.

[0157] In the implementation mode, the current clustering center corresponding to each object is adjusted to obtain an adjusted clustering center corresponding to each object, the parameters of the feature extraction module in the initial recognition model are adjusted based on the at least one first face image of the at least one object and the adjusted clustering center corresponding to the object, so that the feature extraction module can more accurately extract image features. On this basis, at least one to-be-used second face image with a similarity between the adjusted clustering center corresponding to the object satisfying a similarity threshold is screened from the at least one second face image of the at least one object based on the feature extraction module with adjusted parameters, to obtain a higher-quality face image. Then, the image features of the at least one to-be-used second face image are extracted based on the feature extraction module with adjusted parameters, to ensure that the extracted image features are more accurate. The new clustering center of the at least one object is obtained based on the image features, and the parameters of the initial recognition model are adjusted, to ensure that the adjusted initial recognition model can more accurately perform recognition.

[0158] Further, if the difference between the new clustering center of each two objects in the new clustering center of the at least one object does not satisfy the set threshold, the adjustment of the current clustering center corresponding to each object to obtain the adjusted clustering center corresponding to each object is returned to be performed until the difference between the new clustering center of each two objects in the new clustering center of the at least one object satisfies the set threshold, so that the new clustering center of the at least one object and the further adjusted initial recognition model are more accurate.

[0159] Next, an obtaining device of a recognition model provided by the present application is introduced. The obtaining device of the recognition model introduced below can be correspondingly referred to the obtaining method of the recognition model introduced above.

[0160] Please refer to Figure 10 , the obtaining device of the recognition model comprises a first adjustment module 100, a second adjustment module 200, a screening module 300, an extraction module 400 and a third adjustment module 500.

[0161] The first adjusting module 100 is configured to adjust the current cluster center corresponding to each object to obtain an adjusted cluster center corresponding to each object, and a difference between the adjusted cluster centers corresponding to each of two objects satisfies a set threshold, and the current cluster center can represent the identity of the object.

[0162] The second adjusting module 200 is configured to adjust a parameter of a feature extraction module in the initial recognition model based on the at least one first face image of the at least one object and the adjusted cluster center corresponding to each of the at least one object.

[0163] The screening module 300 is configured to screen at least one to-be-used second face image that has a similarity between the adjusted cluster center corresponding to the object satisfying a similarity threshold from the at least one second face image of the at least one object based on the feature extraction module after the parameter adjustment.

[0164] The extraction module 400 is configured to extract an image feature of the at least one to-be-used second face image based on the feature extraction module after the parameter adjustment.

[0165] The third adjusting module 500 is configured to obtain a new cluster center of the at least one object based on the image feature, and adjust a parameter of the initial recognition model to perform image recognition by using the initial recognition model after the parameter adjustment.

[0166] In the embodiment, the obtaining apparatus of the recognition model can further include:

[0167] The determining module is configured to, if a difference between the new cluster centers of each of two objects in the new cluster centers of the at least one object does not satisfy the set threshold, return to adjust the current cluster center corresponding to each object to obtain the adjusted cluster center corresponding to each object.

[0168] The difference between the new cluster centers of each of two objects in the new cluster centers of the at least one object not satisfying the set threshold can include:

[0169] A first loss function value between the new cluster centers of each of two objects determined based on the first set similarity threshold and the similarity between the new cluster centers of each of two objects in the new cluster centers of the at least one object does not converge;

[0170] The first loss function value represents a degree of inconsistency between the similarity between the new cluster centers of each of two objects and the first set similarity threshold.

[0171] In the embodiment, the first adjusting module 100 can be specifically configured to:

[0172] Determine the similarity between the current cluster centers corresponding to each of two objects;

[0173] The first adjustment module 100 adjusts the current clustering center corresponding to each object based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects.

[0174] The process that the first adjustment module 100 adjusts the current clustering center corresponding to each object based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects can specifically include:

[0175] Based on the first set similarity threshold and the similarity between the current clustering centers corresponding to each two objects, a second loss function value between the current clustering centers corresponding to each two objects is determined, and the second loss function value represents the degree of inconsistency between the similarity between the current clustering centers corresponding to each two objects and the first set similarity threshold.

[0176] If the second loss function value does not converge, the current clustering center corresponding to each object is adjusted.

[0177] In the embodiment, the second adjustment module can be specifically used for:

[0178] Based on the initial recognition model, the feature extraction module extracts image features of at least one first face image of at least one object.

[0179] The first similarity between the image features of the at least one first face image and the adjusted clustering center corresponding to at least one object in each object is determined, and the parameters of the feature extraction module are adjusted based on the first similarity.

[0180] In the embodiment, the screening module can be specifically used for:

[0181] Based on the adjusted parameters of the feature extraction module, the image features of at least one second face image of at least one object are extracted.

[0182] From at least one second face image of at least one object, at least one to-be-used second face image is screened out, in which the similarity between the image features of the second face image and the adjusted clustering center corresponding to the object satisfies the similarity threshold.

[0183] In the embodiment, the third adjustment module 500 can be specifically used for:

[0184] The second similarity between the image features and the newly determined clustering center of the at least one object is determined.

[0185] The second set similarity threshold between the image features and the newly determined clustering center of the at least one object is determined.

[0186] determining a third loss function value between the second similarity and the second set similarity threshold value;

[0187] If the third loss function value does not converge, adjusting the initial determined new clustering center of the at least one object and the parameters of the initial recognition model, and returning to execute the step of extracting the image features of the at least one second face image based on the adjusted parameters of the feature extraction module;

[0188] If the third loss function value converges, ending the adjustment, and obtaining the new clustering center of the at least one object and the initial recognition model with the adjusted parameters.

[0189] Corresponding to the above-mentioned embodiment of the method for obtaining a recognition model, the present application also provides an electronic device embodiment applying the method for obtaining the recognition model.

[0190] The electronic device can include the following structure:

[0191] The memory and the processor.

[0192] The memory is used to store at least a set of instruction sets;

[0193] The processor is used to call and execute the instruction sets in the memory 10, and execute the method for obtaining a recognition model as introduced in the first embodiment or the second embodiment by executing the instruction sets.

[0194] Corresponding to the above-mentioned embodiment of the control method, the present application also provides an embodiment of a storage medium.

[0195] In this embodiment, the storage medium stores a computer program for implementing the method for obtaining a recognition model as introduced in the first embodiment or the second embodiment, and the computer program is executed by the processor to implement the method for obtaining a recognition model as introduced in the first embodiment or the second embodiment.

[0196] It should be noted that each embodiment focuses on the differences from other embodiments, and the same and similar parts of each embodiment can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts can be referred to the part of the method embodiment.

[0197] Finally, it is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is also to be understood that where the construction of a claim or claims is not explicitly recited in the specification, it is intended that the claim or claims be construed in accordance with 35 U.S.C. § 112(a) unless and except as specifically limited by the following claims. In this case, the reference numerals in the claims are merely provided as consistency checks.

[0198] For the convenience of description, the above apparatus is described in various modules with functions respectively. Of course, the functions of the modules can be implemented in one or more software and / or hardware in the implementation of the present application.

[0199] From the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary general hardware platform. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the various embodiments or some parts of the embodiments of the present application.

[0200] The above provides a detailed description of the method, device and electronic equipment for obtaining an identification model. The principles and implementation modes of the present application are described by applying specific examples. The above description of the embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed; in summary, the content of the specification should not be understood as a limitation of the present application.

Claims

1. A method for obtaining a recognition model, comprising: The current cluster center corresponding to each object is adjusted to obtain the adjusted cluster center corresponding to each object. The difference between any two adjusted cluster centers corresponding to each object meets a set threshold. The current cluster center can characterize the identity of the object. Based on at least one first face image of at least one of the objects and the adjusted cluster center corresponding to at least one of the objects, the parameters of the feature extraction module in the initial recognition model are adjusted; Based on the feature extraction module with adjusted parameters, at least one second face image to be used is selected from at least one second face image of at least one object, where the similarity between the adjusted cluster centers corresponding to the object meets a similarity threshold; wherein, the first face image and the second face image are the same or different; Based on the adjusted parameters, the feature extraction module extracts image features of the at least one second face image to be used. Based on the image features, at least one new cluster center of the object is obtained, and the parameters of the initial recognition model are adjusted to perform image recognition through the initial recognition model with adjusted parameters.

2. The method according to claim 1, further comprising: If the difference between any two new cluster centers of at least one of the objects does not meet the set threshold, the process of adjusting the current cluster center corresponding to each object is returned to obtain the adjusted cluster center corresponding to each object.

3. The method according to claim 2, wherein the difference between any two new cluster centers of the objects in the new cluster centers of the at least one of the objects does not satisfy the set threshold, comprising: Based on a first set similarity threshold and the similarity between every two new cluster centers of the objects in at least one new cluster center of the objects, the first loss function value between every two new cluster centers of the objects has not converged; The first loss function value represents the degree of inconsistency between the similarity between the new cluster centers of each pair of objects and the first set similarity threshold.

4. The method according to claim 1, wherein adjusting the current cluster center corresponding to each object to obtain the adjusted cluster center corresponding to each object comprises: Determine the similarity between the current cluster centers corresponding to each pair of said objects; Based on the first set similarity threshold and the similarity between the current cluster centers corresponding to each pair of objects, the current cluster center corresponding to each object is adjusted to obtain the adjusted cluster center corresponding to each object.

5. The method according to claim 4, wherein adjusting the current cluster center corresponding to each object based on a first set similarity threshold and the similarity between the current cluster centers corresponding to each pair of objects includes: Based on a first set similarity threshold and the similarity between the current cluster centers corresponding to each pair of objects, a second loss function value is determined between the current cluster centers corresponding to each pair of objects. The second loss function value characterizes the degree of inconsistency between the similarity between the current cluster centers corresponding to each pair of objects and the first set similarity threshold. If the second loss function value does not converge, the current cluster center corresponding to each object is adjusted.

6. The method according to claim 1, wherein the parameters of the feature extraction module in the initial recognition model are adjusted based on at least one first face image of at least one of the objects and the adjusted cluster centers corresponding to at least one object in each object, including: Based on the feature extraction module in the initial recognition model, at least one first face image of the object is extracted; A first similarity is determined between at least one image feature of the first face image and the adjusted cluster center corresponding to at least one object in each object, and the parameters of the feature extraction module are adjusted based on the first similarity.

7. The method according to claim 1, wherein, based on the feature extraction module with adjusted parameters, at least one second face image to be used is selected from at least one second face image of at least one object, provided that the similarity between the adjusted cluster centers corresponding to the object satisfies a similarity threshold, comprising: Based on the adjusted parameters, the feature extraction module extracts image features of at least one second face image of at least one of the objects; From at least one second face image of at least one object, at least one second face image to be used is selected, wherein the similarity between the image features of the second face image and the adjusted cluster center corresponding to the object satisfies a similarity threshold.

8. The method according to claim 1, wherein at least one new cluster center of the object is obtained based on the image features, and the parameters of the initial recognition model are adjusted, comprising: Determine a second similarity between the image features and the newly determined cluster centers of at least one of the objects initially identified; A second set similarity threshold is determined between the image features and the newly determined cluster centers of at least one of the objects initially identified; Determine the value of a third loss function between the second similarity and the second set similarity threshold; If the third loss function value does not converge, adjust the parameters of the initially determined new cluster center of at least one of the objects and the initial recognition model, and return to the step of extracting the image features of the at least one second face image to be used based on the adjusted parameters; If the value of the third loss function converges, the adjustment ends, and at least one new cluster center of the object and an initial recognition model after parameter adjustment are obtained.

9. An apparatus for obtaining a recognition model, comprising: The first adjustment module is used to adjust the current cluster center corresponding to each object to obtain the adjusted cluster center corresponding to each object. The difference between the adjusted cluster centers corresponding to any two objects meets a set threshold. The current cluster center can characterize the identity of the object. The second adjustment module is used to adjust the parameters of the feature extraction module in the initial recognition model based on at least one first face image of at least one of the objects and the adjusted cluster center corresponding to at least one of the objects. A filtering module is used to filter at least one second face image to be used from at least one second face image of at least one object, based on the feature extraction module after adjusting parameters, if the similarity between the adjusted cluster centers corresponding to the object meets a similarity threshold. The extraction module is used to extract image features of the at least one second face image to be used based on the adjusted parameters of the feature extraction module; The third adjustment module is used to obtain at least one new cluster center of the object based on the image features, and adjust the parameters of the initial recognition model so as to perform image recognition through the initial recognition model with the adjusted parameters.

10. An electronic device, comprising: Memory and processor; The memory is used to store at least one set of instructions; The processor is configured to call and execute the instruction set in the memory, and execute the method for obtaining the recognition model as described in any one of claims 1-8 by executing the instruction set.

Citation Information

Patent Citations

  • Face recognition method and device and face recognition model training method and device

    CN115116115A

  • Neural network-based multilayer image feature extraction modeling method and device and image recognition method and device

    WO2018068416A1