A method for training a wrinkle detection model and related device

Training wrinkle detection models through convolutional neural networks solves the interference problems and recognition inaccuracies in wrinkle detection in the existing technology, achieves fast and accurate wrinkle classification and positioning, and improves detection accuracy.

CN112347843BActive Publication Date: 2024-10-18SHENZHEN SHULIAN TIANXIA INTELLIGENT TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202010989797.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-18
Publication Date
2024-10-18
Estimated Expiration
2040-09-18

AI Technical Summary

Technical Problem

Existing facial wrinkle detection technology is easily interfered by hair, pores, etc., cannot accurately identify wrinkle categories, and the recognition results are inaccurate.

Method used

A convolutional neural network is used to train a wrinkle detection model. By marking the location and category of wrinkles in image samples, the position deviation between the bounding box and the wrinkle location is calculated, and the model parameters are adjusted in reverse to optimize the detection results.

Benefits of technology

Fast and accurate wrinkle classification and positioning are achieved, improving the precision and accuracy of the detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112347843B_ABST
    Figure CN112347843B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention relate to the field of target detection technology, and more particularly to a method for training a wrinkle detection model and a related device. The method calculates the position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area, and the union area, which can better reflect the overlap between the bounding box position and the wrinkle position. On this basis, the position deviation is used to calculate the error between the first label and the detection result, and the model parameters of the preset convolutional neural network are reversely adjusted according to the error, so that the model parameters can be better optimized, so that the obtained wrinkle detection model is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of target detection technology, and in particular to a training wrinkle detection model and related devices. Background Art

[0002] Facial wrinkle detection technology is increasingly being used in multiple fields. For example, in the field of cosmetics research and development, it is necessary to design cosmetic products or recommend corresponding cosmetics to users based on different facial wrinkle features. For another example, in the field of photo beautification effects, it is necessary to perform beautification effects of different degrees based on different facial wrinkles. For another example, in face recognition, facial wrinkles are needed as user features to verify the user's identity.

[0003] The most common facial wrinkle detection technology currently uses the key feature points of the face to segment the wrinkle-concentrated area, and then uses color rules and binarization to process the wrinkle-concentrated area to obtain the wrinkle result. However, it is easily interfered by some factors existing on the face itself, such as hair, large pores, etc. In addition, it can only identify whether there are wrinkles, but not the type of wrinkles. In other words, there is no detailed research on the types of wrinkles. Summary of the invention

[0004] The main technical problem solved by the embodiments of the present invention is to provide a method and related devices for training a wrinkle detection model, wherein the trained wrinkle detection model can directly classify and locate wrinkles quickly and accurately.

[0005] To solve the above technical problems, in a first aspect, an embodiment of the present invention provides a method for training a wrinkle detection model, comprising:

[0006] Obtaining an image sample including a face;

[0007] According to the image sample, a face region image is intercepted, wherein the face region image is annotated with a first label, wherein the first label includes a wrinkle position and a wrinkle category of a wrinkle in the image sample;

[0008] Using the face region image marked with the first label as a training sample, and inputting it into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network, the detection result including a bounding box position corresponding to a wrinkle in the training sample identified by the preset convolutional neural network, a probability that the wrinkle corresponding to the bounding box position belongs to each wrinkle category, and a confidence level corresponding to the bounding box position;

[0009] According to the bounding box position and the wrinkle position, calculating the minimum closure area of ​​the bounding box position and the wrinkle position, and the union area of ​​the bounding box position and the wrinkle position;

[0010] Calculating a position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area, and the union area;

[0011] Calculating an error between the first label and the detection result according to the bounding box position, the wrinkle position, the position deviation, the wrinkle category, the probability, and a confidence level corresponding to the bounding box position;

[0012] According to the error, the model parameters of the preset convolutional neural network are reversely adjusted to obtain a wrinkle detection model.

[0013] In some embodiments, calculating the position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area, and the union area includes:

[0014] Calculating the absolute difference between the minimum closure area and the union area;

[0015] calculating an intersection-over-union ratio between the bounding box position and the wrinkle position, wherein the intersection-over-union ratio is used to provide feedback on the degree of overlap between the bounding box position and the wrinkle position;

[0016] The position deviation is obtained by subtracting a first ratio from the intersection ratio, where the first ratio is a ratio of the absolute difference to the minimum closure area.

[0017] In some embodiments, calculating the error between the first label and the detection result according to the bounding box position, the wrinkle position, the position deviation, the wrinkle category, the probability, and the confidence corresponding to the bounding box position includes:

[0018] The error between the first tag and the detection result is calculated according to the following formula:

[0019]

[0020] Among them, λ coord and λ noobj is the preset weight, M is the number of the preset priori boxes for predicting the wrinkle position, j is the number of the priori boxes, K×K is the number of grids contained in the convolutional feature map extracted by the preset convolutional feature neural network for determining the detection result, i is the number of the grid, (x i ,y i ,w i ,h i ) is the bounding box position, is the wrinkle position, C iis the confidence level corresponding to the bounding box, is the true value of the wrinkle position, p i (c) is the probability, is the true probability, c is the wrinkle category, I ij obj Indicates whether the j-th prior box of the i-th grid is responsible for wrinkles, I ij noobj Indicates whether the jth prior box of the i-th grid is not responsible for wrinkles, where if the position deviation is not 0, then I ij obj =1, I ij noobj is 0, if the position deviation is 0, then I ij obj is 0, I ij noobj is 1.

