Face image recognition method, device, equipment and storage medium
Through the face image recognition method, the target mask image and image evaluation model are used to evaluate the expression quality in the screen frame of the film and television drama, and the problem of poor expression of characters is solved, and the screening of qualified images and poster generation is realized.
Patent Information
- Application Number
- CN202411949206.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-01
AI Technical Summary
When using algorithms to automatically produce screenshots for film and television dramas, the problem of poor expressions of characters in the screenshots makes it difficult to screen out qualified images.
By obtaining the face image to be identified and its key points, determining the target mask image of each target part, obtaining the weight distribution map of each target part, fusing the image, and calling the pre-trained image evaluation model to calculate the expression evaluation score. When the score meets the preset conditions, a poster is generated.
The expression quality evaluation of face images is achieved, qualified images are selected, and posters are generated when qualified, avoiding images with poor expressions.
Smart Images

Figure CN119741749A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a facial image recognition method, device, equipment and storage medium. Background Art
[0002] Posters are important materials for film and television marketing and promotion. They interpret the theme and connotation of the film and television series, and influence and shape the audience's first impression of the film and television series. It can be said that the poster is the spokesperson for the film and television series itself, and it is inseparable from the reputation of the series.
[0003] However, for film and television drama posters, the original materials often come from the screenshots of the film and television drama. When using algorithms to automatically produce screenshots in large quantities, the screenshots will inevitably show poor expressions of the characters, such as talking, blinking, looking down, looking up, etc. Therefore, how to filter out such images with poor expressions of the characters has become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a facial image recognition method, apparatus, device and storage medium, which can determine whether the facial image is qualified, and if the facial image is qualified, use the facial image to generate a poster.
[0005] In a first aspect, the present application provides a method for facial image recognition, the method comprising:
[0006] Obtaining a face image to be recognized and key points on the face image;
[0007] Determining a target mask image for each target part according to key points on the face image;
[0008] According to the target mask image of each target part, a weight distribution map of each target part on the face image is obtained;
[0009] Using the target mask image of each target part and the face image, a fused image is obtained;
[0010] Calling a pre-trained image evaluation model, and using the weight distribution map and the fused image to obtain an expression evaluation score;
[0011] When the expression evaluation score meets a preset condition, a poster is generated using the face image.
[0012] Optionally, determining a target mask image for each target part according to key points on the face image includes:
[0013] Determining a first mask image corresponding to each target part according to key points on the face image;
[0014] Obtain the weight coefficient corresponding to each target part;
[0015] For each target part, multiplying the first mask image corresponding to the target part by the corresponding weight coefficient to obtain a corresponding second mask image;
[0016] The second mask image corresponding to each target part is processed using a Gaussian blurring scheme to obtain a target mask image of each target part.
[0017] Optionally, determining the first mask image corresponding to each target part according to the key points on the face image includes:
[0018] At the key points on the face image, determining a target key point corresponding to each target part;
[0019] Connect the target key points corresponding to each target part to obtain a closed curve corresponding to each target part;
[0020] According to the closed curve corresponding to each target part, a third mask image of each target part is obtained;
[0021] The first mask image of each target part is determined according to the third mask image of each target part.
[0022] Optionally, obtaining a third mask image of each target part according to the closed curve corresponding to each target part includes:
[0023] For each target part, obtaining a curve expansion strategy corresponding to the target part;
[0024] According to the curve expansion strategy, the closed curve corresponding to the target part is expanded to obtain a target closed curve;
[0025] A closed area corresponding to the target closed curve is determined, pixel values within the closed area are set to a first value, and pixel values outside the closed area are set to a second value, to obtain a third mask image corresponding to the target part.
[0026] Optionally, obtaining a weight distribution map of each target part on the face image according to the target mask image of each target part includes:
[0027] The target mask images of different target parts are added together to obtain a weight distribution map of each target part on the face image.
[0028] Optionally, obtaining a fused image by using the target mask image of each target part and the face image includes:
[0029] Performing grayscale processing on the face image to obtain a single-channel target face image;
[0030] The target face image is channel-connected with the target mask image of each target part to obtain a fused image.
[0031] Optionally, determining the first mask image of each target part according to the third mask image of each target part includes:
[0032] When the target part is a first part, determining the third mask image corresponding to the first part as the first mask image corresponding to the first part;
[0033] When the target part is the second part, the first mask image corresponding to the first part is removed from the third mask image corresponding to the second part to obtain the first mask image corresponding to the second part.
[0034] In a second aspect, the present application provides a face image recognition device, the device comprising:
[0035] An acquisition unit, used to acquire a face image to be recognized and key points on the face image;
[0036] A determination unit, used to determine a target mask image of each target part according to key points on the face image;
[0037] An obtaining unit, used for obtaining a weight distribution map of each target part on the face image according to the target mask image of each target part;
[0038] A first utilizing unit, configured to utilize the target mask image of each target part and the face image to obtain a fused image;
[0039] A second utilizing unit is used to call a pre-trained image evaluation model and obtain an expression evaluation score by utilizing the weight distribution map and the fused image;
[0040] The third utilizing unit is used to generate a poster using the face image when the expression evaluation score meets a preset condition.
[0041] Optionally, the determining unit is used to:
[0042] Determining a first mask image corresponding to each target part according to key points on the face image;
[0043] Obtain the weight coefficient corresponding to each target part;
[0044] For each target part, multiplying the first mask image corresponding to the target part by the corresponding weight coefficient to obtain a corresponding second mask image;
[0045] The second mask image corresponding to each target part is processed using a Gaussian blurring scheme to obtain a target mask image of each target part.
[0046] Optionally, the determining unit is used to:
[0047] At the key points on the face image, determining a target key point corresponding to each target part;
[0048] Connect the target key points corresponding to each target part to obtain a closed curve corresponding to each target part;
[0049] According to the closed curve corresponding to each target part, a third mask image of each target part is obtained;
[0050] The first mask image of each target part is determined according to the third mask image of each target part.
[0051] Optionally, the determining unit is used to:
[0052] For each target part, obtaining a curve expansion strategy corresponding to the target part;
[0053] According to the curve expansion strategy, the closed curve corresponding to the target part is expanded to obtain a target closed curve;
[0054] A closed area corresponding to the target closed curve is determined, pixel values within the closed area are set to a first value, and pixel values outside the closed area are set to a second value, to obtain a third mask image corresponding to the target part.
[0055] Optionally, the obtaining unit is used to:
[0056] The target mask images of different target parts are added together to obtain a weight distribution map of each target part on the face image.
[0057] Optionally, the first utilizing unit is used to:
[0058] Performing grayscale processing on the face image to obtain a single-channel target face image;
[0059] The target face image is channel-connected with the target mask image of each target part to obtain a fused image.
[0060] Optionally, the determining unit is used to:
[0061] When the target part is a first part, determining the third mask image corresponding to the first part as the first mask image corresponding to the first part;
[0062] When the target part is the second part, the first mask image corresponding to the first part is removed from the third mask image corresponding to the second part to obtain the first mask image corresponding to the second part.
[0063] In a third aspect, the present application provides a face image recognition device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:
[0064] Obtaining a face image to be recognized and key points on the face image;
[0065] Determining a target mask image for each target part according to key points on the face image;
[0066] According to the target mask image of each target part, a weight distribution map of each target part on the face image is obtained;
[0067] Using the target mask image of each target part and the face image, a fused image is obtained;
[0068] Calling a pre-trained image evaluation model, and using the weight distribution map and the fused image to obtain an expression evaluation score;
[0069] When the expression evaluation score meets a preset condition, a poster is generated using the face image. In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned face image recognition method is implemented.
[0070] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: in the embodiment of the present application, a facial image to be identified and key points on the facial image are obtained; a target mask image of each target part is determined according to the key points on the facial image; a weight distribution map of each target part on the facial image is obtained according to the target mask image of each target part; a fused image is obtained by using the target mask image of each target part and the facial image; a pre-trained image evaluation model is called, and an expression evaluation score is obtained by using the weight distribution map and the fused image; when the expression evaluation score meets the preset conditions, a poster is generated using the facial image. It can be seen that the present application can obtain the expression evaluation score of each facial image, and then determine whether the facial image is qualified according to the expression evaluation score, and generate a poster using the facial image if the facial image is qualified. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0072] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0073] 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.
[0074] Figure 1 A schematic diagram of a facial image recognition method provided in an embodiment of the present application;
[0075] Figure 2 A schematic diagram of key points on a face image provided in an embodiment of the present application;
[0076] Figure 3 A schematic diagram of a target mask image provided in an embodiment of the present application;
[0077] Figure 4 A schematic diagram of a model provided in an embodiment of the present application;
[0078] Figure 5 A schematic diagram of a process of determining a target mask image provided by an embodiment of the present application;
[0079] Figure 6 A schematic flow chart of another method for determining a first mask image provided in an embodiment of the present application;
[0080] Figure 7 A schematic flow chart of a third mask image determination method provided in an embodiment of the present application;
[0081] Figure 8 A schematic diagram of a flow chart of another fused image determination method provided in an embodiment of the present application;
[0082] Fig. 9 A schematic diagram of a process flow of a facial image recognition device provided in an embodiment of the present application;
[0083] Fig.10 A schematic diagram of a facial image recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0085] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0086] Posters are important materials for film and television marketing and promotion. They interpret the theme and connotation of the film and television series, and influence and shape the audience's first impression of the film and television series. It can be said that the poster is the spokesperson for the film and television series itself, and it is inseparable from the reputation of the series. However, for the posters of film and television series, their original materials often come from the screenshots of the film and television series. When using algorithms to automatically produce screenshots in large quantities, the screenshots will inevitably show poor expressions of the characters, such as talking, blinking, looking down, looking up, and other ugly movements. Therefore, how to filter out such images with poor expressions of the characters has become an urgent problem to be solved.
[0087] In order to solve the above problems, the embodiment of the present application provides a method for face image recognition, which can avoid using images of people with poor facial expressions to generate posters, such as Figure 1 As shown, the specific steps include:
[0088] Step 101: Obtain a face image to be recognized and key points on the face image.
[0089] In this step, an image to be identified is obtained. If the image is a face image, key points on the face image can be directly identified. If the image is not a face image, the face in the image can be identified first, and the image can be cropped based on the face to obtain a face image. If there is no face image on the image obtained, the image cannot be determined as the image to be identified and can be directly deleted.
[0090] It should be noted that the execution subject of the embodiment of the present application can be a server or a terminal, which is not limited here. In practice, the terminal can process the image to be recognized based on the method provided in the embodiment of the present application, or upload it to the server so that the server processes the image to be recognized.
[0091] Furthermore, Figure 2 The detection effect of 106 key points is shown. Other key point detection schemes can also be used, such as 240 points, 1000 points, etc.
[0092] Step 102, determining a target mask image for each target part according to key points on the face image.
[0093] Among them, the target parts are eyes, mouth and face. Since eyes, mouth and face reflect expressions to a certain extent, eyes, mouth and face can be determined as target parts.
[0094] In this step, a sequence number set of key points corresponding to each target part is pre-stored. For each target part, the key points corresponding to the target part are found among the key points on the face image according to the corresponding sequence number set, and then the target mask image of the target part is determined according to these key points.
[0095] like Figure 3 As shown, the figure includes a target mask image mask_eye_2 for the eyes, a target mask image mask_mouth_2 for the mouth, and a target mask image mask_face_3 for the face.
[0096] Step 103, obtaining a weight distribution map of each target part on the face image according to the target mask image of each target part.
[0097] In this step, the target mask images of each target part may be added together to obtain a weight distribution map of each target part on the face image.
[0098] Further, such as Figure 3 As shown, the pixel values at the same position of each target mask image are added to obtain a weight distribution map of each target part on the face image. Specifically, the weight distribution map mask_weight = mask_eye_2 + mask_mouth_2 + mask_face_3, where mask_eye_2 is the target mask image of the eye, mask_mouth_2 is the target mask image of the mouth, and mask_face_3 is the target mask image of the face.
[0099] Step 104, using each target mask image and the face image, obtain a fused image.
[0100] In this step, the face image and all target mask images may be superimposed to obtain a fused image, or the face image may be processed first and then the processed face image and all target mask images may be superimposed to obtain a fused image. Other methods for obtaining a fused image may also be used, which are not limited here.
[0101] The above-mentioned processing may be a preprocessing operation, such as image denoising, image enhancement, image normalization and other related operations, or may be grayscale processing. In a preferred embodiment, the face image is preprocessed first, and then the preprocessed face image is grayscale processed.
[0102] Step 105, calling a pre-trained image evaluation model, using the weight distribution map and the fused image, to obtain an expression evaluation score.
[0103] The image evaluation model is a neural network model, and the training process of the image evaluation model is similar to the training process in the prior art, which will not be described in detail. The higher the expression evaluation score, the more the face image meets the user's needs, and the lower the expression evaluation score, the less the face image meets the user's needs.
[0104] In this step, the weight distribution map and the fused image can be directly input into a pre-trained image evaluation model to obtain an expression evaluation score, or the weight distribution map and the fused image can be processed separately first, and the processed image can be input into a pre-trained image evaluation model to obtain an expression evaluation score. The processing can be downsampling processing or other processing, which is not limited here.
[0105] Furthermore, the present application embodiment provides an image evaluation model, specifically Figure 4 As shown in the figure, the weight distribution map is downsampled in turn and multiplied with the feature map of the corresponding size. This process is equivalent to manually adjusting the intermediate feature information of the model. According to the weight distribution map, the important area information is retained, the irrelevant area information is eliminated, and different weights are assigned to different areas. When the model training requires an input image size of 224*224, the input image is only 224*224. When the input image size is 224*224, only two downsamplings can be performed. This is because the eye and mouth areas do not account for a large proportion. If the downsampling is too much, the important areas in the weight map will be reduced too much, causing the entire image to be close to 0. Multiplying it with the feature map will cause the feature map output to be almost 0, and the model training will fail. At the same time, if Figure 4 As shown in Figure 1, the weight distribution map has been downsampled twice and multiplied with the processed fusion map respectively, which can further improve the recognition ability of the basic neural network model.
[0106] Step 106: When the expression evaluation score meets a preset condition, a poster is generated using the face image.
[0107] The preset condition is that the expression evaluation score is greater than a preset value, and the preset value can be set by a technician based on experience. For example, when the expression evaluation score is greater than the preset value, it is determined that the expression evaluation score meets the preset condition, indicating that the face image is qualified and the poster can be generated using the face image. When the expression evaluation score is not greater than the preset value, it is determined that the expression evaluation score does not meet the preset condition, indicating that the face image is unqualified and the poster cannot be generated using the face image.
[0108] In the embodiment of the present application, a face image to be identified and key points on the face image are obtained; a target mask image of each target part is determined based on the key points on the face image; a weight distribution map of each target part on the face image is obtained based on the target mask image of each target part; a fused image is obtained using the target mask image of each target part and the face image; a pre-trained image evaluation model is called, and an expression evaluation score is obtained using the weight distribution map and the fused image; when the expression evaluation score meets the preset conditions, a poster is generated using the face image. It can be seen that the present application can obtain the expression evaluation score of each face image, and then determine whether the face image is qualified based on the expression evaluation score, and generate a poster using the face image if the face image is qualified.
[0109] In the embodiment of the present application, the first mask image corresponding to each target part can also be determined according to the key points on the face image, and then the corresponding first mask image is processed according to the weight coefficient and Gaussian blur scheme corresponding to each target part to obtain the target mask image of each target part. Therefore, the embodiment of the present application provides a method for determining a target mask image. Figure 5 As shown, the specific steps include:
[0110] Step 501: Determine a first mask image corresponding to each target part according to key points on the face image.
[0111] In this step, the target parts are eyes, mouth and face. This step can determine the first mask images corresponding to the eyes, mouth and face respectively according to the key points on the face image.
[0112] Step 502: Obtain the weight coefficient corresponding to each target part.
[0113] In this step, since different target parts have different influences on expressions, different target parts have different corresponding weight coefficients. For example, when making expressions, it is difficult for facial muscles to change significantly, so the influence of the face on expressions is relatively small. For another example, when the nostrils are too large, the facial expressions presented are often not good. For another example, when making expressions, the eyes can change significantly, so the eyes have a certain influence on the expressions. For another example, when making expressions, the mouth can change significantly, so the mouth also has a certain influence on the expressions.
[0114] Based on the above, the weight coefficient corresponding to the face can be set to 0.3, the weight coefficient corresponding to the mouth can be set to 1, and the weight coefficient corresponding to the eyes can also be set to 1.
[0115] Step 503: for each target part, multiply the first mask image corresponding to the target part by the corresponding weight coefficient to obtain the corresponding second mask image.
[0116] In this step, for each target part, each pixel value in the corresponding first mask is obtained, and each pixel value is multiplied by the corresponding weight coefficient to obtain the corresponding second mask image.
[0117] It should be noted that when the weight coefficient corresponding to the target part is 1, it means that there is no need to adjust the corresponding first mask image, so the corresponding first mask image can be determined as the corresponding second mask image. Therefore, for each target part, it is also possible to detect whether the weight coefficient corresponding to the target part is 1. If it is not 1, the first mask image corresponding to the target part is adjusted based on the weight coefficient. If it is 1, the corresponding first mask image is determined as the second mask image.
[0118] Step 504 : Use a Gaussian blur algorithm to process the second mask image corresponding to each target part to obtain a target mask image of each target part.
[0119] Among them, Gaussian Blur is an image blur processing technology, which is widely used in the fields of image processing and computer vision.
[0120] In this step, a Gaussian blur algorithm is used to process the image edge in the second mask image corresponding to each target part to obtain a target mask image of each target part.
[0121] In the embodiment of the present application, the target key points corresponding to each target part can be found among the key points on the face image, and then a closed curve composed of these target key points can be obtained. Then, the first mask image of each target part can be determined according to the closed curve corresponding to each target part. Therefore, the embodiment of the present application provides a method for determining the first mask image. Figure 6 As shown, the specific steps include:
[0122] Step 601, determining the target key points corresponding to each target part at the key points on the face image.
[0123] In this step, the key point serial number corresponding to each target part is stored in advance. For each target part, according to the corresponding key point serial number, the corresponding key point is found among the key points on the face image, and these key points are determined as target key points.
[0124] Step 602, connecting the target key points corresponding to each target part to obtain a closed curve corresponding to each target part.
[0125] In this step, the connection sequence corresponding to each target part is also stored. For each target part, the corresponding target key points are connected according to the corresponding connection sequence to obtain a closed curve corresponding to the target part.
[0126] Specifically, the key points of the lower edge of the eyebrow and the key points of the eyes are combined into a closed curve, all the key points of the mouth are combined into a closed curve, and the key points of the upper edge of the eyebrow and the facial contour are combined into a closed curve.
[0127] Step 603: Obtain a third mask image of each target part according to the closed curve corresponding to each target part.
[0128] In this step, for each target part, in the image, the pixel value in the corresponding closed curve is set to the first value, and the pixel value outside the closed area is set to the second value, to obtain a third mask image. Alternatively, for each target part, the curve expansion ratio corresponding to the target part is obtained, the closed curve is expanded to obtain a target closed curve, the pixel value in the target closed curve is set to the first value, and the pixel value outside the curve is set to the second value, to obtain a third mask image.
[0129] Step 604: Determine the first mask image of each target part according to the third mask image of each target part.
[0130] In this step, for the eyes and mouth, the corresponding third mask image is determined as the first mask image. When there are images of the eyes and mouth on the face image, it is also necessary to delete the images of the eyes and mouth on the face image. Therefore, for the face, the third mask images of other parts in the corresponding third mask image are removed to obtain the first mask image corresponding to the face. The specific steps are: when the target part is the first part, the third mask image corresponding to the first part is determined as the first mask image corresponding to the first part. When the target part is the second part, in the third mask image corresponding to the second part, the first mask image corresponding to the first part is removed to obtain the first mask image corresponding to the second part.
[0131] The first part is the eyes and the mouth. The first part is the face.
[0132] In this step, it is detected whether the target part is the first part. When the target part is the eye or the mouth, the third mask image corresponding to the first part is determined as the first mask image corresponding to the first part. When the target part is the face, the first mask image corresponding to the first part is removed from the third mask image corresponding to the second part to obtain the first mask image corresponding to the second part.
[0133] In the embodiment of the present application, the third mask image of each target part can also be obtained according to the closed curve corresponding to each target part. Therefore, the embodiment of the present application provides a method for determining the third mask image. Figure 7 As shown, the specific steps include:
[0134] Step 701: For each target part, obtain the curve expansion ratio corresponding to the target part.
[0135] The curve expansion ratio corresponding to each target part may be the same or different. The curve expansion ratio corresponding to each target part may be set by a technician based on experience, for example, the curve expansion ratio of each target part is 5%, or may be determined by other methods, which are not limited here. For example, the corresponding curve expansion ratio is determined based on the area of the closed curve corresponding to the target part. Specifically, when the area of the closed curve corresponding to the target part is larger, the corresponding curve expansion ratio is larger, and when the area of the closed curve corresponding to the target part is smaller, the corresponding curve expansion ratio is smaller.
[0136] In this step, the curve expansion ratio corresponding to each target part is pre-stored, so that when step 501 needs to be executed, the curve expansion ratio corresponding to each target part is obtained.
[0137] Step 702 , performing an outward expansion process on the closed curve corresponding to the target part according to the curve outward expansion ratio to obtain a target closed curve.
[0138] In this step, for each closed curve corresponding to the target part, the overall width of the curve is expanded outward by 5% of the image width to obtain the target closed curve.
[0139] Step 703, determining the closed area corresponding to the target closed curve, setting the pixel values in the closed area to the first value, and setting the pixel values outside the closed area to the second value, to obtain a third mask image corresponding to the target part.
[0140] The first value and the second value are set according to the experience of the technicians, and the first value is larger than the second value. Generally, the first value is set to 1 and the second value is set to 0. Specifically, in the face image, the closed area encircled by the target closed curve is determined, the pixel value in the closed area is set to 1, and the pixel value outside the closed area is set to 0, to obtain a third mask image corresponding to the target part.
[0141] In the embodiment of the present application, the target mask image of each target part and the face image can also be used to obtain a fused image. Therefore, the embodiment of the present application also provides a fused image determination method, which is as follows: Figure 8 As shown, the specific steps include:
[0142] Step 801, grayscale processing is performed on the face image to obtain a single-channel target face image.
[0143] Among them, grayscale processing is the process of converting a color image into a grayscale image. Common grayscale processing methods include the average method, the weighted average method, and the like.
[0144] Step 802: Channel-connect the target face image and the target mask image of each target part to obtain a fused image.
[0145] In this step, generally speaking, images of four channels are usually recognized. Therefore, when the number of target mask images is 3, the target face image and each target mask image are channel-connected to obtain a fused image. When the number of target mask images is greater than 3, the target mask images can be merged to obtain three target mask images. For example, the target mask images corresponding to the eyes, mouth, and face can be respectively connected to the target mask image corresponding to the mouth, and then the target face image and each target mask image are channel-connected to obtain a fused image.
[0146] like Fig. 9 As shown, the embodiment of the present application provides a face image recognition device, which corresponds to the method embodiment and specifically includes:
[0147] An acquisition unit 901 is used to acquire a face image to be recognized and key points on the face image;
[0148] A determination unit 902, configured to determine a target mask image of each target part according to key points on the face image;
[0149] An obtaining unit 903 is used to obtain a weight distribution map of each target part on the face image according to the target mask image of each target part;
[0150] A first utilizing unit 904 is used to utilize the target mask image of each target part and the face image to obtain a fused image;
[0151] The second utilizing unit 905 is used to call a pre-trained image evaluation model and obtain an expression evaluation score by utilizing the weight distribution map and the fused image;
[0152] The third utilizing unit 906 is configured to generate a poster using the face image when the expression evaluation score meets a preset condition.
[0153] Optionally, the determining unit 902 is configured to:
[0154] Determining a first mask image corresponding to each target part according to key points on the face image;
[0155] Obtain the weight coefficient corresponding to each target part;
[0156] For each target part, multiplying the first mask image corresponding to the target part by the corresponding weight coefficient to obtain a corresponding second mask image;
[0157] The second mask image corresponding to each target part is processed using a Gaussian blurring scheme to obtain a target mask image of each target part.
[0158] Optionally, the determining unit 902 is configured to:
[0159] At the key points on the face image, determining a target key point corresponding to each target part;
[0160] Connect the target key points corresponding to each target part to obtain a closed curve corresponding to each target part;
[0161] According to the closed curve corresponding to each target part, a third mask image of each target part is obtained;
[0162] The first mask image of each target part is determined according to the third mask image of each target part.
[0163] Optionally, the determining unit 902 is configured to:
[0164] For each target part, obtaining a curve expansion strategy corresponding to the target part;
[0165] According to the curve expansion strategy, the closed curve corresponding to the target part is expanded to obtain a target closed curve;
[0166] A closed area corresponding to the target closed curve is determined, pixel values within the closed area are set to a first value, and pixel values outside the closed area are set to a second value, to obtain a third mask image corresponding to the target part.
[0167] Optionally, the obtaining unit 903 is used to:
[0168] The target mask images of different target parts are added together to obtain a weight distribution map of each target part on the face image.
[0169] Optionally, the first utilizing unit 904 is configured to:
[0170] Performing grayscale processing on the face image to obtain a single-channel target face image;
[0171] The target face image is channel-connected with the target mask image of each target part to obtain a fused image.
[0172] Optionally, the determining unit 902 is configured to:
[0173] When the target part is a first part, determining the third mask image corresponding to the first part as the first mask image corresponding to the first part;
[0174] When the target part is the second part, the first mask image corresponding to the first part is removed from the third mask image corresponding to the second part to obtain the first mask image corresponding to the second part.
[0175] like Fig.10 As shown, the embodiment of the present application provides a face image recognition device, including a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.
[0176] Memory 1003, used for storing computer programs;
[0177] In one embodiment of the present application, the processor 1001 is used to execute the program stored in the memory 1003 to implement the face image recognition method provided by any of the above method embodiments, including:
[0178] Obtaining a face image to be recognized and key points on the face image;
[0179] Determining a target mask image for each target part according to key points on the face image;
[0180] According to the target mask image of each target part, a weight distribution map of each target part on the face image is obtained;
[0181] Using the target mask image of each target part and the face image, a fused image is obtained;
[0182] Calling a pre-trained image evaluation model, and using the weight distribution map and the fused image to obtain an expression evaluation score;
[0183] When the expression evaluation score meets a preset condition, a poster is generated using the face image.
[0184] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps performed by the face image recognition method provided in any of the aforementioned method embodiments are implemented.
[0185] 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 shown as units may or may not be physical units, that is, they may be located in one place or 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.
[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0187] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described in the text are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0188] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A facial image recognition method, characterized in that: The method comprises: Obtaining a face image to be recognized and key points on the face image; Determining a target mask image for each target part according to key points on the face image; According to the target mask image of each target part, a weight distribution map of each target part on the face image is obtained; Using the target mask image of each target part and the face image, a fused image is obtained; Calling a pre-trained image evaluation model, and using the weight distribution map and the fused image to obtain an expression evaluation score; When the expression evaluation score meets a preset condition, a poster is generated using the face image.
2. The method according to claim 1, characterized in that: Determining a target mask image of each target part according to the key points on the face image includes: Determining a first mask image corresponding to each target part according to key points on the face image; Obtain the weight coefficient corresponding to each target part; For each target part, multiplying the first mask image corresponding to the target part by the corresponding weight coefficient to obtain a corresponding second mask image; The second mask image corresponding to each target part is processed using a Gaussian blurring scheme to obtain a target mask image of each target part.
3. The method according to claim 2, characterized in that: The step of determining the first mask image corresponding to each target part according to the key points on the face image includes: At the key points on the face image, determining a target key point corresponding to each target part; Connect the target key points corresponding to each target part to obtain a closed curve corresponding to each target part; According to the closed curve corresponding to each target part, a third mask image of each target part is obtained; The first mask image of each target part is determined according to the third mask image of each target part.
4. The method according to claim 3, characterized in that: The step of obtaining a third mask image of each target part according to the closed curve corresponding to each target part includes: For each target part, obtaining a curve expansion strategy corresponding to the target part; According to the curve expansion strategy, the closed curve corresponding to the target part is expanded to obtain a target closed curve; A closed area corresponding to the target closed curve is determined, pixel values within the closed area are set to a first value, and pixel values outside the closed area are set to a second value, to obtain a third mask image corresponding to the target part.
5. The method according to claim 1, characterized in that: The step of obtaining a weight distribution map of each target part on the face image according to the target mask image of each target part includes: The target mask images of different target parts are added together to obtain a weight distribution map of each target part on the face image.
6. The method according to claim 1, characterized in that: The method of obtaining a fused image by using the target mask image of each target part and the face image comprises: Performing grayscale processing on the face image to obtain a single-channel target face image; The target face image is channel-connected with the target mask image of each target part to obtain a fused image.
7. The method according to claim 4, characterized in that: Determining the first mask image of each target part according to the third mask image of each target part includes: When the target part is a first part, determining the third mask image corresponding to the first part as the first mask image corresponding to the first part; When the target part is the second part, the first mask image corresponding to the first part is removed from the third mask image corresponding to the second part to obtain the first mask image corresponding to the second part.
8. A facial image recognition device, characterized in that: The device comprises: An acquisition unit, used to acquire a face image to be recognized and key points on the face image; A determination unit, used to determine a target mask image of each target part according to key points on the face image; An obtaining unit, used for obtaining a weight distribution map of each target part on the face image according to the target mask image of each target part; A first utilizing unit, configured to utilize the target mask image of each target part and the face image to obtain a fused image; A second utilizing unit is used to call a pre-trained image evaluation model and obtain an expression evaluation score by utilizing the weight distribution map and the fused image; The third utilizing unit is used to generate a poster using the face image when the expression evaluation score meets a preset condition.
9. A facial image recognition device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: Obtaining a face image to be recognized and key points on the face image; Determining a target mask image for each target part according to key points on the face image; According to the target mask image of each target part, a weight distribution map of each target part on the face image is obtained; Using the target mask image of each target part and the face image, a fused image is obtained; Calling a pre-trained image evaluation model, and using the weight distribution map and the fused image to obtain an expression evaluation score; When the expression evaluation score meets a preset condition, a poster is generated using the face image.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the facial image recognition method according to any one of claims 1 to 7 is implemented.