Lip key point positioning method and device, storage medium, and electronic device
The initial positioning results of the deep learning model are corrected through edge detection, which solves the problems of high time complexity and low accuracy in lip key point detection, and achieves higher positioning accuracy and applicability.
Patent Information
- Application Number
- CN202010568619.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-19
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-06-19
AI Technical Summary
The existing technology has the problems of high time complexity and low accuracy in lip key point detection, especially in complex scenes, it is difficult to achieve real-time and lightweight requirements.
By obtaining the initial positioning results for cropping and edge detection processing, the edge positioning results are used to correct the initial positioning results, and the deep learning model is used to output the initial positioning results and combined with the edge detection algorithm to improve positioning accuracy and enrich application scenarios.
It improves the positioning accuracy of lip key points, avoids the problem of non-fitting rendering areas, and eliminates the need to add additional annotation data. It is suitable for real-time and lightweight scenarios.
Smart Images

Figure CN113780040B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method for locating key points of lips, a device for locating key points of lips, a computer-readable storage medium, and an electronic device. Background Art
[0002] As a part of face key point detection, lip key point detection is to locate the feature points of the lips after a given face image. This is an extremely important basic element in the fields of virtual makeup, expression analysis, and lip reading recognition. Generally, lip key points can be located through traditional feature methods and deep learning-based methods.
[0003] However, since traditional feature methods are highly dependent on the experience of experts and are prone to complex scenarios such as occlusion and lighting in actual scenes, using high-precision traditional feature methods will bring high time complexity. When using deep learning methods for positioning, errors are prone to occur when collecting data and labeling, and they cannot be applied in scenes that require real-time and lightweight performance due to the impact on accuracy.
[0004] In view of this, there is an urgent need in the art to develop a new method and device for locating key points of the lips.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a lip key point positioning method, a lip key point positioning device, a computer-readable storage medium and an electronic device, thereby at least to a certain extent overcoming the problems of high time complexity and low precision caused by the limitations of related technologies.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] According to a first aspect of an embodiment of the present invention, a method for locating lip key points is provided, the method comprising: obtaining an initial positioning result of the lip key points in an image to be processed, and cropping the image to be processed according to the initial positioning result to obtain a lip image; performing edge detection processing on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image; and correcting the initial positioning result according to the edge positioning result to obtain a target positioning result of the lip key points.
[0009] In an exemplary embodiment of the present invention, correcting the initial positioning result according to the edge positioning result includes: establishing a dictionary mapping of the edge positioning result, and querying the edge positioning result corresponding to the initial positioning result in the dictionary mapping; determining the key points to be corrected among the lip key points according to the query results, and correcting the key points to be corrected using the edge positioning result.
[0010] In an exemplary embodiment of the present invention, determining the key points to be corrected among the lip key points based on the query results includes: if multiple edge positioning results corresponding to the initial positioning results are queried, respectively calculating multiple Euclidean distances between the initial positioning result and the multiple edge positioning results; determining the key points to be corrected among the lip key points based on the multiple Euclidean distances.
[0011] In an exemplary embodiment of the present invention, determining the key points to be corrected among the lip key points based on the multiple Euclidean distances includes: comparing the multiple Euclidean distances, and determining candidate correction key points among the lip key points based on the comparison results; if the candidate correction key points meet preset conditions, determining the candidate correction key points as the key points to be corrected.
[0012] In an exemplary embodiment of the present invention, cropping the image to be processed according to the initial positioning result to obtain a lip image includes: determining the minimum enclosing rectangle of the lip key points according to the initial positioning result, and obtaining size information of the minimum enclosing rectangle; expanding the minimum enclosing rectangle according to the size information to obtain a target rectangle, and using the target rectangle to crop the image to be processed to obtain the lip image.
[0013] In an exemplary embodiment of the present invention, before performing edge detection processing on the lip image using an edge detection algorithm, the method further includes: performing grayscale processing on the lip image to obtain a grayscale image of the lip image; and performing morphological closing operation processing on the grayscale image to obtain the processed lip image.
[0014] In an exemplary embodiment of the present invention, the image to be processed includes a face image; the step of obtaining the initial positioning result of the lip key points in the image to be processed includes: obtaining the face image, and inputting the face image into a pre-trained face key point detection model to obtain a face positioning result; and determining the initial positioning result of the lip key points based on the face positioning result.
[0015] In an exemplary embodiment of the present invention, the image to be processed includes a lip image to be processed; the step of obtaining the initial positioning result of the lip key points in the image to be processed includes: obtaining the lip image to be processed, and inputting the lip image to be processed into a pre-trained lip key point model to obtain the initial positioning result of the lip key points.
[0016] According to a second aspect of an embodiment of the present invention, a device for positioning lip key points is provided, the device comprising: an initial positioning module, configured to obtain an initial positioning result of the lip key points in an image to be processed, and to crop the image to be processed according to the initial positioning result to obtain a lip image; an edge detection module, configured to perform edge detection processing on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image; and a positioning correction module, configured to correct the initial positioning result according to the edge positioning result to obtain a target positioning result of the lip key points.
[0017] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor and a memory; wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method for locating lip key points of any of the above exemplary embodiments is implemented.
[0018] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for locating key points of the lip in any of the above exemplary embodiments is implemented.
[0019] It can be seen from the above technical solutions that the lip key point positioning method, lip key point positioning device, computer storage medium and electronic device in the exemplary embodiments of the present invention have at least the following advantages and positive effects:
[0020] In the method and device provided in the exemplary embodiments of the present disclosure, on the one hand, the initial positioning results of the lip key points are output through the deep learning model, without the need to add new annotation data, and the application scenarios of the positioning method are enriched; on the other hand, the initial positioning results are corrected using the edge positioning results, which improves the positioning accuracy of the lip key points and avoids the phenomenon of mismatch such as too small or too many rendering areas in subsequent applications.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0023] Figure 1 A flowchart schematically illustrates a method for locating key points of lips in an exemplary embodiment of the present disclosure;
[0024] Figure 2 A schematic diagram schematically illustrates a flow chart of a method for obtaining an initial positioning result in an exemplary embodiment of the present disclosure;
[0025] Figure 3 A schematic diagram schematically illustrates a flow chart of a method for obtaining a lip image in an exemplary embodiment of the present disclosure;
[0026] Figure 4 A schematic diagram schematically illustrates a flow chart of a method for preprocessing a lip image in an exemplary embodiment of the present disclosure;
[0027] Figure 5 A schematic diagram schematically illustrates a flow chart of a method for correcting an initial positioning result in an exemplary embodiment of the present disclosure;
[0028] Figure 6 A flowchart schematically illustrates a method for determining key points to be corrected in an exemplary embodiment of the present disclosure;
[0029] Figure 7 A schematic diagram schematically illustrates a flow chart of a method for further determining key points to be corrected in an exemplary embodiment of the present disclosure;
[0030] Figure 8 A schematic diagram schematically illustrates a flow chart of a method for locating key points of lips in an application scenario in an exemplary embodiment of the present disclosure;
[0031] Fig. 9 Schematically showing a face image with annotated face positioning results in an exemplary embodiment of the present disclosure;
[0032] Fig.10 The lip image obtained by cropping with the target rectangle in the exemplary embodiment of the present disclosure is schematically shown;
[0033] Fig.11 Schematically showing a grayscale image obtained by grayscale processing of a lip image in an exemplary embodiment of the present disclosure;
[0034] Fig.12 Schematically showing a lip image after morphological closing operation is performed in an exemplary embodiment of the present disclosure;
[0035] Fig.13 Schematically showing an edge positioning image of a lip image in an exemplary embodiment of the present disclosure;
[0036] Fig.14 A diagram schematically shows the effect of positioning the edge in the lip image in an exemplary embodiment of the present disclosure;
[0037] Fig.15 A diagram schematically shows the effect of the target positioning result after the lip key points are corrected in an exemplary embodiment of the present disclosure;
[0038] Fig.16 A schematic diagram schematically shows a structure of a lip key point positioning device in an exemplary embodiment of the present disclosure;
[0039] Fig.17 An electronic device for implementing a method for locating key points of lips in an exemplary embodiment of the present disclosure is schematically shown;
[0040] Fig.18 A computer-readable storage medium for implementing a method for locating key points of lips in an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0041] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0042] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0043] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings represent the same or similar parts, and their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities.
[0044] In view of the problems existing in the related art, the present disclosure proposes a method for locating key points of the lips. Figure 1 A flowchart of the method for locating lip key points is shown. Figure 1 As shown, the method for locating the key points of the lips includes at least the following steps:
[0045] Step S110: Obtain the initial positioning result of the lip key points in the image to be processed, and crop the image to be processed according to the initial positioning result to obtain the lip image.
[0046] Step S120: Perform edge detection processing on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image.
[0047] Step S130: Correct the initial positioning result according to the edge positioning result to obtain the target positioning result of the lip key points.
[0048] In the exemplary embodiments of the present disclosure, on the one hand, the initial positioning results of the lip key points are output by a deep learning model without the need to add new annotation data, and the application scenarios of the positioning method are enriched; on the other hand, the initial positioning results are corrected using the edge positioning results, which improves the positioning accuracy of the lip key points and avoids the phenomenon of mismatch such as too small or too many rendering areas in subsequent applications.
[0049] The following is a detailed description of each step of the method for locating lip key points.
[0050] In step S110, the initial positioning result of the lip key points in the image to be processed is obtained, and the image to be processed is cropped according to the initial positioning result to obtain a lip image.
[0051] In an exemplary embodiment of the present disclosure, a deep learning-based method locates key points of the face, including key points of the lips, by constructing a deep learning model. However, since the deep learning model has high requirements for the data set, when the data set is not accurately labeled or lacks data in certain specific scenarios, the accuracy of the deep learning model will be affected. On the other hand, the model size and accuracy in the deep learning method are often positively correlated. It is difficult to apply a larger model in specific scenarios that require real-time and light weight, so the accuracy is often affected. Due to the changeable curves of the lips and the ever-changing postures, when collecting data and annotating, the unclear features of the key points are prone to errors in the annotation stage. In this case, the final effect obtained by the deep learning model is difficult to meet the actual requirements. Therefore, the initial positioning result output by the deep learning model can be obtained first to further correct the initial positioning result.
[0052] In an optional embodiment, the image to be processed includes a face image. Figure 2 A schematic diagram of a method for obtaining an initial positioning result is shown in FIG. Figure 2 As shown, in step S210, a face image is obtained, and the face image is input into a pre-trained face key point detection model to obtain a face positioning result. The face image may include an image captured after face detection is performed on various images. For example, after face detection is performed on an image on the Internet, location information indicating the area where the face object is located, that is, the location of the face detection frame, will be obtained. A screenshot of the area where the face object is located can be obtained to obtain a face image. In addition, the face image may also include an image directly captured of a person's face.
[0053] The facial key point detection model can be used to detect the position of facial key points in a face image, and the position can be represented by coordinates. In addition, the face positioning result can be the position information of the facial key points, such as the coordinates of the facial key points. In practice, the facial key points can be key points in the face to mark the facial features and contour positioning, such as points with semantic information, or points that affect the facial contour and the shape of the facial features. For example, facial key points can include but are not limited to the corners of the eyes, the corners of the mouth, points in the contour, etc.
[0054] The facial key point detection model can be obtained by supervised training of an existing model using a machine learning method. In addition, various existing models that can extract image features can also be used for training. For example, models such as convolutional neural networks and deep neural networks can be used. Among them, the convolutional neural network is a feedforward neural network whose artificial neurons can respond to surrounding units within a part of the coverage range and have excellent performance in image processing. Therefore, the convolutional neural network can be used to extract features of sample images. The convolutional neural network can include convolutional layers, pooling layers, fully connected layers, etc. Among them, the convolutional layer is used to extract image features, and the pooling layer is used to downsample the input information.
[0055] Therefore, inputting the face image into a pre-trained face key point detection model can enable the face key point detection model to output a face positioning result.
[0056] In step S220, the initial positioning result of the lip key points is determined according to the face positioning result. The face positioning result generally includes 68 feature points of the face, and the 68 feature points are mainly distributed in the eyebrows, eyes, nose, mouth and facial contour. Therefore, the initial positioning result of the lip key points can be obtained from the result.
[0057] In this exemplary embodiment, the facial image can be detected through the facial key point detection model to further obtain the initial positioning results of the lip key points, enriching the method of obtaining the initial positioning results and expanding the application scenarios of the present disclosure.
[0058] In addition, the lip image to be processed can be directly acquired for processing to obtain an initial positioning result.
[0059] In an optional embodiment, the image to be processed includes a lip image to be processed, and the method for obtaining the initial positioning result may be to obtain the lip image to be processed, and input the lip image to be processed into a pre-trained lip key point model to obtain the initial positioning result of the lip key points.
[0060] The lip image to be processed may include an image captured after lip detection is performed on various images, or may include an image directly photographed on the lips of a person.
[0061] The lip key point model can be used to detect the position of the lip key points in the lip image to be processed, and the position can be represented by coordinates. Specifically, the lip key point model can be a deep learning model or a traditional model, and this exemplary embodiment does not make any special limitation on this.
[0062] Therefore, inputting the lip image to be processed into a pre-trained lip key point model can enable the lip key point model to directly output the initial positioning results of the lip key points.
[0063] In this exemplary embodiment, the initial positioning result can be directly obtained through the lip key point model. The acquisition method is simple and accurate, which greatly enriches the acquisition method and application scenarios of the initial positioning result.
[0064] Regardless of whether the image to be processed is a face image or a lip image to be processed, after obtaining the initial positioning result, the image to be processed can be cropped to eliminate the influence of parts other than the lips on subsequent processing results and reduce the amount of calculation to a certain extent.
[0065] In an alternative embodiment, Figure 3 A schematic diagram of the process of obtaining a lip image is shown, Figure 3 As shown, the method includes at least the following steps: In step S310, the minimum enclosing rectangle of the lip key points is determined according to the initial positioning result, and the size information of the minimum enclosing rectangle is obtained. Specifically, the point in the upper left corner and the point in the lower right corner of the lip key points can be determined in the initial positioning result. It can be understood that the horizontal coordinate of the point in the upper left corner is the minimum value in the coordinates of the lip key points, the vertical coordinate of the point in the upper left corner is the minimum value in the coordinates of the lip key points, the horizontal coordinate of the point in the lower right corner is the maximum value in the coordinates of the lip key points, and the vertical coordinate of the point in the lower right corner is the maximum value in the coordinates of the lip key points. Therefore, the minimum enclosing rectangle of the lip key points can be determined based on these two points.
[0066] Furthermore, the size information of the minimum circumscribed rectangle is obtained, that is, the length and width of the minimum circumscribed rectangle. Considering that in the image matrix, 0 is the coordinate value of the lip key point in the upper left corner, the vertical coordinate value of the lip key point increases as it moves downward, and the horizontal coordinate value of the lip key point increases as it moves rightward. Therefore, specifically, the length of the minimum circumscribed rectangle can be obtained by subtracting the horizontal coordinate of the point in the upper left corner from the horizontal coordinate of the point in the lower right corner, and the width of the minimum circumscribed rectangle can be obtained by subtracting the vertical coordinate of the point in the upper left corner from the vertical coordinate of the point in the lower right corner. In addition, other size information can be determined according to actual conditions or size information can be obtained according to other methods, and this exemplary embodiment does not specifically limit this.
[0067] In step S320, the minimum bounding rectangle is expanded according to the size information to obtain a target rectangle, and the target rectangle is used to crop the image to be processed to obtain a lip image. When the initial positioning result is not accurate enough, the minimum bounding rectangle may also be inaccurate. In order to avoid the cropped lip image not containing the entire lip area, the minimum bounding rectangle can be expanded. Specifically, the expansion ratio can be set to 10% of the length and width of the minimum bounding rectangle. In addition, other expansion ratios can also be set according to actual needs, and this exemplary embodiment does not make special limitations on this.
[0068] After the expansion process is performed, a target rectangle for cropping can be determined. Further, the target rectangle can be used to crop the image to be processed to obtain a lip image.
[0069] It is worth noting that when the image to be processed is a lip image to be processed and the lip image to be processed meets the size requirement of the target rectangle, no cropping process is required.
[0070] In step S120, edge detection processing is performed on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image.
[0071] In an exemplary embodiment of the present disclosure, before edge detection is performed on the lip image, the obtained lip image may be pre-processed.
[0072] In an alternative embodiment, Figure 4 A schematic diagram of the process of preprocessing lip images is shown in FIG. Figure 4 As shown, the method includes at least the following steps: In step S410, grayscale processing is performed on the lip area to obtain a grayscale image of the lip image. There are many ways to grayscale the lip image, and the grayscale value of each pixel in the lip area can be determined based on any one of the methods such as floating point algorithm, integer method, shift method, average method, and only taking green, and the grayscale value is used to replace the pixel value of the red, green and blue channels in the pixel point to obtain a grayscale image.
[0073] In step S420, the grayscale image is subjected to morphological closing operation processing to obtain a processed lip image. The morphological closing operation processing includes two processes: dilation and erosion. Specifically, a rectangular structure element having the same size and shape as the grayscale image is selected, and the grayscale image and the rectangular structure element are subjected to convolution processing, that is, the maximum value of the pixel points in the area covered by the rectangular structure element is calculated, and the maximum value is assigned to the pixel specified by the center point of the rectangular structure element, so as to obtain the result of the morphological dilation operation.
[0074] Since the rectangular structure element selected by the morphological dilation operation is an asymmetric structure, in order to ensure that the image after the closing operation does not have an erroneous offset, a morphological erosion operation can be further performed. Specifically, the rectangular structure element is flipped 180° along the geometric center in the horizontal and vertical directions respectively to obtain a new structure element, which is also a rectangular structure with unchanged size. Further, the structure of the morphological dilation operation is convolved with the new structure element, the minimum value of the pixel points in the area covered by the new structure element is calculated, and the minimum value is assigned to the pixel specified by the center point of the new structure element to obtain the processed lip image.
[0075] In this exemplary embodiment, the grayscaled lip image is subjected to a morphological closing operation, so as to remove burrs in the teeth portion of the lip image, thereby reducing the influence of the edges between teeth on subsequent edge detection results.
[0076] After the lip image is processed, the lip image may be further processed by edge detection using an edge detection algorithm, wherein the edge detection algorithm may be a Canny edge detection algorithm, a Sobel edge detection algorithm, or a Laplace algorithm, etc., which is not specifically limited in this exemplary embodiment.
[0077] Therefore, the edge location result of the lip image can be obtained. Each edge in the edge location result is composed of a group of points. In order to avoid the influence of factors such as lighting and brightness, the edges with fewer points can be eliminated accordingly.
[0078] In step S130, the initial positioning result is corrected according to the edge positioning result to obtain the target positioning result of the lip key points.
[0079] In an exemplary embodiment of the present disclosure, before the initial positioning result is corrected, a dictionary mapping for querying the initial positioning result may be established.
[0080] In an alternative embodiment, Figure 5 A flow chart of a method for correcting an initial positioning result is shown in FIG. Figure 5 As shown, the method at least includes the following steps: In step S510, a dictionary mapping of edge positioning results is established, and the edge positioning result corresponding to the initial positioning result is searched in the dictionary mapping. Specifically, the dictionary mapping is shown in formula (1):
[0081] map={(x p :y p )|P∈c,c∈C} (1)
[0082] Among them, C is the geometry of all edges retained in the previous step, x and y are the horizontal and vertical coordinates of each point, and the horizontal and vertical coordinates can be saved in integer form for easy retrieval.
[0083] On the one hand, since the main function of the lip key points is to help estimate the lip edge area, the error and influence of the lip key points in the horizontal direction are relatively small, while the error in the vertical direction will directly affect the effect of the edge curve; on the other hand, in order to avoid the large time complexity brought by the exhaustive search, a small range search can be performed on each lip key point.
[0084] Specifically, the initial positioning result of the lip key points is taken within the horizontal interval [x-ε, x+ε] of the abscissa of each lip key point, and the query dictionary mapping map contains all edge positioning results that meet the conditions of the initial positioning results.
[0085] In step S520, the key points to be corrected in the lip key points are determined according to the query results, and the key points to be corrected are corrected using the edge positioning results.
[0086] In an alternative embodiment, Figure 6 A flow chart of a method for determining key points to be corrected is shown in FIG. Figure 6 As shown, the method at least includes the following steps: In step S610, if multiple edge positioning results corresponding to the initial positioning result are queried, multiple Euclidean distances between the initial positioning result and the multiple edge positioning results are calculated respectively. When querying the edge positioning result in the dictionary mapping map, one or more edge positioning results may be found. When multiple edge positioning results are queried, the Euclidean distances between the initial positioning result and the multiple edge positioning results can be calculated one by one, so that multiple Euclidean distances corresponding to the multiple edge positioning results can be obtained.
[0087] In step S620, key points to be corrected among the lip key points are determined according to a plurality of Euclidean distances.
[0088] In an alternative embodiment, Figure 7 A schematic diagram of a method for further determining key points to be corrected is shown in FIG. Figure 7 As shown, the method at least includes the following steps: In step S710, multiple Euclidean distances are compared, and candidate correction key points among the lip key points are determined according to the comparison results. After comparing multiple Euclidean distances, the point with the smallest Euclidean distance can be selected as the candidate correction key point, that is, the edge positioning result closest to the initial positioning result.
[0089] In step S720, if the candidate correction key point meets the preset condition, the candidate correction key point is determined as the key point to be corrected. The preset condition may be a condition that determines whether the candidate correction key point needs to be corrected, and specifically, may be a preset distance threshold. For example, when the Euclidean distance of the candidate correction key point is less than the preset distance threshold, the candidate correction key point is determined as the key point to be corrected for further correction.
[0090] It is worth noting that when an edge positioning result is queried based on the initial positioning result, only one Euclidean distance may be calculated, and the Euclidean distance may be compared with a preset distance threshold to determine whether the initial positioning result needs to be corrected.
[0091] In this exemplary embodiment, the Euclidean distance can be used to determine the key points to be corrected from the candidate key points for correction. The determination method is accurate and logically rigorous, providing a basis for obtaining accurate correction results.
[0092] After the key points to be corrected are determined, the initial positioning result can be corrected by replacing the vertical coordinates in the initial positioning result with the vertical coordinates of the edge positioning result.
[0093] In this exemplary embodiment, the initial positioning result is corrected by the edge positioning result, and the purpose of improving the positioning accuracy can be achieved without adding additional annotation data.
[0094] After correcting the initial positioning result using the edge positioning result, the corrected target positioning result in the lip key points can be obtained.
[0095] The following is a detailed description of the method for locating key points of the lips in the embodiment of the present disclosure in conjunction with an application scenario.
[0096] Figure 8 FIG. 4 shows a flow chart of a method for locating lip key points in an application scenario, such as Figure 8 As shown, in step S810, deep learning of facial key points detects lip key points.
[0097] in, Fig. 9 The face image with the result of face location annotation is shown. Fig. 9 As shown in FIG. 1 , after obtaining a face image, the face key points can be obtained by using a face key point detection model, and the face key points are marked in the face image. Therefore, the lip key points are also marked in the face image.
[0098] In step S820, the lip image is cropped and converted into a grayscale image.
[0099] Fig.10 The lip image obtained by cropping the target rectangle is shown in FIG. Fig.10 As shown, the minimum bounding rectangle can be determined based on the initial positioning result of the lip key points. The lip image of the lip area is cropped by further expanding the length and width of the minimum bounding rectangle by 10%.
[0100] Fig.11 FIG. 4 shows a grayscale image obtained by graying the lip image. Fig.11 As shown, the grayscale value of each pixel in the lip area can be determined by any one of the methods such as floating-point arithmetic, integer method, shift method, average method and taking only green, and the grayscale value is used to replace the pixel value of the red, green and blue channels in the pixel to obtain a grayscale image.
[0101] In step S830, a closing operation is performed to smooth the edges between teeth.
[0102] Fig.12 , shows the lip image after the morphological closing operation is performed. Fig.12 As shown, by performing morphological closing operation on the grayscaled lip image, the burrs of the teeth in the lip image can be removed to reduce the influence of the edges between teeth on the subsequent edge detection results.
[0103] In step S840, edge detection is performed to obtain edges that meet the length condition, so as to obtain edge positioning results of the lip image.
[0104] Fig.13 The edge positioning image of the lip image is shown as Fig.13 As shown, all edges of the lip image can be obtained using the Canny edge detection algorithm, and other edge detection algorithms can also be used, which is not particularly limited in this exemplary embodiment.
[0105] Fig.14 The effect of locating the edge in the lip image is shown in FIG. Fig.14 As shown, it can be seen that the main edges of the lip graphics are concentrated on the inner and outer contours of the upper and lower lips.
[0106] Furthermore, among the 10 detected edges, in order to avoid false detection caused by shorter edges, the edges with less than 10 points can be removed, and then there are 3 edges left.
[0107] In step S850, a point mapping is constructed with the retained edges. Specifically, a dictionary mapping of edge positioning results is established, and the edge positioning result corresponding to the initial positioning result is searched in the dictionary mapping.
[0108] In step S860, all initial positioning results are queried in the dictionary mapping, and it is determined whether all lip key points have been queried. It is worth noting that when traversing all initial positioning results, the two points at the two corners of the mouth can be left unprocessed according to actual conditions, and other specific points can also be left unprocessed.
[0109] In step S870, when the lip key points of the initial positioning result have not been queried, the lip key points represented by the edge positioning results of the nearest neighbors of each lip key point may be retrieved.
[0110] In step S880, it is determined whether the distance between the initial positioning result and the nearest neighbor point is less than a preset distance threshold. Generally, the preset distance threshold can be set to 5, and the horizontal query range ε=2.
[0111] In step S890, if the distance between the initial positioning result and the nearest neighbor point is less than a preset threshold, the vertical coordinate of the initial positioning result can be changed to the vertical coordinate of the nearest neighbor lip key point in the edge positioning result.
[0112] Fig.15 The effect diagram of the target positioning result after the lip key points are corrected is shown in FIG. Fig.15 As shown, the lip key points whose positions are corrected are represented in black. It can be seen that the positioning of the corrected lip key points is closer to the actual edge than before, and the correction effect is better.
[0113] In the exemplary embodiments of the present disclosure, on the one hand, the initial positioning results of the lip key points are output by a deep learning model without the need to add new annotation data, and the application scenarios of the positioning method are enriched; on the other hand, the initial positioning results are corrected using the edge positioning results, which improves the positioning accuracy of the lip key points and avoids the phenomenon of mismatch such as too small or too many rendering areas in subsequent applications.
[0114] In addition, in an exemplary embodiment of the present disclosure, a device for positioning key points of the lips is also provided. Fig.16 The schematic diagram of the structure of the positioning device of the key points of the lips is shown as follows: Fig.16 As shown, the lip key point positioning device 1600 may include: an initial positioning module 1610, an edge detection module 1620 and a positioning correction module 1630. Among them:
[0115] The initial positioning module 1610 is configured to obtain the initial positioning result of the lip key points in the image to be processed, and to crop the image to be processed according to the initial positioning result to obtain the lip image; the edge detection module 1620 is configured to perform edge detection processing on the lip image using an edge detection algorithm to obtain the edge positioning result of the lip image; the positioning correction module 1630 is configured to correct the initial positioning result according to the edge positioning result to obtain the target positioning result of the lip key points.
[0116] The specific details of the above-mentioned lip key point positioning device 1600 have been described in detail in the corresponding lip key point positioning method, so they will not be repeated here.
[0117] It should be noted that, although several modules or units of the lip key point positioning device 1600 are mentioned in the above detailed description, such division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units for embodiment.
[0118] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0119] Refer to the following Fig.17 1700 according to this embodiment of the present invention is described. Fig.17 The electronic device 1700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0120] like Fig.17 As shown, the electronic device 1700 is in the form of a general computing device. The components of the electronic device 1700 may include, but are not limited to: the at least one processing unit 1710, the at least one storage unit 1720, a bus 1730 connecting different system components (including the storage unit 1720 and the processing unit 1710), and a display unit 1740.
[0121] The storage unit stores program codes, which can be executed by the processing unit 1710, so that the processing unit 1710 executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0122] The storage unit 1720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 1721 and / or a cache storage unit 1722 , and may further include a read-only storage unit (ROM) 1723 .
[0123] The storage unit 1720 may also include a program / utility 1724 having a set (at least one) of program modules 1725, such program modules 1725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0124] Bus 1730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0125] The electronic device 1700 may also communicate with one or more external devices 1900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1700, and / or communicate with any device that enables the electronic device 1700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1750. Furthermore, the electronic device 1700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1760. As shown, the network adapter 1740 communicates with other modules of the electronic device 1700 via a bus 1730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0126] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0127] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0128] refer to Fig.18 As shown, a program product 1800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0129] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0130] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0131] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0132] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0133] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
Claims
1. A method for locating key points of lips, characterized in that: The method comprises: Obtaining an initial positioning result of lip key points in the image to be processed, and cropping the image to be processed according to the initial positioning result to obtain a lip image; Performing edge detection processing on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image; The initial positioning result is corrected according to the edge positioning result to obtain the target positioning result of the lip key point, including: establishing a dictionary mapping of the edge positioning result, and querying the edge positioning result corresponding to the initial positioning result in the dictionary mapping; determining the key point to be corrected among the lip key points according to the query result, and correcting the key point to be corrected using the edge positioning result, wherein the correction of the initial positioning result is achieved by replacing the vertical coordinate in the initial positioning result with the vertical coordinate of the edge positioning result.
2. The method for locating key points of lips according to claim 1, characterized in that: The step of determining the key points to be corrected among the lip key points according to the query result includes: If multiple edge positioning results corresponding to the initial positioning result are found, multiple Euclidean distances between the initial positioning result and the multiple edge positioning results are calculated respectively; The key points to be corrected among the lip key points are determined according to the multiple Euclidean distances.
3. The method for locating key points of lips according to claim 2, characterized in that: The determining the key points to be corrected among the lip key points according to the multiple Euclidean distances comprises: comparing the multiple Euclidean distances, and determining candidate correction key points among the lip key points according to the comparison result; If the candidate correction key point meets the preset condition, the candidate correction key point is determined as the key point to be corrected.
4. The method for locating key points of lips according to claim 1, characterized in that: The step of cropping the image to be processed according to the initial positioning result to obtain a lip image includes: Determine the minimum bounding rectangle of the lip key points according to the initial positioning result, and obtain size information of the minimum bounding rectangle; The minimum circumscribed rectangle is expanded according to the size information to obtain a target rectangle, and the image to be processed is cropped using the target rectangle to obtain a lip image.
5. The method for locating key points of lips according to claim 1, characterized in that: Before performing edge detection processing on the lip image using an edge detection algorithm, the method further includes: Performing grayscale processing on the lip image to obtain a grayscale image of the lip image; Performing morphological closing operation on the grayscale image to obtain the processed lip image.
6. The method for locating key points of lips according to claim 1, characterized in that: The image to be processed includes a face image; The step of obtaining the initial positioning result of the lip key points in the image to be processed includes: Acquire the face image, and input the face image into a pre-trained face key point detection model to obtain a face positioning result; The initial positioning result of the lip key points is determined according to the face positioning result.
7. The method for locating key points of lips according to claim 1, characterized in that: The image to be processed includes a lip image to be processed; The step of obtaining the initial positioning result of the lip key points in the image to be processed includes: The lip image to be processed is obtained, and the lip image to be processed is input into a pre-trained lip key point model to obtain an initial positioning result of the lip key points.
8. A lip key point positioning device, characterized in that: include: An initial positioning module is configured to obtain an initial positioning result of lip key points in the image to be processed, and to crop the image to be processed according to the initial positioning result to obtain a lip image; An edge detection module is configured to perform edge detection processing on the lip image using an edge detection algorithm to obtain an edge positioning result of the lip image; A positioning correction module is configured to correct the initial positioning result according to the edge positioning result to obtain the target positioning result of the lip key point, including: establishing a dictionary mapping of the edge positioning result, and querying the edge positioning result corresponding to the initial positioning result in the dictionary mapping; determining the key points to be corrected among the lip key points according to the query result, and correcting the key points to be corrected using the edge positioning result, wherein the correction of the initial positioning result is achieved by replacing the vertical coordinate in the initial positioning result with the vertical coordinate of the edge positioning result.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for locating lip key points described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the lip key point positioning method described in any one of claims 1-7 by executing the executable instructions.
Citation Information
Patent Citations
Palmprint interest region locating method and apparatus
CN104123531A
Method for adjusting object parallax in stereo image
CN106355619A
Structured modeling based face key point positioning method
CN106980845A
SAR and visible light image registration method
CN107862708A
Lip recognition model training method and device based on parameterized curve
CN109389085A