[0021] In some embodiments, the step of using the face region image marked with the first label as a training sample and inputting it into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network includes:

[0022] Using the face region image marked with the first label as a training sample, inputting the sample into the feature convolution layer of the preset convolutional neural network for feature sampling, so as to obtain a first training feature map and a second training feature map, wherein a first downsampling multiple of the first training feature map relative to the face region image is greater than a second downsampling multiple of the second training feature map relative to the face region image, and the first downsampling multiple is less than 32;

[0023] The first training feature map and the second training feature map are input into the detection convolution layer of the preset convolutional neural network to obtain the detection result of the training sample.

[0024] In some embodiments, before the step of using the face region image marked with the first label as a training sample and inputting it into a feature convolution layer of a preset convolutional neural network for feature sampling to obtain a first training feature map and a second training feature map, the method further includes:

[0025] Performing data augmentation processing on the training samples, wherein the data augmentation processing includes at least one of image translation, rotation, cropping and histogram averaging.

[0026] In some embodiments, the performing data augmentation processing on the training samples includes:

[0027] The face area images in the training samples are traversed, and at least one of the image translation, rotation, cropping and histogram averaging is randomly selected for data augmentation processing on a target face area image, wherein the target face area image is any face area image in the training samples.

[0028] In order to solve the above technical problems, in a second aspect, an embodiment of the present invention provides a method for detecting wrinkles, comprising:

[0029] Obtain the face image to be tested;

[0030] The wrinkle detection model as described in the first aspect is used to detect the face image to be tested, and wrinkle positions and wrinkle categories of wrinkles in the face image to be tested are obtained.

[0031] In some embodiments, the method of detecting the face image to be tested using the wrinkle detection model as described in the first aspect to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested includes:

[0032] Inputting the face image to be tested into the feature convolution layer in the wrinkle detection model for feature sampling to obtain a first feature map to be tested and a second feature map to be tested, wherein a first downsampling multiple of the first feature map to be tested relative to the face image to be tested is greater than a second downsampling multiple of the second feature map to be tested relative to the face image to be tested, and the second downsampling multiple is less than 32;

[0033] The first feature map to be tested and the second feature map to be tested are input into the detection convolution layer in the wrinkle detection model to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested.

[0034] To solve the above technical problems, in a third aspect, an embodiment of the present invention provides an image processing device, comprising one or more functional modules, and the one or more functional modules are used to cooperate in implementing any one of the implementation methods of the above first aspect or second aspect.

[0035] To solve the above technical problems, in a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable an electronic device to execute the method described in the first aspect and the method described in the second aspect.

[0036] Beneficial effects of the embodiments of the present invention: Different from the prior art, the method for training a wrinkle detection model provided by the embodiments of the present invention obtains an image sample including a face, and based on the image sample, captures a face region image, wherein the face region image is annotated with a first label, wherein the first label includes wrinkle positions and wrinkle categories of wrinkles in the image sample, and the face region image annotated with the first label is used as a training sample and input into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network, wherein the detection result includes a bounding box position corresponding to a wrinkle in the training sample identified by the preset convolutional neural network, the probability that the wrinkle corresponding to the bounding box position belongs to each wrinkle category, and The confidence corresponding to the bounding box position is calculated, and according to the bounding box position and the wrinkle position, the minimum closure area of ​​the bounding box position and the wrinkle position and the union area of ​​the bounding box position and the wrinkle position are calculated. Then, according to the bounding box position, the wrinkle position, the minimum closure area and the union area, the position deviation between the bounding box position and the wrinkle position is calculated. According to the bounding box position, the wrinkle position, the position deviation, the wrinkle category, the probability and the confidence corresponding to the bounding box position, the error between the first label and the detection result is calculated. Finally, according to the error, the model parameters of the preset convolutional neural network are reversely adjusted to obtain a wrinkle detection model.

[0037] That is, the method calculates the position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area and the union area, which can better reflect the overlap between the bounding box position and the wrinkle position. On this basis, the position deviation is used to calculate the error between the first label and the detection result, and the model parameters of the preset convolutional neural network are reversely adjusted according to the error, so that the model parameters can be better optimized, so that the wrinkle detection model obtained is more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0039] Figure 1 A schematic diagram of an operating environment of a method for training a wrinkle detection model provided by an embodiment of the present invention;

[0040] Figure 2 A schematic flow chart of a method for training a wrinkle detection model provided by one embodiment of the present invention;

[0041] Figure 3 for Figure 2 The method shown can capture the schematic diagram of the face area image;

[0042] Figure 4 for Figure 2 A schematic diagram of a training sample annotated with a first label in the illustrated method;

[0043] Figure 5 for Figure 2 Schematic diagram of wrinkle locations, bounding boxes, and minimum closure areas in the illustrated method;

[0044] Figure 6 for Figure 2 A schematic diagram of a sub-process of step S25 in the method shown;

[0045] Figure 7 for Figure 2 A schematic diagram of a sub-process of step S23 in the method shown;

[0046] Figure 8 A schematic diagram of a data enhancement process provided by one embodiment of the present invention;

[0047] Fig. 9 A schematic flow chart of a wrinkle detection method provided by one embodiment of the present invention;

[0048] Fig.10 for Fig. 9 Schematic diagram of wrinkle categories and wrinkle locations detected in the illustrated method;

[0049] Fig.11 for Fig. 9 A schematic diagram of a sub-process of step S32 in the method shown. DETAILED DESCRIPTION

[0050] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.

