Key point recognition model processing method, key point recognition method and device
By constructing a target loss function to constrain the training process of the face key point detection model, separate the key point structure information and noise information, solve the problem of inaccurate predictions and noise effects of the face key point detection model in different areas, and achieve a better Accurate and efficient facial keypoint detection.
Patent Information
- Application Number
- CN202110118210.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-28
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-01-28
AI Technical Summary
The prediction results of existing face key point detection models in different face areas are inaccurate, and noise information affects the positioning results.
By constructing a target loss function to constrain the training process of the first network model and the second network model, the key point structure information and appearance information in the image are separated, and the key point structure prediction model obtained by training is used to make accurate predictions.
It improves the accuracy of face key point detection, reduces the amount of model parameters and calculations, increases the prediction rate, and decouples key point structure information and noise information.
Smart Images

Figure CN114821690B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a key point recognition model processing method, a key point recognition method and device, a device, an electronic device and a storage medium. Background Art
[0002] Facial key point detection is also called facial key point detection, positioning or face alignment. It refers to locating the key areas of a face, including eyebrows, eyes, nose, mouth, facial contour, etc., given a face image. In recent years, with the rapid development of deep learning technology, facial key point detection has been widely used in identity authentication, face recognition, face tracking and other fields. However, the key point structures in different areas of the face are different. Using existing model training methods to train models to predict the key points of each area of the face may lead to inaccurate prediction results. Summary of the invention
[0003] In view of the above problems, the present application proposes a key point recognition model processing method, a key point recognition method and device, a device, an electronic device and a storage medium to improve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a key point recognition model processing method, the method comprising: obtaining a feature image corresponding to a sample image; inputting the feature image into a first network model and a second network model respectively, and obtaining a first feature map output by the first network model, and obtaining a second feature map output by the second network model, the first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image; adjusting the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge; using the first network model when the target loss function converges as the key point structure prediction model.
[0005] In a second aspect, an embodiment of the present application provides a key point recognition method, the method comprising: acquiring an image to be recognized; inputting the image to be recognized into a target key point recognition model, the target key point recognition model comprising a key point structure prediction model trained by the method described in the first aspect above, so as to predict the key point structure information in the image to be recognized through the key point structure prediction model; using the image output by the key point structure prediction model as a target image, the target image comprising a key point structure.
[0006] In a third aspect, an embodiment of the present application provides a key point recognition model processing device, the device comprising: a feature image acquisition module, used to acquire a feature image corresponding to a sample image; a feature image processing module, used to input the feature image into a first network model and a second network model, respectively, and acquire a first feature map output by the first network model, and acquire a second feature map output by the second network model, the first network model being used to predict key point structure information in the feature image, and the second network model being used to predict appearance and noise information in the feature image; a processing module, used to adjust the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, respectively, until the first feature map output by the first network model and the second feature map output by the second network model converge the target loss function; a model acquisition module, used to use the first network model when the target loss function converges as the key point structure prediction model.
[0007] In a fourth aspect, an embodiment of the present application provides a key point recognition device, the device comprising: an image acquisition unit, for acquiring an image to be recognized; an information prediction unit, for inputting the image to be recognized into a target key point recognition model, the target key point recognition model comprising a key point structure prediction model trained by the method described in the second aspect above, so as to predict the key point structure information in the image to be recognized through the key point structure prediction model; a key point recognition unit, for using the image output by the target key point recognition model as a target image, the target image including the target key points.
[0008] In a fifth aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method described in the first aspect or the second aspect above.
[0009] In a sixth aspect, the present application provides a computer-readable storage medium, in which a program code is stored, wherein when the program code is run, the method described in the first aspect or the second aspect above is executed.
[0010] The present application provides a key point recognition model processing method, a key point recognition method and device, a device, an electronic device and a storage medium, by obtaining a feature image corresponding to a sample image; inputting the feature image into a first network model and a second network model respectively, and obtaining a first feature map output by the first network model, and obtaining a second feature map output by the second network model, the first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image; according to the first feature map, the second feature map and the target loss function, the parameters of the first network model and the second network model are adjusted respectively until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge; the first network model when the target loss function converges is used as the key point structure prediction model. Thus, the above method realizes constraining the training process of the first network model and the second network model by constructing a target loss function, and then using the first network model when the target loss function converges as the key point structure prediction model, so that the key point structure information and the appearance and noise information in the image can be decoupled by the constructed target loss function, and then the key point structure prediction model obtained by training can accurately predict the key point structure of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 A method flow chart of a key point recognition model processing method proposed in an embodiment of the present application is shown.
[0013] Figure 2 A method flow chart of a key point recognition model processing method proposed in another embodiment of the present application is shown.
[0014] Figure 3 A method flow chart of a key point recognition model processing method proposed in yet another embodiment of the present application is shown.
[0015] Figure 4 A schematic diagram of a training network structure for training a first network model and a second network model provided in the present application is shown.
[0016] Figure 5A schematic diagram is shown of adjusting the network parameters of a convolutional neural network and a fully connected layer according to a second loss parameter provided in an embodiment of the present application.
[0017] Figure 6 A method flow chart of a key point identification method proposed in an embodiment of the present application is shown.
[0018] Figure 7 A schematic diagram of the reasoning process of the target key point recognition model provided in an embodiment of the present application for identifying the key points of the contour structure in the image to be recognized is shown.
[0019] Figure 8 A schematic diagram showing the positions of key point coordinates provided in an embodiment of the present application is shown.
[0020] Fig. 9 A structural block diagram of a key point recognition model processing device proposed in an embodiment of the present application is shown.
[0021] Fig.10 A structural block diagram of a key point identification device proposed in an embodiment of the present application is shown.
[0022] Fig.11 A structural block diagram of an electronic device of the present application for executing a key point recognition model processing method or a key point recognition method according to an embodiment of the present application is shown.
[0023] Fig.12 It is a storage unit of an embodiment of the present application for storing or carrying a program code for implementing a key point recognition model processing method or a key point recognition method according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] With the rapid development of artificial intelligence technology, facial key point detection technology has brought convenience to the military, criminal investigation, identity authentication and other fields. In order to improve the accuracy of facial key point detection, facial key points can be regressed or predicted to obtain the heat map of facial key points, thereby determining the location of facial key points.
[0026] After long-term research, the inventors found that there is a strong correlation between the key points of the face using coordinate regression, and there is a strong correlation between the key points in the same area of the face. If the same model is directly used to predict the key points in different areas of the face, it will affect the prediction results between each other, and the surrounding environment noise has a greater impact on the key point positioning results.
[0027] Therefore, in order to improve the above-mentioned problems, the inventors proposed the key point recognition model processing method, key point recognition method and device, device, electronic device and storage medium provided in the present application, which constrains the training process of the first network model and the second network model by constructing a target loss function, and then uses the first network model when the target loss function converges as the key point structure prediction model, so that the key point structure information and appearance and noise information in the image can be decoupled through the constructed target loss function, and then the key point structure prediction model obtained by training can be used to accurately predict the key point structure of the image.
[0028] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0029] See also Figure 1 An embodiment of the present application provides a key point recognition model processing method, the method comprising:
[0030] Step S110: Acquire a feature image corresponding to the sample image.
[0031] The sample image in this embodiment is an image including the outer contour of the target object. The target object may be a human face, a human hand, or other living objects (such as a cat, a dog), etc. This embodiment is described by taking the target object being a human face as an example.
[0032] Specifically, taking the target object as a human face as an example, the sample image may be a face image including the external contour of the face (i.e., the position below the forehead of the face and the contour that can depict the shape of the face). The sample image in this manner may only include the contour of the face, but not the forehead, eyes, nose, mouth and other organs of the face, wherein "not including" may be understood as blurring (covering) the forehead, eyes, nose, mouth and other organs of the face. Alternatively, the sample image may include the contour of the face, and also include the forehead, eyes, nose, mouth and other organs of the face, but at this time the clarity of the forehead, eyes, nose, mouth and other organs of the face may be lower than a preset threshold. Optionally, the sample image may be a frontal face image or a side face image. When the sample image is a frontal face image, the sample image does not include the nose, and when the sample image is a side face image, the sample image includes the nose.
[0033] The sample image may be an image acquired by an image sensor of an electronic device, an image transmitted by other devices, or an image downloaded from a cloud server via the network. In this application, the source of the sample image is not limited. The size of the sample image may not be limited, for example, the size may be 128x128.
[0034] As a method, the sample image can be input into the convolutional neural network, and then the feature image output by the convolutional neural network can be obtained. The convolutional neural network in this application can be composed of 4 groups of convolutional layers and a maximum pooling layer (maxpool), a batch normalization layer (batchnorm, abbreviated as BN), and an adaptive parameterized activation function (relu). Specifically, the detailed structure of each group of the convolutional neural network is shown in Table 1 below:
[0035] Conv1(BN, Relu) Kernel:3x3, stride:1, output_channel:32 Maxpool1 Kernel:2x2, stride:2 Conv2 (BN, Relu) Kernel:3x3, stride:1, output_channel:64 Maxpool2 Kernel:2x2, stride:2 Conv3 (BN, Relu) Kernel:3x3, stride:1, output_channel:128 Maxpool3 Kernel:2x2, stride:2 Conv4(BN, Relu) Kernel:3x3, stride:1, output_channel:256 Maxpool4 Kernel:2x2, stride:2
[0036] Wherein, Conv represents the number of convolutional layers, Kernel represents kernel function, convolution kernel, Stride represents stride, and output_channel represents output channel. Optionally, the number of layers of the convolutional neural network in this application may not be limited, and the depth and width of the convolutional neural network may be increased according to actual needs.
[0037] In some possible implementations, the convolutional neural network may also be replaced by other feature extraction network models with feature extraction functions, which are not listed here one by one.
[0038] Step S120: input the feature image into the first network model and the second network model respectively, and obtain a first feature map output by the first network model, and obtain a second feature map output by the second network model.
[0039] Among them, the first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image. In the present application, the first network model and the second network model both include two convolutional layers, namely a 3x3 convolution and a 1x1 convolution, and the step sizes of the two convolutional layers are both 1, and the number of channels of the output feature map remains unchanged (that is, the same as the number of channels of the last group of convolutional layers of the convolutional neural network, as shown in Table 1, which is 256).
[0040] The feature image output from the convolutional neural network may include information such as facial contour structure information, noise information, and facial appearance. After the feature image is input into the first network model and the second network model respectively, the first feature map output by the first network model and the second feature map output by the second network model can be obtained. Since the prediction functions of the first network model and the second network model are roughly the same at this time, the first feature map and the second feature map at this time both include information such as facial contour structure information, noise information, and facial appearance.
[0041] In order to improve the accuracy of predicting the key points of the face contour, this embodiment constructs a training loss paradigm (i.e., nuclear norm) for performing low-rank constraints on the training process of the first network model and the second network model to separate the low-rank information representing the face contour structure information in the feature image, which is specifically described as follows:
[0042] Step S130: Adjust the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge.
[0043] Among them, the target loss function is the above-mentioned training loss paradigm. As a method, when the first feature map output by the first network model and the second feature map output by the second network model are obtained for the first time, the parameters of the first network model and the second network model can be adjusted according to the first feature map, the second feature map and the target loss function. Specifically, the first feature map and the second feature map can be substituted into the following loss function, and the back propagation gradient of the first network model and the second network model can be determined according to the result of the loss function, and then the neural network parameters of the first network model and the second network model can be adjusted according to the back propagation gradient, and the adjustment process is repeated until the first feature map output by the first network model and the second feature map output by the second network model converge the target loss function.
[0044] The objective loss function in this application is:
[0045] Loss = Min(min||Noise feat|| * +λ||Struct feat|| 2,1 )
[0046] Wherein, the loss represents the target loss function, the Struct feat represents the first feature map, the Noisefeat represents the second feature map, and the ||Noise feat|| *Characterizes the nuclear norm of the second feature map, the min||Noise feat|| * Characterize the minimization of the nuclear norm of the second feature map. By minimizing the nuclear norm of the second feature map, the rank of the matrix can be minimized, and the second network model is constrained so that it can be trained to obtain some information that is not related to the key points of the face contour but is related to the sample image (for example, the appearance information of the sample image, the background noise information, etc.), that is, to let the Noise feat obtain the coefficient representing the noise information. The λ||Struct feat|| 2,1 The 21 norm of the first feature map is characterized, and the λ is characterized by a weight parameter value, and the value of λ can be changed according to the actual training process. By constraining Struct feat, sparse information useful for locating key points of the face contour can be obtained (that is, facial structure information related to the position of key points of the face contour).
[0047] By adjusting the parameters of the first network model and the second network model respectively according to the first feature map, the second feature map and the target loss function, and iterating the adjustment process until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge, it is possible to decouple the aforementioned feature image into a feature map representing facial contour structure information and a feature map representing appearance and noise information through the first network model and the second network model when the target loss function converges.
[0048] Step S140: using the first network model when the target loss function converges as a key point structure prediction model.
[0049] As a method, the first network model when the target loss function converges can be used as the key point structure prediction model, and the second network model when the target loss function converges can be used as the noise prediction model, so that the facial contour structure in the face image can be accurately predicted by the key point structure prediction model.
[0050] Compared with predicting the key points of each area of the face through a general model, the present embodiment adopts a key point structure prediction model to make a targeted prediction of the face contour structure, thereby improving the accuracy of key point positioning. At the same time, the key point structure prediction model in the present embodiment is more lightweight than the key point prediction model that predicts the key points of the entire face, thereby reducing the model parameter amount and the amount of calculation, thereby improving the prediction rate.
[0051] In some possible implementations, the key point structure prediction model trained in this embodiment can be extracted and combined with other network models, and then the combined lightweight model can be used to more accurately predict the external contour key points of faces and other living objects.
[0052] The present application provides a key point recognition model processing method, which obtains the feature image corresponding to the sample image; inputs the feature image into the first network model and the second network model respectively, and obtains the first feature map output by the first network model, and obtains the second feature map output by the second network model, the first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image; according to the first feature map, the second feature map and the target loss function, the parameters of the first network model and the second network model are adjusted respectively until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge; the first network model when the target loss function converges is used as the key point structure prediction model. Thus, the training process of the first network model and the second network model is constrained by constructing the target loss function, and the first network model when the target loss function converges is used as the key point structure prediction model, so that the key point structure information and the appearance and noise information in the image can be decoupled by the constructed target loss function, and then the key point structure prediction model obtained by training can accurately predict the key point structure of the image.
[0053] See also Figure 2 Another embodiment of the present application provides a key point recognition model processing method, the method comprising:
[0054] Step S210: Acquire a feature image corresponding to the sample image.
[0055] Step S220: input the feature image into the first network model and the second network model respectively, and obtain the first feature map output by the first network model, and obtain the second feature map output by the second network model.
[0056] Step S230: Adjust the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge.
[0057] Step S240: When the target loss function converges, a first feature map output by the first network model is obtained as a key point structure feature map, and a second feature map output by the second network model is obtained as a noise feature map.
[0058] As a method, when the target loss function converges, the first feature map output by the first network model can be used as the key point (i.e., face contour key point) structural feature map, and the second feature map output by the second network model can be used as the noise feature map.
[0059] Step S250: acquiring a reconstructed feature image corresponding to the feature image according to the key point structure feature map, the noise feature map and the feature image.
[0060] In order to further improve the accuracy of predicting the key points of the face contour, the present application can obtain a reconstructed feature image corresponding to the feature image based on the key point structure feature map, the noise feature map and the feature image. The specific calculation formula is as follows:
[0061] feat'=Noise feat*feature map+Struct feat
[0062] Among them, the feat' represents the reconstructed feature image, the Noise feat represents the noise feature map, the feature map represents the feature image, and the Struct feat represents the key point structure feature map. The Noise feat*feature map represents the feature that lacks the key point contour structure (useful part). By adding the Noise feat*feature map and the Struct feat (useful part), the complete feature can be reconstructed.
[0063] Step S260: Obtain a first loss parameter according to the reconstructed feature image and the feature image.
[0064] At this time, the first loss parameter may be calculated according to the reconstructed feature image (feat') and the feature image. In this embodiment, the first loss parameter is the L2 distance (ie, L2 loss).
[0065] Step S270: adjusting parameters of the first network model and the second network model according to the first loss parameter.
[0066] In this embodiment, the back propagation gradients of the first network model and the second network model can be jointly determined based on the target loss function and the first loss parameter, and then the neural network parameters of the first network model and the second network model are adjusted based on the back propagation gradients. The adjustment process is repeated until the first feature map output by the first network model and the second feature map output by the second network model converge the target loss function and also converge the first loss parameter.
[0067] Step S280: using the first network model when the target loss function and the first loss parameter converge as a key point structure prediction model.
[0068] In this embodiment, the first network model when the target loss function and the first loss parameter converge can be used as a key point structure prediction model, so that the face contour structure in the face image can be more accurately predicted through the key point structure prediction model.
[0069] The present application provides a key point recognition model processing method, which realizes constraining the training process of the first network model and the second network model by constructing a target loss function, and then using the first network model when the target loss function converges as the key point structure prediction model, so that the key point structure information and appearance and noise information in the image can be decoupled through the constructed target loss function, and then the key point structure prediction model obtained by training can accurately predict the key point structure of the image. By using the first network model when the target loss function and the first loss parameter converge as the key point structure prediction model, the accuracy of the key point structure prediction model in predicting the key point contour structure of the image can be further improved.
[0070] See also Figure 3 Another embodiment of the present application provides a key point recognition model processing method, the method comprising:
[0071] Step S310: Obtain a feature image corresponding to the sample image.
[0072] Step S320: input the feature image into the first network model and the second network model respectively, and obtain the first feature map output by the first network model, and obtain the second feature map output by the second network model.
[0073] Step S330: Adjust the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge.
[0074] Step S340: Input the first feature map corresponding to the target loss function when it converges into the fully connected layer, and obtain the second loss parameter according to the output of the fully connected layer and the sample image carrying the true value annotation.
[0075] As a method, the first feature map corresponding to the convergence of the target loss function can be input into the fully connected layer, and the key point coordinates in the first feature map output by the first network model when the target loss function converges can be predicted through the fully connected layer. The second loss parameter is obtained according to the output result of the fully connected layer and the sample image with the true value annotation, wherein the sample image can be manually annotated with the true value in advance, and the second loss parameter can be the Wing loss loss parameter. The calculation formula of the second loss parameter is as follows:
[0076]
[0077] Among them, x represents the difference between the coordinates of the output result of the fully connected layer and the coordinates of the sample image carrying the true value annotation, C represents the segmented position of the loss degree of the second loss parameter, C is a constant, wing(x) represents the Wing loss parameter, ω and ε represent hyperparameters, and the values of ω and ε can be adjusted according to actual conditions.
[0078] Optionally, the coordinates of key points in the first feature map output by the first network model when the target loss function converges can be predicted by generating a heat map, or other forms of predicting key points can be used to predict the coordinates of key points in the first feature map output by the first network model when the target loss function converges. The specific implementation method can be adjusted according to actual needs.
[0079] Step S350: adjusting the parameters of the first network model according to the second loss parameter.
[0080] In this embodiment, the back propagation gradient of the first network model can be determined based on the target loss function and the second loss parameter, and then the neural network parameters of the first network model can be adjusted based on the back propagation gradient. The adjustment process is repeated until the first feature map output by the first network model converges the target loss function and also converges the second loss parameter.
[0081] Step S360: using the first network model when the target loss function and the second loss parameter converge as a key point structure prediction model.
[0082] In this embodiment, the first network model when the target loss function and the second loss parameter converge can be used as a key point structure prediction model, so that the face contour structure in the face image can be more accurately predicted through the key point structure prediction model.
[0083] As a method, after the first network model when the target loss function and the second loss parameter converge as the key point structure prediction model, the second network model when the target loss function converges can also be separated, so as to obtain a key point structure prediction model that can be used to specifically predict the key points of the facial contour structure. Optionally, in some other embodiments of the present application, after the first network model when the target loss function converges as the key point structure prediction model, the second network model when the target loss function converges can be separated; or after the first network model when the target loss function and the first loss parameter converge as the key point structure prediction model, the second network model when the target loss function converges can be separated; or after the first network model when the target loss function, the first loss parameter and the second loss parameter converge as the key point structure prediction model, the second network model when the target loss function converges can be separated. The specific separation time can be adjusted according to the training standard of the constructed model.
[0084] As an implementation mode, the present application can also adjust the parameters of the first network model and the second network model in combination with the target loss function, the first loss parameter, and the second loss parameter described in the aforementioned embodiment, which is described in detail below in combination with the accompanying drawings:
[0085] See also Figure 4 , shows a schematic diagram of a training network structure for training the first network model and the second network model provided by the present application, such as Figure 4 As shown, after the sample image is input into the convolutional neural network, a feature image output by the convolutional neural network can be obtained, and the feature image is respectively input into the first network model and the second network model, and the first feature map output by the first network model is obtained, and the second feature map output by the second network model is obtained. According to the first feature map, the second feature map and the target loss function, the parameters of the first network model and the second network model are adjusted respectively until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge, and the first feature map output by the first network model and the second feature map output by the second network model make the target loss function (i.e. Figure 4 The first feature map obtained when the loss in the convergence is used as the key point structure feature map, and the second feature map obtained at this time is used as the noise feature map; according to the key point structure feature map, the noise feature map and the feature image, a reconstructed feature image corresponding to the feature image is obtained. Specifically, the reconstructed feature image (i.e., Figure 4 Add in, obtain the first loss parameter (i.e. Figure 4 L2Loss in , adjust the parameters of the first network model and the second network model according to the first loss parameter; input the first feature map corresponding to the convergence of the target loss function into the fully connected layer, and obtain the second loss parameter (i.e. Figure 4 Wing Loss in, adjust the parameters of the first network model according to the second loss parameter, and use the first feature map output by the first network model and the second feature map output by the second network model to make the first network model when the target loss function, the first loss parameter and the second loss parameter converge as the key point structure prediction model.
[0086] After obtaining the target loss function, the first loss parameter and the second loss parameter, the parameters of the first network model and the second network model can be adjusted according to the target loss function, the first loss parameter and the second loss parameter. Specifically, for example, the back propagation gradients of the first network model and the second network model can be determined according to the target loss function, the first loss parameter and the second loss parameter, and then the neural network parameters of the first network model and the second network model can be adjusted according to the back propagation gradients. The adjustment process is repeated until the first feature map output by the first network model and the second feature map output by the second network model converge the target loss function and also converge the first loss parameter and the second loss parameter.
[0087] It should be noted that the three types of loss parameters in this application can be used to adjust the neural network parameters of the first network model and the second network model during training, as well as the network parameters of the convolutional neural network and the fully connected layer. For example, in a specific application scenario, Figure 5 As shown by the dotted line in the middle, the second loss parameter can be used to determine the back propagation gradient of the fully connected layer, and the network parameters of the fully connected layer can be adjusted according to the back propagation gradient; and can be used to determine the back propagation gradient of the convolutional neural network, and the network parameters of the convolutional neural network can be adjusted according to the back propagation gradient. When the same loss parameter acts on different network models, the corresponding back propagation gradients can be different.
[0088] A key point recognition model processing method provided in an embodiment of the present application realizes constraining the training process of the first network model and the second network model by constructing a target loss function, and then using the first network model when the target loss function converges as a key point structure prediction model, so that the key point structure information and appearance and noise information in the image can be decoupled through the constructed target loss function, and then the key point structure prediction model obtained through training can accurately predict the key point structure of the image. By using the first network model when the target loss function and the second loss parameter converge as the key point structure prediction model, the accuracy of the key point structure prediction model in predicting the key point contour structure of the image can be further improved.
[0089] See also Figure 6 Another embodiment of the present application provides a key point identification method, the method comprising:
[0090] Step S410: Acquire an image to be recognized.
[0091] In this embodiment, the image to be identified may be a face image for which facial contour key points prediction is to be performed, for example, the image to be identified may be a face picture including a complete face. The image to be identified may be a frontal face image or a side face image.
[0092] Step S420: inputting the image to be identified into a target key point recognition model, wherein the target key point recognition model includes a key point structure prediction model trained by the aforementioned method, so as to predict the key point structure information in the image to be identified through the key point structure prediction model.
[0093] The key point structure prediction model in this embodiment has the ability to accurately predict the key point structure information in the image to be recognized. The target key point recognition model can also include a convolutional neural network and a fully connected layer, such as Figure 7 As shown, a schematic diagram of the reasoning process of the target key point recognition model provided by the embodiment of the present application for identifying the key points of the contour structure in the image to be recognized is shown. Figure 7 As shown, after the image to be recognized is input into the convolutional neural network, the feature image output by the convolutional neural network can be obtained, and then the feature image is input into the key point structure prediction model to obtain the key point structure feature map output by the key point structure prediction model, and then the key point structure feature map is input into the fully connected layer, and then the key point coordinates output by the fully connected layer are obtained.
[0094] It should be noted that the key point coordinates here are the key point coordinates of the contour structure in the image to be recognized. For example, if the image to be recognized is a face image, then the key point coordinates are the key point coordinates of the contour structure of the face, such as Figure 8FIG. 1 is a schematic diagram showing the position of the key point coordinates extracted in this embodiment. Figure 8 The numbers in represent the order of the key point coordinates and also represent the positions of the key point coordinates. Figure 8 The key point coordinates shown in are the coordinates corresponding to key points 0 to 32 (the specific coordinates are not shown in the figure).
[0095] Step S430: using the image output by the key point structure prediction model as a target image, wherein the target image includes a key point structure.
[0096] Among them, the key point structure is the coordinates of the key points of the contour.
[0097] The embodiment of the present application provides a key point recognition method, which comprises the following steps: obtaining an image to be recognized; inputting the image to be recognized into a target key point recognition model, wherein the target key point recognition model includes a key point structure prediction model trained by the aforementioned method, so as to predict the key point structure information in the image to be recognized through the key point structure prediction model; and using the image output by the key point structure prediction model as a target image, wherein the target image includes a key point structure. The key point structure prediction model in the present method is more lightweight than a key point prediction model for predicting the key points of the entire face, which reduces the model parameter amount and the amount of calculation, thereby improving the prediction rate.
[0098] See also Fig. 9 , an embodiment of the present application provides a key point recognition model processing device 500, the device 500 comprising:
[0099] The feature image acquisition module 510 is used to acquire the feature image corresponding to the sample image.
[0100] As a method, the feature image acquisition module 510 can be used to input the sample image into the convolutional neural network to obtain the feature image output by the convolutional neural network.
[0101] The feature image processing module 520 is used to input the feature image into the first network model and the second network model respectively, and obtain the first feature map output by the first network model, and obtain the second feature map output by the second network model. The first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image.
[0102] The processing module 530 is used to adjust the parameters of the first network model and the second network model according to the first feature map, the second feature map and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge.
[0103] In this implementation, the target loss function includes:
[0104] Loss = Min(min||Noise feat|| * +λ||Struct feat|| 2,1 )
[0105] Wherein, the loss represents the target loss function, the Struct feat represents the first feature map, the Noise feat represents the second feature map, and the ||Noise feat|| * Characterizes the nuclear norm of the second feature map, the min||Noise feat|| * Characterizes the minimization of the nuclear norm of the second feature map, the λ||Struct feat|| 2,1 The 21-norm represents the first feature map, and the λ represents a weight parameter value.
[0106] The model acquisition module 540 is used to use the first network model when the target loss function converges as the key point structure prediction model.
[0107] Optionally, the device 500 may also include a parameter adjustment module. In one embodiment, the parameter adjustment module may be used to obtain the first feature map output by the first network model as the key point structure feature map, and obtain the second feature map output by the second network model as the noise feature map when the target loss function converges, before using the first network model when the target loss function converges as the key point structure prediction model; obtain a reconstructed feature image corresponding to the feature image based on the key point structure feature map, the noise feature map and the feature image; obtain a first loss parameter based on the reconstructed feature image and the feature image; and adjust the parameters of the first network model and the second network model based on the first loss parameter. In this manner, the model acquisition module 540 may be used to use the first network model when the target loss function and the first loss parameter converge as the key point structure prediction model.
[0108] In another embodiment, the parameter adjustment module can be used to input the first feature map corresponding to the target loss function when it converges into the fully connected layer before using the first network model when the target loss function converges as the key point structure prediction model, and obtain the second loss parameter according to the output of the fully connected layer and the sample image carrying the true value annotation; and adjust the parameters of the first network model according to the second loss parameter. In this way, the model acquisition module 540 can be used to use the first network model when the target loss function and the second loss parameter converge as the key point structure prediction model.
[0109] In another embodiment, the parameter adjustment module can be used to obtain the first feature map output by the first network model as the key point structure feature map when the target loss function converges, and obtain the second feature map output by the second network model as the noise feature map before using the first network model when the target loss function converges as the key point structure prediction model; obtain the reconstructed feature image corresponding to the feature image according to the key point structure feature map, the noise feature map and the feature image; obtain the first loss parameter according to the reconstructed feature image and the feature image; adjust the parameters of the first network model and the second network model according to the first loss parameter. And input the first feature map corresponding to the convergence of the target loss function into the fully connected layer, obtain the second loss parameter according to the output of the fully connected layer and the sample image carrying the true value annotation; adjust the parameters of the first network model according to the second loss parameter. In this way, the model acquisition module 540 can be used to use the first network model when the target loss function, the first loss parameter and the second loss parameter converge as the key point structure prediction model.
[0110] Optionally, the device 500 may also include a model separation module, which is used to separate the second network model when the target loss function converges after the first network model when the target loss function converges is used as the key point structure prediction model; or used to separate the second network model when the target loss function and the first loss parameter converge as the key point structure prediction model; or used to separate the second network model when the target loss function converges after the first network model when the target loss function and the second loss parameter converge as the key point structure prediction model; or used to separate the second network model when the target loss function converges after the first network model when the target loss function, the first loss parameter and the second loss parameter converge as the key point structure prediction model.
[0111] See also Fig.10, an embodiment of the present application provides a key point identification device 600, the device 600 comprising:
[0112] The image acquisition unit 610 is used to acquire an image to be recognized.
[0113] The information prediction unit 620 is used to input the image to be identified into a target key point recognition model, wherein the target key point recognition model includes a key point structure prediction model trained by the aforementioned method, so as to predict the key point structure information in the image to be identified through the key point structure prediction model.
[0114] The key point recognition unit 630 is used to use the image output by the target key point recognition model as a target image, wherein the target image includes the target key points.
[0115] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0116] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.
[0117] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0118] See also Fig.11 Based on the above input method and device, the embodiment of the present application also provides an electronic device 100 that can execute the above input method. The electronic device 100 includes a memory 102 and one or more (only one is shown in the figure) processors 104 coupled to each other, and the memory 102 and the processor 104 are connected by a communication line. The memory 102 stores a program that can execute the content of the above embodiment, and the processor 104 can execute the program stored in the memory 102.
[0119] Among them, the processor 104 may include one or more processing cores. The processor 104 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 102, and calling data stored in the memory 102. Optionally, the processor 104 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 104 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 104, but may be implemented separately through a communication chip.
[0120] The memory 102 may include a random access memory (RAM) or a read-only memory (ROM). The memory 102 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 102 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the aforementioned embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the electronic device 100 during use.
[0121] Please refer to Fig.12 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 700 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0122] The computer readable storage medium 700 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program code 710 that performs any method step of the above method. These program codes can be read from or written to one or more computer program products. The program code 710 can be compressed, for example, in an appropriate form.
[0123] In summary, the present application provides a key point recognition model processing method, a key point recognition method and device, an apparatus, an electronic device and a storage medium, which obtains a feature image corresponding to a sample image; inputs the feature image into a first network model and a second network model respectively, and obtains a first feature map output by the first network model, and obtains a second feature map output by the second network model, wherein the first network model is used to predict the key point structure information in the feature image, and the second network model is used to predict the appearance and noise information in the feature image; according to the first feature map, the second feature map and the target loss function, the parameters of the first network model and the second network model are adjusted respectively until the first feature map output by the first network model and the second feature map output by the second network model converge the target loss function; and the first network model when the target loss function converges is used as the key point structure prediction model. In the above manner, it is achieved that the training process of the first network model and the second network model is constrained by constructing a target loss function, and then the first network model when the target loss function converges is used as the key point structure prediction model, so that the key point structure information and appearance and noise information in the image can be decoupled through the constructed target loss function, and then the key point structure prediction model obtained by training can be used to accurately predict the key point structure of the image.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A key point recognition model processing method, characterized in that: The method comprises: Obtain the feature image corresponding to the sample image; Inputting the feature image into a first network model and a second network model respectively, and obtaining a first feature map output by the first network model and a second feature map output by the second network model, wherein the first network model is used to predict key point structure information in the feature image, and the second network model is used to predict appearance and noise information in the feature image; Adjusting parameters of the first network model and the second network model respectively according to the first feature map, the second feature map, and the target loss function until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge; When the target loss function converges, obtaining a first feature map output by the first network model as a key point structure feature map, and obtaining a second feature map output by the second network model as a noise feature map; Acquire a reconstructed feature image corresponding to the feature image according to the key point structure feature map, the noise feature map, and the feature image; Obtaining a first loss parameter according to the reconstructed feature image and the feature image; Adjusting parameters of the first network model and the second network model according to the first loss parameter; The first network model when the target loss function converges is used as the key point structure prediction model. The first network model when the target loss function converges is used as the key point structure prediction model, including: using the first network model when the target loss function and the first loss parameter converge as the key point structure prediction model.
2. The method according to claim 1, characterized in that Before using the first network model when the target loss function converges as the key point structure prediction model, the method further includes: Inputting the first feature map corresponding to the convergence of the target loss function into a fully connected layer, and obtaining a second loss parameter according to the output of the fully connected layer and the sample image carrying the true value annotation; Adjusting parameters of the first network model according to the second loss parameter; The method of using the first network model when the target loss function converges as the key point structure prediction model includes: The first network model when the target loss function and the second loss parameter converge is used as a key point structure prediction model.
3. The method according to claim 2, characterized in that The acquiring of a feature image corresponding to the sample image includes: Inputting a sample image into a convolutional neural network to obtain a feature image output by the convolutional neural network; After using the first network model when the target loss function converges as the key point structure prediction model, the method further includes: Separate the second network model when the target loss function converges.
4. The method according to any one of claims 1 to 3, characterized in that The objective loss function includes: Loss=Min(min||Noise feat|| * +λ||Struct feat|| 2,1 ) Wherein, the loss represents the target loss function, the Struct feat represents the first feature map, the Noise feat represents the second feature map, and the ||Noise feat|| * Characterizing the nuclear norm of the second feature map, the min||Noise feat|| * Characterizes the minimization of the nuclear norm of the second feature map, the λ||Struct feat|| 2,1 The 21-norm represents the first feature map, and the λ represents the weight parameter value.
5. A key point identification method, characterized in that: The method comprises: Obtain the image to be recognized; Inputting the image to be identified into a target key point recognition model, wherein the target key point recognition model includes a key point structure prediction model trained by the method according to any one of claims 1 to 4, so as to predict key point structure information in the image to be identified by the key point structure prediction model; The image output by the key point structure prediction model is used as a target image, wherein the target image includes a key point structure.
6. A key point recognition model processing device, characterized in that: The device comprises: A feature image acquisition module is used to acquire a feature image corresponding to a sample image; a feature image processing module, configured to input the feature image into a first network model and a second network model, respectively, and obtain a first feature map output by the first network model, and obtain a second feature map output by the second network model, wherein the first network model is used to predict key point structure information in the feature image, and the second network model is used to predict appearance and noise information in the feature image; a processing module, configured to adjust parameters of the first network model and the second network model respectively according to the first feature map, the second feature map, and the target loss function, until the first feature map output by the first network model and the second feature map output by the second network model make the target loss function converge; a parameter adjustment module, configured to, when the target loss function converges, obtain a first feature map output by the first network model as a key point structure feature map, and obtain a second feature map output by the second network model as a noise feature map; Acquire a reconstructed feature image corresponding to the feature image according to the key point structure feature map, the noise feature map, and the feature image; Obtaining a first loss parameter according to the reconstructed feature image and the feature image; Adjusting parameters of the first network model and the second network model according to the first loss parameter; A model acquisition module is used to use the first network model when the target loss function converges as a key point structure prediction model. The first network model when the target loss function converges as a key point structure prediction model includes: using the first network model when the target loss function and the first loss parameter converge as a key point structure prediction model.
7. A key point recognition device, characterized in that: The device comprises: An image acquisition unit, configured to acquire an image to be recognized; an information prediction unit, configured to input the image to be identified into a target key point recognition model, wherein the target key point recognition model includes a key point structure prediction model trained by the method according to any one of claims 1 to 4, so as to predict key point structure information in the image to be identified by using the key point structure prediction model; A key point recognition unit is used to use the image output by the target key point recognition model as a target image, wherein the target image includes the target key points.
8. An electronic device, characterized in that: including one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method of any one of claims 1 to 4 or 5.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores program code, wherein when the program code is executed by a processor, the method according to any one of claims 1 to 4 or 5 is executed.
Citation Information
Patent Citations
Method and device for detecting image, equipment and storage medium
CN110428399A
