Contents of the invention
The purpose of the present application is to provide a throat positioning model training method, device, electronic device and storage medium to train a throat positioning model that can accurately locate the throat and reduce the time of manual labeling.
First, the application provides a throat positioning model training method for obtaining a throat positioning model, and the method comprises the following steps:
S1. Obtain face datasets based on public datasets;
S2, classifying the face dataset based on the Adam's apple recognition model to obtain a dataset with and without an Adam's apple, and the Adam's apple recognition model is used to analyze whether there is an Adam's apple in the image;
S3, two throat localization models were trained based on the Adam's apple dataset and the Adam's apple dataset, and the output datasets of the two throat localization models were obtained.
S4. obtain the corrected output dataset as a new face dataset;
S5, Repeat Steps S2-S4 to obtain the trained throat localization model.
The throat localization model training method of the present application obtains enough training data based on the public dataset to train the throat localization model, and at the same time, the training process first classifies the face dataset based on the Adam's apple recognition model, so as to train two throat positioning models for throat localization for face images with Adam's apple and face images without Adam's apple, respectively, effectively improves the accuracy of throat positioning; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
the throat localization model training method, wherein the public dataset is a DONE dataset.
The videos or images in the dataset all contain a part that goes down to the shoulder and up to the complete face, and there are a lot of valid data (i.e., images with an exposed throat and a complete face), so it is especially suitable for the throat localization model training method of the present application to train the throat positioning model.
the throat positioning model training method, wherein the elements in the face data set are based on the face key points and throat feature points of the POSTED as training labels.
The throat positioning model training method of the present application combines the key points of the face and the throat feature points as training labels to train the throat positioning model, so that the throat positioning model can use the relationship between the feature points to carry out throat positioning training, so that the throat positioning model can consider the geometric relationship between the facial features and the throat to carry out throat positioning, so as to improve the positioning accuracy of the throat positioning model and reduce the number of training rounds.
the throat localization model training method, wherein the Adam's apple recognition model is a binary classification model and has a fully connected layer for outputting the probability of the existence of the Adam's apple, and the elements in the face data set are classified based on comparing the probability of the existence of the Adam's apple and the size of the preset threshold.
the throat positioning model training method, wherein the throat positioning model is an HRNet V2 model.
the throat localization model training method, wherein the input layer resolution of the HRNet V2 model is 384*512.
the throat positioning model training method, wherein the throat positioning model is output based on a heat map.
In the second aspect, the application also provides a throat positioning model training device for obtaining a throat positioning model, and the device comprises:
the first acquisition module is used for obtaining a face dataset based on a public dataset;
the classification module is used for classifying the face dataset based on the Adam's apple recognition model to obtain a dataset with Adam's apple and a dataset without Adam's apple, and the Adam's apple recognition model is used for analyzing whether there is an Adam's apple in the image;
the training module is used to train two throat localization models based on the Adam's apple dataset and the Adam's apple dataset, and obtain the output datasets of the two throat localization models;
the second acquisition module is used for obtaining the output dataset after correction processing as a new face dataset;
The recurrent module is used to repeatedly trigger the operation of the control classification module, the training module and the second acquisition module to obtain the trained throat positioning model.
The throat positioning model training device of the present application obtains enough training data based on the public dataset to train the throat localization model, and at the same time, the training process first classifies the face dataset based on the Adam's apple recognition model to train two throat positioning models for throat localization for face images with Adam's apple and face images without Adam's apple, respectively, effectively improves the accuracy of throat positioning; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
Third, the application also provides an electronic device, comprising a processor and a memory in which a computer-readable instruction is stored, and when the computer-readable instruction is executed by the processor, a step in the method provided in the first aspect is run.
Fourth, the application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it runs the steps in the method provided in the first aspect.
From the above, it can be seen that the present application provides a throat positioning model training method, device, electronic equipment and storage medium, wherein the throat positioning model training method of the present application obtains enough training data based on the public dataset to train the throat positioning model, and at the same time, the training process first classifies the face dataset based on the Adam's apple recognition model, so as to train two throat positioning models for throat positioning for face images with Adam's apple and face images without Adam's apple, respectively, effectively improves the accuracy of throat positioning; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
The specific embodiment
The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only part of the embodiments of the present application, not all embodiments. The components of the embodiment of the present application, which are normally described and shown in the drawings herein, may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed application, but merely indicates the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by a person skilled in the art without creative work fall within the scope of protection of the present application.
It should be noted that similar designations and letters indicate similar terms in the drawings below, so that once an item is defined in a drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present application, the terms "first", "second", etc., are only used to distinguish the description and cannot be construed as indicating or implying relative importance.
First, please refer to Figure 1, some embodiments of the present application provide a throat positioning model training method for obtaining a throat positioning model, the method comprises the following steps:
S1. Obtain face datasets based on public datasets;
S2, the face dataset was classified based on the Adam's apple recognition model to obtain the dataset with and without Adam's apple, and the Adam's apple recognition model was used to analyze whether there was an Adam's apple in the image.
S3, two throat localization models were trained based on the Adam's apple dataset and the Adam's apple dataset, and the output datasets of the two throat localization models were obtained.
S4. obtain the corrected output dataset as a new face dataset;
S5, Repeat Steps S2-S4 to obtain the trained throat localization model.
Specifically, the public dataset is a public image dataset, and in the embodiment of the present application, a dataset that can be directly obtained from the Internet is preferred, and the throat positioning model training method of the embodiment of the present application is based on the public dataset to train the throat positioning model with sufficient training data for training.
More specifically, the face dataset is a dataset composed of images suitable for throat positioning model training, and the elements in the face dataset are preferably images that contain the complete face and neck.
More specifically, the Adam's apple recognition model is a pre-trained or preliminarily trained recognition model, which can be used to distinguish whether there is an Adam's apple in the elements (images) in the face dataset, so as to classify the elements into the dataset with or without Adam's apple according to the classification results; Therefore, the throat positioning model training method of the embodiment of the present application classifies the face dataset based on the Adam's apple recognition model to obtain a dataset with Adam's apple and a dataset without Adam's apple, and then trains the throat positioning model based on the two datasets respectively, so that the two throat positioning models obtained after the final training can respectively locate the throat for the face image with the Adam's apple and the face image without the Adam's apple, and the training mode can effectively reduce the amount of data required for the training of the throat localization model and improve the positioning accuracy of the throat positioning model。
It should be noted that the two throat positioning models trained and obtained by the throat positioning model training method of the embodiment of the present application should be used in combination with the Adam's apple recognition model, that is, in the actual use process, the throat positioning model needs to first use the Adam's apple recognition model to classify the collected images, and then select an appropriate throat positioning model for throat positioning.
More specifically, the throat localization model is a neural network model, in the embodiment of the present application, it belongs to a learning model that generates throat positioning information on the image according to the input image, the throat positioning information may be a feature point or a heat map, etc., the throat localization model can be trained by the training method of a commonly used learning model, such as adding a throat landmark point as a label to the throat position in the elements in the Adam's apple dataset and the non-Adam's apple dataset to train the throat positioning model; wherein the image in the Adam's apple dataset takes the most protruding place at the Adam's apple as the throat feature point, and the image in the Adam's apple dataset takes the center point of the throat position as the throat feature point。
More specifically, step S3 is a training process or a throat positioning process for two throat positioning models based on a dataset with Adam's apple and a dataset without Adam's apple, and in order to improve the positioning accuracy of the throat positioning model, multiple training or throat positioning needs to be carried out for parameter fine-tuning, so step S4 needs to be executed to determine the face dataset required for the next stage of training, and the next stage of training is executed based on step S5.
More specifically, in the implementation of the present application, in the training process of step S3, the throat positioning model performs throat positioning on the images in the corresponding dataset and generates throat positioning information on the corresponding images, and these images with throat positioning information are the output data of the throat positioning model, and these output data constitute an output data set; the throat positioning model training method of the embodiment of the present application is designed to repeatedly train the throat positioning model by using the throat positioning information in these output datasets as a new label, but the positioning accuracy of the throat positioning model that has not yet been trained is slightly lackingIf step S5 directly uses these output datasets to repeatedly train the throat positioning model to fine-tune the network parameters of the throat positioning model, it is not conducive to the convergence of the throat positioning model, so the throat positioning model training method of the embodiment of the present application takes the modified output dataset as a new face dataset, wherein the label of the new face dataset is the throat positioning information output by the throat positioning model in step S3.
More specifically, the correction processing of the output dataset is to remove the throat positioning information in the image with a large deviation of the throat positioning information or the throat positioning information in the image with a large deviation from the correction of the throat positioning information, preferably by adopting the removal method, and the correction process can be performed manually or based on the software comparison of the relationship between the original label and the throat positioning information.
More specifically, before the step S2 recognizes based on the new face dataset generated by step S4, a new image can be introduced based on step S1 to enrich the corresponding face dataset, so as to ensure that the data volume of the face dataset is sufficient; in the embodiment of the present application, the images in the face dataset obtained by the public dataset have been labeled at the throat position based on the labeling tool; in this processing mode, the images in the new face dataset do not need to be manually labeled, and to the throat positioning model, it is equivalent to a new image that has been labeledTherefore, the new face dataset generated based on step S4 can greatly reduce the image annotation time by repeating the training of the throat localization model, thereby greatly improving the training efficiency of the throat positioning model.
The throat positioning model training method of the embodiment of the present application obtains enough training data based on the public dataset to train the throat positioning model, and at the same time, the training process first classifies the face dataset based on the Adam's apple recognition model to train two throat positioning models that are respectively used for throat positioning for face images with Adam's apple and face images without Adam's apple, effectively improves the accuracy of throat positioning; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
More specifically, in general, the throat positioning model training method of the embodiment of the present application generally performs a step S5, that is, the throat localization model is trained in a round of secondary training with a new face dataset, so that the training of the throat positioning model can be completed.
Among some preferred embodiments, the public dataset is the FAKE dataset.
Specifically, the FADID (Face Alignment Dataset used In Driving) is a key data set of faces in the car, which is a benchmark dataset established in the FLD (daylight fluorescent) environment and real driving situations, including changes in posture (maximum pitch 45 degrees, roll and roll 30 degrees), various changes in lighting (front, left, right and back) and the partial occlusion caused by the use of a near-infrared camera hair or sunglasses, the video or image in the dataset contains a part that goes down to the shoulder and up to the complete face, and has a large number of valid data (i.e., an image with an exposed throat and a complete face), so it is particularly suitable for the throat positioning model training method of the embodiment of the present application to train the throat positioning model.
It should be noted that in other embodiments, the public dataset may also be a dataset containing key points of faces, such as 300W and 300VW.
In some preferred embodiments, the elements in the face dataset are based on the face key points and throat feature points of FADID as training labels.
Specifically, the elements in the face dataset are images labeled (i.e., labeled with throat feature points) based on throat position, the image itself in FAKE contains 19 face key points, and the throat localization model training method in the embodiment of the present application combines a total of 20 feature points of face key points and throat feature points as training labels to train the throat positioning model, so that the throat positioning model can use the relationship between feature points to carry out throat positioning training, so that the throat positioning model can consider the geometric relationship between the facial features of the face and the throat to carry out throat positioning, so as to improve the positioning accuracy of the throat positioning model and reduce the number of training rounds。
In some preferred embodiments, the Adam's apple recognition model is a binary classification model with a fully connected layer for outputting the probability of the presence of the Adam's apple, and the elements in the face dataset are classified based on comparing the probability of the presence of the Adam's apple with the size of the preset threshold.
Specifically, the Adam's apple recognition model only needs to simply judge whether the person in the image has an Adam's apple, and a lightweight neural network is adopted, so a binary classification model is adopted, and in the embodiment of the present application, the MobileNetV3 model is preferred, and the MobileNetV3 model is a commonly used image classification model, which can be trained based on the image.
More specifically, in the embodiment of the present application, the last output layer of the Adam's apple recognition model is designed as follows: there is only one fully connected layer, and the fully connected layer is used to output the probability of the presence of the Adam's apple, that is, the fully connected layer that outputs the probability of the absence of the Adam's apple is removed, simplifying the structure of the model.
More specifically, step S2 classifies images based on comparing the probability of the presence of the Adam's apple and the size of the preset threshold, wherein the images with the probability of the presence of the Adam's apple greater than or equal to the preset threshold are classified into the dataset with the Adam's apple, and the preset threshold is a judgment value pre-entered by artificially, preferably 0.7 in the embodiment of the present application.
Among some preferred embodiments, the throat localization model is the HRNet V2 model.
Specifically, HRNet is a high-resolution neural network, which is characterized by maintaining the resolution of the feature map during the propagation process of the neural network, and using different feature map fusion methods to output according to the scene when the final output is carried out, among which the existing HRNet The last output layer of the V2 model itself is spliced and connected with the feature map of different resolutions (the low-resolution feature map is upsampled to high resolution) output by the four branches of the previous backbone layer, so the output result combines the spatial information of the four branches, so it has a better effect in the application of feature point detection, so it can accurately carry out the analysis and positioning of throat feature points in the throat positioning model training method of the present application embodiment.
In some preferred embodiments, the input layer resolution of the HRNet V2 model is 384*512.
Specifically, the existing HRNet V2 model is directly applied to the throat positioning method in the throat positioning model training method of the present application embodiment, which has certain defects, and is generally manifested as inaccurate positioning position, which is mainly due to two reasons: first, the output resolution of the HRNet V2 model is low, and the physical distance per unit pixel is large for the feature points on the human face in the corresponding real life, resulting in the difficulty of the HRNet V2 model to accurately locate the feature points, and the second is the existing HRNet The input image of the V2 model needs to be processed into a square image with a resolution of 256*256, and the ROI (region of interest) of the face containing the throat is generally a 3:4 aspect ratio region, and the local image of the throat position may be lost when the input image is processed into a square image; therefore, the throat positioning model training method of the embodiment of the present application modifies the input layer of the HRNet V2 model so that the input layer can input an image with a resolution of 384*512, so that HRNet The V2 model can locate the throat of the image with a resolution of 384*512, which solves the defects of inaccurate feature point positioning caused by the low original resolution and the mismatch of ROI shape, and then improves the positioning accuracy of the throat positioning model.
It should be noted that the elements of the face dataset or the images that actually need to be recognized should be processed as 384*512 images before being input into the throat positioning model.
More specifically, the original HRNet V2 model generally needs to perform two convolution operations on the input image to downsample the input image to 1/4 of the original size, which will cause the loss of image information, and will also affect the throat positioning accuracy of the throat positioning model or the training efficiency of the throat positioning model to a certain extent, so the throat positioning model training method in the embodiment of the present application removes HRNet A conv2d layer and a batchnorm layer in the V2 model reduce the convolution operation, so that the input image is downsampled only once before being transferred to the HRNet In the backbone layer of the V2 model, the network layer structure can effectively reduce the loss of image information, so that the input image retains more information about facial features, and makes the positioning accuracy of the trained throat positioning model higher.
In some preferred embodiments, the throat positioning model is output based on a heat map.
Specifically, since the throat is a human organ that occupies a certain area in the image, the output of the heat map can accurately represent the area where the throat is located.
More specifically, compared with the HRNet V2 model with a size of 256*256 of the original input image, the feature map of the high-resolution channel in the backbone layer of the throat localization model trained by the throat localization model training method of the embodiment of the present application is adjusted from the original 64*64 to 192*256, and the larger the size of the feature map, the more accurate the heat map output.
In some preferred embodiments, since the HRNet V2 model removes a conv2d layer and a batchnorm layer to reduce a convolution operation, the remaining conv2d layer is preferably adjusted from 3*3 to 6* 6. Doubling the size of the convolutional kernel to ensure that it has a large enough receptive field, so that the receptive field of the low-resolution convolutional layer in Stage4 in the backbone layer connected to it can cover the entire input image, and at the same time, the larger convolutional kernel of the Conv2D layer near the input can also reduce the computational cost of the convolutional layer and improve the convolution efficiency.
In some preferred embodiments, step S3 uses the learning rate of 1e-2 for 60 iterative training in the first round of training (i.e., in the process of training based on the face dataset obtained in step S1), and then uses the learning rate of 1e-3 for 30 iterative training.
Second, please refer to Figure 2, some embodiments of the present application also provide a throat positioning model training device for obtaining a throat positioning model, the device comprises:
the first acquisition module 201 is used for obtaining a face dataset based on a public dataset;
the classification module 202 is used to classify the face dataset based on the Adam's apple recognition model to obtain a dataset with and without Adam's apple, and the Adam's apple recognition model is used to analyze whether there is an Adam's apple in the image;
the training module 203 is used for training two throat localization models based on the Adam's apple dataset and the Adam's apple dataset respectively, and obtaining the output datasets of the two throat positioning models;
the second acquisition module 204 is used for obtaining the output dataset after correction processing as a new face dataset;
the cyclic module 205 is used for repeatedly triggering the operation of the control classification module 202, the training module 203 and the second acquisition module 204 to obtain the throat positioning model after training.
The throat localization model training device of the embodiment of the present application obtains enough training data based on the public dataset to train the throat positioning model, and simultaneously, the training process first classifies the face dataset based on the Adam's apple recognition model to train two throat positioning models for throat positioning for face images with Adam's apple and face images without Adam's apple, respectively, effectively improves the accuracy of throat positioning; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
In some preferred embodiments, the throat positioning model training device of the embodiment of the present application is used for performing the throat positioning model training method provided in the first aspect.
Thirdly, please refer to Figure 3, some embodiments of the present application also provide a schematic diagram of the structure of an electronic device, the present application provides an electronic device, comprising: a processor 301 and a memory 302, a processor 301 and a memory 302 through a communication bus 303 and/ or other forms of connecting mechanisms (not indicated) are interconnected and communicate with each other, the memory 302 stores executable computer-readable instructions of the processor 301, and when the electronic device is running, the processor 301 executes the computer-readable instructions to execute the method in any of the optional embodiments of the above embodiment when executed.
Fourth, the embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, executes a method in any of the optional embodiments of the above embodiment. Among them, computer-readable storage media can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, disk or optical disc.
In summary, the embodiment of the present application provides a throat positioning model training method, device, electronic equipment and storage medium, wherein the throat positioning model training method of the embodiment of the present application obtains enough training data based on the public dataset to train the throat positioning model, and simultaneously, the training process first classifies the face dataset based on the Adam's apple recognition model to train two throat positioning models for throat positioning for face images with Adam's apple and face images without Adam's apple, so that the accuracy of throat positioning is effectively improved; The new face dataset derived from the output dataset of the throat positioning model was used to continue the training of the throat positioning model, which effectively reduced the time of manual labeling and improved the training efficiency of the throat positioning model.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be realized by other means. The device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be another division mode when the actual implementation is realized, and for example, a plurality of units or components can be combined or can be integrated into another system, or some features can be ignored, or not executed. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be indirect coupling or communication connection through some communication interface, device or unit, which may be in electrical, mechanical or other form.
In addition, the cells described as detached parts may or may not be physically separated, and the parts shown as units may or may not be physical units, i.e., they may be located in one place, or they can be distributed across multiple network units. Some or all of these units can be selected according to actual needs to realize the purpose of the present embodiment.
Furthermore, each functional module in each embodiment of the present application may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
For the purposes of this article, relational terms such as first and second, etc., are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or sequence between those entities or operations.
The foregoing is only an embodiment of the present application and is not intended to limit the scope of protection of the present application, which is subject to various changes and variations for those skilled in the art. Any amendments, equivalent replacements, improvements, etc., made within the spirit and principles of this application shall be included in the scope of protection of this application.