[0053] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0054] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0055] Figure 1 Schematic diagram of the operating environment of the method for training a wrinkle detection model provided by an embodiment of the present invention. Figure 1 , including an electronic device 10 and an image acquisition device 20, wherein the electronic device 10 and the image acquisition device 20 are communicatively connected.

[0056] The communication connection can be a wired connection, such as a fiber optic cable, or a wireless communication connection, such as a WIFI connection, a Bluetooth connection, a 4G wireless communication connection, a 5G wireless communication connection, and the like.

[0057] The image acquisition device 20 is used to acquire image samples including human faces, and can also be used to acquire facial images to be tested. The image acquisition device 20 can be a terminal capable of capturing images, such as a mobile phone, tablet computer, video recorder or camera with a capturing function.

[0058] The electronic device 10 is a device that can run according to a program and automatically and quickly process massive amounts of data. It is usually composed of a hardware system and a software system, such as a computer, a smart phone, etc. The electronic device 10 can be a local device that is directly connected to the image acquisition device 20; it can also be a cloud device, such as a cloud server, a cloud host, a cloud service platform, a cloud computing platform, etc. The cloud device is connected to the image acquisition device 20 through a network, and the two are connected in communication through a predetermined communication protocol. In some embodiments, the communication protocol can be TCP / IP, NETBEUI, IPX / SPX, etc.

[0059] It is understandable that the image acquisition device 20 and the electronic device 10 may also be integrated together as an integrated device, such as a computer or smart phone with a camera.

[0060] The electronic device 10 receives the image sample including the human face sent by the image acquisition device 20, trains the image sample to obtain a wrinkle detection model, and uses the wrinkle detection model to detect the wrinkle position and category of the human face image to be tested sent by the image acquisition device 20. It can be understood that the training of the wrinkle detection model and the detection of the human face image to be tested can also be performed on different electronic devices.

[0061] The following is a detailed description of the method for training a wrinkle detection model provided by an embodiment of the present invention. Figure 2 , the method S20 includes but is not limited to the following steps:

[0062] S21: Obtain an image sample including a face.

[0063] S22: capturing a face region image according to the image sample, wherein the face region image is annotated with a first label, wherein the first label includes wrinkle positions and wrinkle categories of wrinkles in the image sample.

[0064] S23: Using the face area image marked with the first label as a training sample, and inputting it into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network, wherein the detection result includes a bounding box position corresponding to a wrinkle in the training sample identified by the preset convolutional neural network, a probability that the wrinkle corresponding to the bounding box position belongs to each wrinkle category, and a confidence level corresponding to the bounding box position.

[0065] S24: Calculate, according to the bounding box position and the wrinkle position, the minimum closure area of ​​the bounding box position and the wrinkle position, and the union area of ​​the bounding box position and the wrinkle position.

[0066] S25: Calculating a position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area, and the union area.

[0067] S26: Calculate an error between the first label and the detection result according to the bounding box position, the wrinkle position, the position deviation, the wrinkle category, the probability, and the confidence corresponding to the bounding box position.

[0068] S27: According to the error, reversely adjust the model parameters of the preset convolutional neural network to obtain a wrinkle detection model.

[0069] In this embodiment, the position deviation between the bounding box position and the wrinkle position is calculated based on the bounding box position, the wrinkle position, the minimum closure area, and the union area, which can better reflect the overlap between the bounding box position and the wrinkle position. On this basis, the position deviation is used to calculate the error between the first label and the detection result, and the model parameters of the preset convolutional neural network are reversely adjusted according to the error, so that the model parameters can be better optimized, so that the wrinkle detection model obtained is more accurate.

[0070] Specifically, in step S21, the image sample includes a face and can be obtained by the above-mentioned image acquisition device. For example, the image sample can be a ID photo or a selfie captured by the image acquisition device. It is understandable that the image sample can also be data in an existing open source face database, wherein the open source face database can be a FERET face database, a CMU Multi-PIE face database, or a YALE face database. Here, there is no restriction on the source of the image sample, as long as it includes a face.

[0071] In step S22, the image sample includes a face and a background, wherein the face is the target area for wrinkle detection. In order to reduce the interference of the background on wrinkle detection and reduce the training time of the subsequent algorithm model, only the face area image is intercepted as a sample. Figure 3 As shown, the face frame can be first obtained through the existing dlib toolkit, and then the aspect ratio of the face frame can be adjusted to the aspect ratio of the image sample itself in combination with the aspect ratio of the image sample itself, so that the face area image can be intercepted. The dlib toolkit is a tool for object detection in an image, for example, the dlib toolkit is used for face detection.

[0072] like Figure 4 As shown, the face region image is annotated with a first label, that is, the face region image is labeled. The first label includes the wrinkle position and wrinkle category of the wrinkles in the pattern sample. Figure 4The marked box in is the wrinkle position in the first label. In some embodiments, the wrinkle category is a combination of wrinkle type and severity, and the wrinkle type is used to feedback the type of wrinkle, for example, the wrinkle type includes at least one of forehead wrinkles, glabellar wrinkles, crow's feet or nasolabial folds. The severity is used to feedback the severity of the wrinkle, for example, the severity includes at least one of none, mild, moderate or severe. Thus, the wrinkle category can be subdivided into 16 categories. The wrinkle category is set according to the location of the wrinkle on the face, and one wrinkle position corresponds to one wrinkle category. The wrinkle category and wrinkle position can reflect the aging of the face to assist the user in making targeted relief measures, such as caring for the skin around the eyes, or changing the habit of raising the eyebrows.

[0073] In the step S23, the face area image marked with the first label is used as a training sample and input into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network.

[0074] The training samples are input into a preset convolutional neural network, and the convolutional layers in the preset convolutional neural network will respectively learn the image features of the images in the training samples, such as shape, edge, and category, with a set of initial model parameters. Then, the preset convolutional neural network will predict the wrinkle category and wrinkle position in each image sample, and the preset convolutional neural network outputs the detection results of the training samples. The detection results include the bounding box positions corresponding to the wrinkles in the training samples identified by the preset convolutional neural network, the probabilities that the wrinkles corresponding to the bounding box positions belong to each wrinkle category, and the confidence corresponding to the bounding box positions.

[0075] The bounding box position corresponding to the wrinkle in the training sample refers to the position of the predicted wrinkle in the original image sample. Generally, the bounding box position includes four parameters: the center coordinates (x, y) of the bounding box, the width w of the bounding box, and the height h of the bounding box. The probability that the wrinkle corresponding to the bounding box position belongs to each wrinkle category refers to the probability that the wrinkle framed by the bounding box in the image sample belongs to a certain wrinkle category. For example, the probability that the wrinkle framed by the bounding box in the image sample is a forehead wrinkle is 0.9. The confidence corresponding to the bounding box position refers to the probability that there is a wrinkle in the bounding box and the degree to which the bounding box is close to the real wrinkle position, that is, the confidence, on the one hand, reflects the probability that the area framed by the bounding box in the original image sample is not the background, and the background is the area in the original image sample that is not a wrinkle. On the other hand, when the area framed by the bounding box in the original image sample includes wrinkles, it reflects the credibility of the bounding box as the real wrinkle position (real box).

[0076] In step S24, based on the bounding box position and the wrinkle position, the minimum enclosed area of ​​the bounding box position and the wrinkle position, and the union area of ​​the bounding box position and the wrinkle position are calculated.

[0077] The wrinkle position is taken as the real frame, and the minimum enclosed area refers to the area of ​​the smallest rectangular frame that can frame the boundary frame and the real frame. Figure 5 As shown, the real box corresponding to the wrinkle position is box A (solid line), there is a wrinkle c in box A, the boundary box is box B (dashed line), and the minimum rectangular box that can frame the boundary box B and the real box A is box D (solid line bold), therefore, the minimum enclosed area is the area of ​​box D.

[0078] The union area of ​​the bounding box position and the wrinkle position refers to the area U of the union area of ​​the bounding box and the true box. Figure 5 As shown, the union area is the area corresponding to the union area of ​​the bounding box B and the real box A.

[0079] In step S25, a position deviation between the bounding box position and the wrinkle position is calculated according to the bounding box position, the wrinkle position, the minimum closure area, and the union area.

[0080] The minimum closure area and the union area can reflect the position deviation between the position of the bounding box and the position of the wrinkle, and the position deviation is the degree of overlap between the bounding box and the position of the wrinkle. For example, in the above example, the area of ​​box D and the union area U can reflect the position deviation between the bounding box B and the real box B. If the area (minimum closure area) and the union area U of box D are larger, it means that the overlap between the bounding box B and the real box A is smaller, and the position deviation is larger. If the area (minimum closure area) and the union area U of box D are smaller, it means that the overlap between the bounding box B and the real box A is larger, and the position deviation is smaller.

[0081] Therefore, a mathematical model may be established according to the bounding box position, the wrinkle position, the minimum closure area, and the union area to calculate the position deviation between the bounding box position and the wrinkle position.

[0082] In step S26, the error between the first label and the detection result is calculated according to the bounding box position, the wrinkle position, the position deviation, the wrinkle category, the probability, and the confidence corresponding to the bounding box position.

[0083] The position error between the position of the bounding box in the detection result and the wrinkle position in the first label can be reflected by the bounding box position and the wrinkle position, the wrinkle category and the probability can reflect the category error between the wrinkle category in the detection result and the wrinkle category in the first label, and the confidence corresponding to the bounding box position and the position deviation can reflect the confidence degree of the bounding box in the detection result as the real wrinkle position (real box) and the confidence error between the real value of the wrinkle position in the first label. Therefore, subdividing the error into position error, category error and confidence error can better reflect the detection effect of the preset convolutional neural network model, that is, reflect the loss of the initial model parameters in the preset convolutional neural network model, which is beneficial to the subsequent adjustment of the model parameters according to the error.

[0084] Finally, in step S27, according to the error, the model parameters of the preset convolutional network are adjusted to obtain more accurate image features, thereby improving the accuracy of the wrinkle detection model. The model parameters are convolution kernel parameters, that is, the weight and bias of the convolution kernel.

[0085] In this way, through multiple trainings, errors are obtained, model parameters are adjusted, and new wrinkle detection models are iteratively generated until the errors converge and fluctuate within a range. The training is stopped, and the model parameters corresponding to the wrinkle detection model with the highest accuracy are selected as the model parameters of the final wrinkle detection model, thereby obtaining a trained wrinkle detection model.

[0086] In this embodiment, the method calculates the position deviation between the bounding box position and the wrinkle position according to the bounding box position, the wrinkle position, the minimum closure area and the union area, which can better reflect the overlap between the bounding box position and the wrinkle position. On this basis, the position deviation is used to calculate the error between the first label and the detection result, and the model parameters of the preset convolutional neural network are reversely adjusted according to the error, so that the model parameters can be better optimized, so that the wrinkle detection model obtained is more accurate.

[0087] In some embodiments, see Figure 6 , the step S25 specifically includes:

[0088] S251: Calculate the absolute difference between the minimum closure area and the union area.

[0089] S252: Calculate an intersection-over-union ratio between the bounding box position and the wrinkle position, where the intersection-over-union ratio is used to provide feedback on the degree of overlap between the bounding box position and the wrinkle position.

[0090] S253: Subtract a first ratio from the intersection ratio to obtain the position deviation, where the first ratio is a ratio of the absolute difference to the minimum closure area.

[0091] The calculation formula of the above intersection-and-union ratio is:

[0092]

[0093] IoU is the intersection over union ratio, A is the area of ​​the wrinkle position, B is the area of ​​the bounding box, and GIoU is the position deviation.

[0094] When the bounding box and the wrinkle position do not overlap at all, the position deviation G is 1. When the bounding box and the wrinkle position do not intersect and are infinitely far apart, the position deviation G takes the minimum value of -1. Thus, the position deviation can reflect not only the degree of overlap between the bounding box and the wrinkle position, but also the degree of non-overlap between the two.

[0095] In this embodiment, the position deviation calculated by the above steps not only takes into account the overlapping area between the bounding box and the wrinkle position (real frame), but also takes into account the non-overlapping area between the bounding box and the wrinkle position. For example, when there is no overlapping area between the bounding box and the wrinkle position, the position deviation is not always 0, but a negative number that can reflect the degree of non-overlapping, thereby better reflecting the degree of overlap between the bounding box and the wrinkle position (real frame).

[0096] In some embodiments, step S26 specifically includes:

[0097] The error between the first tag and the detection result is calculated according to the following formula:

[0098]

[0099] Among them, λ coord and λ noobj is the preset weight, M is the number of the preset priori boxes for predicting the wrinkle position, j is the number of the priori boxes, K×K is the number of grids contained in the convolutional feature map extracted by the preset convolutional feature neural network for determining the detection result, i is the number of the grid, (x i ,y i ,w i ,h i ) is the bounding box position, is the wrinkle position, C i is the confidence level corresponding to the bounding box, is the true value of the wrinkle position, p i (c) is the probability, is the true probability, c is the wrinkle category, I ij objIndicates whether the j-th prior box of the i-th grid is responsible for wrinkles, I ij noobj Indicates whether the jth prior box of the i-th grid is not responsible for wrinkles, where if the position deviation is not 0, then I ij obj =1, I ij noobj is 0, if the position deviation is 0, then I ij obj is 0, I ij noobj is 1.

[0100] In this embodiment, the loss function is the result of integrating position loss, confidence loss and classification loss, wherein the position loss constrains the relationship between the position information (bounding box) of the category output by the preset convolutional neural network and the position information (wrinkle position) in the first label, that is, minimizing the wrinkle position in the first label. The bounding box position (x i ,y i ,w i ,h i ), so that the position information of the category output by the preset convolutional neural network (i.e., the bounding box) continuously approaches the position information of the category annotated by the image sample (wrinkle position) to optimize the model parameters.

[0101] Among them, the classification loss constrains the relationship between the probability of the category output by the preset convolutional neural network and the true probability of the category in the first label, that is, minimizes the error between the true probability of the category in the first label and the probability of the category in the output detection result, so that the probability of the category output by the preset convolutional neural network continues to approach the true probability of the category in the first label to optimize the model parameters.

[0102] The confidence loss constrains the optimization model parameters by whether the grid contains the target (wrinkle). The entire training process is supervised training, so that the detection results output by the preset convolutional neural network continue to approach the first label, thereby reducing the error between the detection result and the first label, so that the model parameters reach the optimal solution to obtain the wrinkle detection model.

[0103] Specifically, the training sample is input into the feature convolution layer in the preset convolutional neural network for feature sampling to obtain at least one feature map. The preset convolutional neural network performs K×K rasterization on the feature map, that is, the feature map is divided into K×K grids, and then the prediction task of the position of a certain object (wrinkle) in the image is assigned to the bounding box of the grid where the center position of the object is located. One grid corresponds to M priori boxes, that is, for one grid, M priori boxes are predicted and output to identify the wrinkle position of the wrinkle in the image area corresponding to the grid. For example, for the forehead wrinkle T in the image sample, it is composed of pixels whose center falls within a certain range of the grid S1, then the preset convolutional neural network searches for all pixels that meet the forehead wrinkle T in a certain size range around the grid S1, that is, the forehead wrinkle T is predicted by the priori box whose center falls on the grid S1. Generally, one grid corresponds to a group of priori boxes, and 3 priori boxes form a group. Each priori box is only responsible for the prediction of wrinkles near the corresponding grid.

[0104] Then, the prior frame is quantized so that the size of the prior frame roughly matches the size ratio of the real frame in the image sample, thereby obtaining the bounding box. Among them, the real frame is the real wrinkle position in the image sample. Since the size of the real frame is diverse, the size of the prior frame is also diverse. Specifically, the K-means algorithm can be used to cluster the width and height of representative shapes (the sizes of the most common real frames in the training samples) in the real frames of all image samples in the training samples, such as flat, tall and thin, and nearly square, etc. The three prior frames in each group of prior frames have different shapes. Each prior frame will generate a bounding box after sliding fine-tuning in the image sample, so that one grid corresponds to three bounding boxes of different sizes.

[0105] Since the three bounding boxes of different sizes can all be responsible for predicting the wrinkles corresponding to the grid, but for a grid, it is necessary to determine the bounding box that best matches the true box for error calculation, and the errors between other bounding boxes and the true box can be appropriately reduced to reduce the error of the preset convolutional neural network and reflect the prediction bias of the preset convolutional neural network. For example, for grid S1, the corresponding wrinkle is a forehead wrinkle, and there are three prior boxes whose centers fall in grid S1, among which the prior box L is closest to the true box ground truth at grid S1. Therefore, the bounding box L' generated by the prior verification box L is used as the predicted value of the true box ground truth and participates in the error calculation. The bounding box M' generated by the prior box M and the bounding box N' generated by the prior box N, which are significantly different from the true box ground truth, are both weighted to reduce interference with the error.

[0106] Specifically, when the position deviation between the bounding box corresponding to the jth prior box of the i-th grid and the true box is not 0, it means that the jth prior box of the i-th grid is responsible for wrinkles (including wrinkles), then Iij obj =1, I ij noobj is 0, then the error between the bounding box corresponding to the jth prior box of the i-th grid and the true box Participate in calculating the error between the first label and the detection result. When the position deviation between the bounding box corresponding to the jth priori box of the i-th grid and the true box is 0, it means that the jth priori box of the i-th grid is not responsible for wrinkles (does not include wrinkles), then I ij obj is 0, I ij noobj is 1, then the error of the bounding box corresponding to the jth prior box of the i-th grid is multiplied by the preset weight λ noobj After (i.e. Then participate in calculating the error between the first label and the detection result, so that the bounding box and the real box participate in error calculation when there is an intersection, perform gradient return, and back propagation, so as to be trained. On the other hand, the bounding box and the real box can also perform gradient return and back propagation with a certain weight when there is no intersection, so as to be trained to improve the accuracy of the wrinkle detection model.

[0107] In some embodiments, see Figure 7 , the step S23 comprises:

[0108] S231: Using a face area image marked with the first label as a training sample, and inputting it into a feature convolution layer of the preset convolutional neural network for feature sampling to obtain a first training feature map and a second training feature map, wherein a first downsampling multiple of the first training feature map relative to the face area image is greater than a second downsampling multiple of the second training feature map relative to the face area image, and the first downsampling multiple is less than 32.

[0109] S232: Input the first training feature map and the second training feature map into the detection convolution layer of the preset convolutional neural network to obtain the detection result of the training sample.

[0110] The training samples are input to the feature convolution layer, and the feature convolution layer performs feature sampling with a set of initial model parameters to obtain a first training feature map and a second training feature map. Both the first training feature map and the second training feature map are reduced in size relative to the original image samples, that is, they are downsampled relative to the original image samples. For example, if the size of the input face area image is 416*416, and after being processed by the feature convolution layer, the size of the obtained training feature map is 13*13, then the downsampling multiple of the training feature map relative to the face area image is 416 / 13=32 times. The larger the downsampling multiple, the smaller the obtained training feature map, and the larger the receptive field of the training feature map, so it is suitable for detecting objects with large size contrast in the face area image.

[0111] Among them, the first downsampling multiple of the first training feature map relative to the face area image is greater than the second downsampling multiple of the second training feature map relative to the face area image, thereby achieving detection of different fine-grainednesses.

[0112] Since the wrinkle area in the face belongs to the medium-sized object area, if the receptive field of the training feature map used is large, it is not conducive to the detection of wrinkles. Therefore, the first downsampling multiple is less than 32. That is, the first training feature map has a medium-sized receptive field, which is suitable for detecting medium-sized objects, such as forehead wrinkles, etc., and the second training feature map has a small-scale receptive field, which is suitable for detecting small-sized objects, such as crow's feet, etc.

[0113] By adopting the first training feature map and the second training feature map of the above two sizes, not only can wrinkles be detected more accurately, but also the redundancy of the bounding box can be reduced. Moreover, compared with adopting 3 or more training feature maps, the model parameters of the feature convolution layer can be simplified, thereby improving the learning efficiency of the preset convolutional neural network.

[0114] In this embodiment, the use of multi-sized training feature maps for detection can eliminate the influence of the spatial dimension and resolution of the image on the detection results. In addition, through the above-mentioned first training feature map and the second training feature map, targets of various sizes can be taken into account, that is, the detection of medium-sized targets (such as forehead wrinkles) and the detection of small-sized targets (such as crow's feet) can be met, the detection accuracy is high, and the redundancy of the bounding box can be reduced, so that the learning efficiency of the preset convolutional neural network is high.

[0115] In some embodiments, see Figure 8 , before step S23, further comprising:

[0116] S28: Performing data augmentation processing on the training samples, wherein the data augmentation processing includes at least one of image translation, rotation, cropping and histogram averaging.

[0117] In order to increase the data volume of the training samples and avoid the problem of inaccurate models due to small data volume, data augmentation processing is performed on the training samples, and specifically geometric transformation is used to perform data augmentation, that is, the data augmentation processing includes at least one of image translation, rotation, cropping and histogram averaging. For example, image translation, or image translation and rotation are used to perform data augmentation on the training samples.

[0118] In order to improve the accuracy of the model, in some embodiments, the data augmentation processing of the training samples specifically includes:

[0119] S29: Traversing the face area images in the training samples, and randomly selecting at least one of the image translation, rotation, cropping and histogram averaging to perform data augmentation processing on a target face area image, wherein the target face area image is any face area image in the training samples.

[0120] In this embodiment, the training samples are not uniformly processed by a certain data augmentation method. Instead, for any target face area image in the training samples, at least one of the image translation, rotation, cropping and histogram averaging is randomly selected for data augmentation processing. For example, for face area image 1#, image translation and rotation are selected for data augmentation, and for face area image 2#, image cropping is selected for data augmentation processing. It can be understood that for a target face area image, the corresponding data augmentation processing combination is random. Thus, the training samples after data augmentation are more realistic, which is conducive to improving the accuracy of the model.

[0121] The following is a detailed description of the wrinkle detection method provided by the embodiment of the present invention. Fig. 9 , the method S30 includes but is not limited to the following steps:

[0122] S31: Obtain a face image to be tested.

[0123] S32: Detect the face image to be tested using the wrinkle detection model in any one of the above embodiments to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested.

[0124] The face image to be tested is a human face image, which can be obtained by the above-mentioned image acquisition device 20. For example, the face image to be tested can be a human face image obtained by cutting out the face area of ​​the ID photo or selfie (initial face image to be tested) collected by the image acquisition device 20. Here, there is no restriction on the source of the face image to be tested, and it can be a human face image.

[0125] It is understandable that when the initial face image to be tested also includes a background, such as the ID photo or selfie mentioned above, the face frame can be first obtained through the existing dlib toolkit, and then the aspect ratio of the face frame can be adjusted to the aspect ratio of the initial face image to be tested in combination with the aspect ratio of the initial face image to be tested, thereby intercepting the face image and using it as the final face image to be tested. In the above manner, intercepting the face image and removing the background of the face image to be tested can reduce the interference of the background on wrinkle detection and improve the accuracy of detection.

[0126] By inputting the face image to be tested into the wrinkle detection model, the wrinkle position and wrinkle category in the face image to be tested can be obtained. Fig.10 As shown, the face image A to be tested is input into the wrinkle detection model. After feature processing, the wrinkles existing in the face image A to be tested are detected as follows: mild forehead wrinkles, no crow's feet, no frown lines, and mild nasolabial folds. Fig.10 The marked boxes in the figure are the positions corresponding to the wrinkle types.

[0127] It can be understood that the wrinkle detection model is trained by the method for training a wrinkle detection model in the above embodiment, and has the same structure and function as the wrinkle detection model in the above embodiment, which will not be described in detail here.

[0128] In this embodiment, the wrinkle detection model is used to detect the facial image to be tested, and the wrinkle category and wrinkle position can be directly located, so that wrinkles can be located and classified quickly and accurately, which helps users to provide more refined care based on the category and location of wrinkles.

[0129] In some embodiments, see Fig.11 , the step S32 specifically includes:

[0130] S321: Input the face image to be tested into the feature convolution layer in the wrinkle detection model for feature sampling to obtain a first feature map to be tested and a second feature map to be tested, wherein a first downsampling multiple of the first feature map to be tested relative to the face image to be tested is greater than a second downsampling multiple of the second feature map to be tested relative to the face image to be tested, and the second downsampling multiple is less than 32.

[0131] S322: Inputting the first feature map to be tested and the second feature map to be tested into the detection convolution layer in the wrinkle detection model to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested.

[0132] The face image to be tested is input into the feature convolution layer in the wrinkle detection model for feature sampling to obtain a first feature map to be tested and a second feature map to be tested. The first feature map to be tested and the second feature map to be tested are both reduced in size relative to the face image to be tested, that is, downsampled relative to the face image to be tested. The larger the downsampling multiple, the smaller the feature map to be tested is obtained, and the larger the receptive field of the feature map to be tested is, so that it is suitable for detecting objects with large size contrast in the face image to be tested.

[0133] Among them, a first downsampling multiple of the first feature map to be tested relative to the face image to be tested is greater than a second downsampling multiple of the second feature map to be tested relative to the face area image, thereby achieving detection of different granularities.

[0134] Since the wrinkle area in the face belongs to the medium-sized object area, if the receptive field of the training feature map used is large, it is not conducive to the detection of wrinkles. Therefore, the first downsampling multiple is less than 32. That is, the first feature map to be tested has a medium-sized receptive field, which is suitable for detecting medium-sized objects, such as forehead wrinkles, etc., and the second feature map to be tested has a small-scale receptive field, which is suitable for detecting small-sized objects, such as crow's feet, etc.

[0135] By adopting the first feature map to be tested and the second feature map to be tested of the above two sizes, not only can wrinkles be detected more accurately, but also the redundancy of the bounding box can be reduced. Moreover, compared with adopting 3 or more feature maps to be tested, the model parameters of the feature convolution layer can be simplified, thereby improving the detection efficiency of the wrinkle detection model.

[0136] In this embodiment, by using multi-sized feature maps to be tested for detection, the influence of the spatial dimension and resolution of the image on the detection result can be eliminated. In addition, through the above-mentioned first feature map to be tested and the second feature map to be tested, targets of various sizes can be taken into account, that is, the detection of medium-sized targets (such as forehead wrinkles) and the detection of small-sized targets (such as crow's feet) can be satisfied, the detection accuracy is high, and the redundancy of the bounding box can be reduced, and the detection efficiency is high.

[0137] In order to implement the above method, one embodiment of the present invention further provides an image processing device, which can be the above electronic device 10 or a combination of the electronic device 10 and the image acquisition device 20. The image processing device includes one or more functional modules, and the one or more functional modules can be combined to implement the above Figure 2-Figure 11 The method in .

[0138] One embodiment of the present invention further provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to enable an electronic device to execute, for example, the above-described Figure 3-Figure 11The method in .

[0139] An embodiment of the present invention provides a computer program product, including a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method for detecting wrinkles in any of the above method embodiments, for example, executing the above described Figure 3-Figure 11 Method steps.

[0140] It should be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may 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 deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for training a wrinkle detection model, characterized in that: include: Obtaining an image sample including a face; According to the image sample, a face region image is intercepted, wherein the face region image is annotated with a first label, wherein the first label includes a wrinkle position and a wrinkle category of a wrinkle in the image sample; Using the face region image marked with the first label as a training sample, and inputting it into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network, the detection result including a bounding box position corresponding to a wrinkle in the training sample identified by the preset convolutional neural network, a probability that the wrinkle corresponding to the bounding box position belongs to each wrinkle category, and a confidence level corresponding to the bounding box position; According to the bounding box position and the wrinkle position, calculating the minimum closure area of ​​the bounding box position and the wrinkle position, and the union area of ​​the bounding box position and the wrinkle position; Calculating the absolute difference between the minimum closure area and the union area; calculating the intersection-and-union ratio between the bounding box position and the wrinkle position, the intersection-and-union ratio being used to feedback the degree of overlap between the bounding box position and the wrinkle position; subtracting a first ratio from the intersection-and-union ratio to obtain the position deviation, the first ratio being the ratio of the absolute difference to the minimum closure area; Calculate the error between the first label and the detection result according to a formula; According to the error, reversely adjusting the model parameters of the preset convolutional neural network to obtain a wrinkle detection model; The formula includes: Among them, λ coord and λ noobj is the preset weight, M is the number of the preset priori boxes for predicting the wrinkle position, j is the number of the priori boxes, K×K is the number of grids contained in the convolution feature map extracted by the preset convolutional neural network for determining the detection result, i is the number of the grid, (x i ,y i ,w i ,h i ) is the bounding box position, is the wrinkle position, C i is the confidence level corresponding to the bounding box, is the true value of the wrinkle position, p i (c) is the probability, is the true probability, c is the wrinkle category, I ij obj Indicates whether the j-th prior box of the i-th grid is responsible for wrinkles, I ij noobj Indicates whether the jth prior box of the i-th grid is not responsible for wrinkles, where if the position deviation is not 0, then I ij obj =1, I ij noobj is 0, if the position deviation is 0, then I ij obj is 0, I ij noobj is 1.

2. The method according to claim 1, characterized in that: The step of using the face region image marked with the first label as a training sample and inputting it into a preset convolutional neural network to obtain a detection result of the training sample output by the preset convolutional neural network includes: Using the face region image marked with the first label as a training sample, inputting the sample into the feature convolution layer of the preset convolutional neural network for feature sampling, so as to obtain a first training feature map and a second training feature map, wherein a first downsampling multiple of the first training feature map relative to the face region image is greater than a second downsampling multiple of the second training feature map relative to the face region image, and the first downsampling multiple is less than 32; The first training feature map and the second training feature map are input into the detection convolution layer of the preset convolutional neural network to obtain the detection result of the training sample.

3. The method according to claim 1, characterized in that Before the step of using the face region image marked with the first label as a training sample and inputting it into a feature convolution layer of a preset convolutional neural network for feature sampling to obtain a first training feature map and a second training feature map, the method further includes: Performing data augmentation processing on the training samples, wherein the data augmentation processing includes at least one of image translation, rotation, cropping and histogram averaging.

4. The method according to claim 3, characterized in that The method further comprises: The face area images in the training samples are traversed, and at least one of the image translation, rotation, cropping and histogram averaging is randomly selected for data augmentation processing on a target face area image, wherein the target face area image is any face area image in the training samples.

5. A method for detecting wrinkles, characterized in that: include: Obtain the face image to be tested; The wrinkle detection model according to any one of claims 1 to 4 is used to detect the face image to be tested, and wrinkle positions and wrinkle categories of wrinkles in the face image to be tested are obtained.

6. The method according to claim 5, characterized in that The method of detecting the face image to be tested by using the wrinkle detection model according to any one of claims 1 to 4 to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested includes: Inputting the face image to be tested into the feature convolution layer in the wrinkle detection model for feature sampling to obtain a first feature map to be tested and a second feature map to be tested, wherein a first downsampling multiple of the first feature map to be tested relative to the face image to be tested is greater than a second downsampling multiple of the second feature map to be tested relative to the face image to be tested, and the second downsampling multiple is less than 32; The first feature map to be tested and the second feature map to be tested are input into the detection convolution layer in the wrinkle detection model to obtain wrinkle positions and wrinkle categories of wrinkles in the face image to be tested.

7. An image processing device, characterized in that: It comprises one or more functional modules, and the one or more functional modules are used to cooperate in implementing the method according to any one of claims 1 to 4 or claim 5 or 6.

8. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable an electronic device to execute the method according to any one of claims 1 to 4 or claim 5 or 6.

Citation Information

Patent Citations

  • Face detection method and device

    CN107871134A

  • A convolutional neural network-based noise image target bounding box determination method

    CN109902806A

  • Lie-telling detection method based on micro-expressions in interview

    CN110889332A

  • Face detection method and device and equipment and computer readable storage medium

    CN111160169A

  • Systems and methods for end-to-end object detection

    US20170147905A1