Hair style identification method and device, equipment and storage medium

By using the face recognition model to intercept the hairstyle area image in the neural network model and perform occlusion image superimposition, the problem of insufficient attention and high misjudgment rate in hairstyle recognition is solved, and the recognition accuracy and enterprise decision support capabilities are improved.

CN119672776APending Publication Date: 2025-03-21PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411708527.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

When identifying hairstyles, it is difficult to distinguish details that are easily misleading, resulting in misjudgment and affecting the company's risk analysis and decision-making.

Method used

By acquiring face images, determining the key face identifiers and regions based on the face recognition model, intercepting the hairstyle area image, and generating occlusion images based on the preset occlusion parameters, superimposing images, and generating hairstyle recognition images, thereby improving the attention and accuracy of the model.

Benefits of technology

It improves the attention and accuracy of neural network models in hairstyle recognition, reduces misjudgment, and enhances the decision-making support capabilities of enterprises in risk analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119672776A_ABST
    Figure CN119672776A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, is used for assisting in recognizing the hairstyle of a target object, and particularly discloses a hairstyle recognition method which comprises the steps that a face image is acquired, and based on a face recognition model, multiple face key identifiers and face areas in the face image are determined; based on a face recognition model, determining a hairstyle area in the face image according to the face key identifier and the face area, and intercepting a hairstyle image from the face image according to the hairstyle area; generating a shielding image according to the hair style area and a preset shielding parameter, the shielding image comprising a shielding pattern generated according to the shielding parameter, and the shape of the shielding image being the same as that of the hair style area; and based on the hairstyle recognition model, superposing the hairstyle image and the shielding image to enable the shielding image to cover a corresponding area on the hairstyle image, generating a hairstyle recognition image, and outputting a hairstyle recognition result according to the hairstyle recognition image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a hairstyle recognition method, device, equipment and storage medium. Background Art

[0002] At present, in the financial field, when users apply for insurance and loan services, they need to be interviewed by agents via video. With the development of computer technology, image recognition technology based on artificial intelligence has been widely used, taking over the face-to-face interview work of many agents. For example, when users apply for critical illness insurance, the user's hairstyle is used to determine whether the user has a risk of cancer. Generally, if the user who applies for critical illness insurance is in the chemotherapy stage, the user's hairstyle is likely to be bald and very short, so the hairstyle can assist in judging whether there is a risk of cancer. However, when the user braids his long hair, there is no extra hair around the face, which can easily be identified as a short hair. At this time, the neural network model needs to make auxiliary judgments based on facial features, resulting in the need to identify a larger image area, which leads to the neural network model's lack of attention to details and difficulty in distinguishing details that are easily misled, which in turn leads to misjudgment of the neural network model, causing losses to the company. Summary of the invention

[0003] The present application provides a hairstyle recognition method, apparatus, device and storage medium for improving the attention of a neural network model when performing hairstyle recognition, so as to improve the accuracy of the neural network model.

[0004] In a first aspect, the present application provides a hairstyle recognition method, the method comprising:

[0005] Acquire a facial image, and determine a plurality of facial key identifiers and facial regions in the facial image based on a facial recognition model;

[0006] Based on the face recognition model, determining a hairstyle region in the face image according to the face key identifier and the face region, and intercepting a hairstyle image in the face image according to the hairstyle region;

[0007] generating an occlusion image according to the hairstyle region and preset occlusion parameters, wherein the occlusion image includes an occlusion figure generated according to the occlusion parameters, and the shape of the occlusion image is the same as that of the hairstyle region;

[0008] Based on the hairstyle recognition model, the hairstyle image and the occlusion image are superimposed so that the occlusion pattern covers the corresponding area on the hairstyle image, a hairstyle recognition image is generated, and a hairstyle recognition result is output according to the hairstyle recognition image.

[0009] In a second aspect, the present application provides a hairstyle recognition device, the device comprising: a face recognition module, an image capture module, an image generation module and a result output module;

[0010] A face recognition module, used to obtain a face image and determine a plurality of face key identifiers and face areas in the face image based on a face recognition model;

[0011] An image capture module, configured to determine a hairstyle region in the face image based on the face recognition model, according to the face key identifier and the face region, and capture a hairstyle image in the face image based on the hairstyle region;

[0012] An image generation module, configured to generate an occlusion image according to the hairstyle region and preset occlusion parameters, wherein the occlusion image includes an occlusion figure generated according to the occlusion parameters, and the shape of the occlusion image is the same as that of the hairstyle region;

[0013] The result output module is used to superimpose the hairstyle image and the occlusion image based on the hairstyle recognition model so that the occlusion pattern covers the corresponding area on the hairstyle image, generate a hairstyle recognition image, and output the hairstyle recognition result according to the hairstyle recognition image.

[0014] In a third aspect, the present application provides a computer device, the computer device comprising a memory and a processor;

[0015] The memory is used to store computer programs;

[0016] The processor is used to execute the computer program and implement any one of the hairstyle recognition methods provided in the embodiments of the present application when executing the computer program.

[0017] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements any one of the hairstyle recognition methods provided in the embodiments of the present application.

[0018] The present application discloses a hairstyle recognition method, comprising: obtaining a face image, determining multiple face key identifiers and face regions in the face image based on a face recognition model; determining a hairstyle region in the face image based on the face key identifiers and face regions based on the face recognition model, and intercepting a hairstyle image in the face image based on the hairstyle region; generating an occlusion image based on the hairstyle region and a preset occlusion parameter, the occlusion image including an occlusion figure generated based on the occlusion parameter, and the shape of the occlusion image being the same as the hairstyle region; based on the hairstyle recognition model, superimposing the hairstyle image and the occlusion image so that the occlusion figure covers the corresponding region on the hairstyle image, generating a hairstyle recognition image, and outputting a hairstyle recognition result based on the hairstyle recognition image. In the above process, the hairstyle image is intercepted from the face image through the face recognition model, and then the hairstyle image is input into the hairstyle recognition model, thereby reducing the image area that the hairstyle recognition model needs to detect, and then the hairstyle image is occluded through the occlusion image to shield the non-hairstyle features in the hairstyle image, thereby improving the attention of the hairstyle recognition model, thereby improving the accuracy of the hairstyle recognition model, and effectively preventing misjudgment of hairstyle recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 This is an application scenario diagram of a hairstyle recognition method provided in an embodiment of the present application;

[0021] Figure 2 is a schematic flow chart of a hairstyle recognition method provided in an embodiment of the present application;

[0022] Figure 3 is a schematic diagram of an image recognition result provided by an embodiment of the present application;

[0023] Figure 4 is a schematic diagram of an occluded image provided in an embodiment of the present application;

[0024] Figure 5 is a schematic diagram of a hairstyle recognition model provided in an embodiment of the present application;

[0025] Figure 6 is a schematic block diagram of a hairstyle recognition device provided in an embodiment of the present application;

[0026] Figure 7 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0029] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0030] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0031] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0032] See also Figure 1 , Figure 1 FIG. 1 shows an application scenario diagram of a hairstyle recognition method provided by an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application can be applied to a face recognition platform, specifically, to a server of the face recognition platform, which can be run in a server or other computing device, and is used to obtain a face image uploaded by the user to be evaluated on the client, and finally output a hairstyle recognition result of the face image, so as to assist the agent in risk analysis. The client runs in a terminal device that forms the user to be evaluated, and obtains a face image uploaded by the user to be evaluated on the client. The server and the client can be connected to each other through a wireless network.

[0033] When installing the hairstyle recognition method application in the terminal device and the server, the terminal device and the server need to authorize corresponding permissions, such as the permissions to obtain basic attribute information of the terminal device and the server, the permission to read the album, the location information device number and the network information.

[0034] The server may be an independent server or a server cluster, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device may be an electronic device such as a mobile phone, tablet computer, laptop computer, desktop computer, personal digital assistant, and wearable device.

[0035] It should also be noted that the embodiments of the present application can acquire and process relevant data based on artificial intelligence technology, such as acquiring the log data through artificial intelligence, extracting key fields in the log data, and generating a log analysis report based on the key fields. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0036] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0037] See also Figure 2 , Figure 2 is a schematic flow chart of a hairstyle recognition method provided by the present application. Figure 2 As shown, the specific steps of the hairstyle recognition method include: S101-S104.

[0038] S101, obtaining a face image, and determining a plurality of face key identifiers and face regions in the face image based on a face recognition model.

[0039] Exemplarily, a facial image of the user to be evaluated is obtained. The facial image can be captured when the user to be evaluated and the agent are having a real-time video call, and uploaded to the server. The server can analyze the facial image by loading a facial recognition model to identify facial features in the facial image, including cheeks, nose, lips, chin, eyebrows and eyes, and annotate the above features with facial key markers to indicate the contours of the above facial features. Thereafter, the facial area is determined based on the facial key markers on the facial image.

[0040] Based on a face recognition model, multiple face key markers and face areas in a face image are determined, including: performing feature recognition on the face image to generate multiple face key markers, where the face key markers are used to mark the facial features of the face image; determining a first edge marker, a second edge marker, a third edge marker and a fourth edge marker according to the distances between the multiple face key markers, wherein the first edge marker and the second edge marker are farthest apart in a first direction, the third edge marker and the fourth edge marker are farthest apart in a second direction, and the first direction and the second direction are perpendicular; and determining the face area according to the first edge marker, the second edge marker, the third edge marker and the fourth edge marker.

[0041] In some embodiments, see Figure 3 , Figure 3 A schematic diagram showing an image recognition result provided by an embodiment of the present application. Figure 3 As shown, after a face image is analyzed by a face recognition model, 98 face key marks and face rectangular frames (i.e., face areas) are marked on the cheeks, nose, lips, chin, eyebrows, and eyes in the face image. The four boundaries of the face rectangular frame are determined by the first edge mark, the second edge mark, the third edge mark, and the fourth edge mark among the 98 face key points. Among them, the face key marks of the two "cheeks" farthest in the first direction are determined as the first edge mark and the second edge mark; the face key marks of the "eyebrows" and "chin" farthest in the second direction are determined as the third edge mark and the fourth edge mark. The upper boundary of the face rectangular frame is parallel to the first direction, and there is a preset distance between it and the third edge mark; the left and right boundaries of the face rectangular frame pass through the first edge mark and the second edge mark respectively, and are both parallel to the second direction; the lower boundary of the face rectangular frame passes through the fourth edge mark and is parallel to the first direction.

[0042] In practice, it is known that the structures on the face are all in a certain proportion. After the face area is determined by the face recognition model, the structure of the face can be highlighted to facilitate subsequent hairstyle analysis.

[0043] S102: Based on the face recognition model, determine the hairstyle area in the face image according to the face key identifier and the face area, and capture the hairstyle image in the face image according to the hairstyle area.

[0044] For example, the structures on the face are all in a certain proportion. In order to accurately extract the hairstyle area in the face image, it is necessary to use the face key mark and the face area to assist in dividing the hairstyle area. The hair is above the eyebrows, so the face key mark corresponding to the "eyebrows" and the height of the face area are used as the basis for dividing the lower boundary of the hairstyle area. The width of the head circumference and the width of the face are often in a certain proportion, so the face key marks of the two farthest "cheeks" and the left and right widths of the face area are used as the basis for dividing the left and right boundaries of the hairstyle area.

[0045] In some embodiments, based on a face recognition model, a hairstyle area in a face image is determined according to face key identifiers and a face area, including: obtaining the width and height of the face area; determining a first boundary and a second boundary according to a first edge identifier, a second edge identifier, and the width of the face area, wherein the first boundary and the second boundary are both parallel to the second direction; determining a third boundary and a fourth boundary according to a third edge identifier and the height of the face area, wherein the third boundary and the fourth boundary are parallel to the first direction; and determining a hairstyle area according to the first boundary, the second boundary, the third boundary, and the fourth boundary.

[0046] Specifically, Figure 3 As shown, the first boundary and the second boundary of the hairstyle area are parallel to the second direction, the distance between the first boundary and the left boundary of the face area is 0.05W, W is the width of the face area, and the distance between the second boundary and the right boundary of the face area is 0.05W. The third boundary of the hairstyle area passes through the third edge mark and is parallel to the first direction. The distance between the third boundary and the fourth boundary is 0.5H, H is the height of the face area.

[0047] The coordinate system is established with the upper left corner of the face image as the origin of the coordinate system. The horizontal coordinate of the first edge marker is x1, the horizontal coordinate of the second edge marker is x2, and the vertical coordinate of the third edge marker is y1. The boundary calculation formula for calculating the hairstyle area is:

[0048] x min =x1-0.05*width;

[0049] x max =x2+0.05*width;

[0050] y min =y1-0.5*height;

[0051] y max =y1;

[0052] Among them, x min is the horizontal coordinate of the line where the first boundary is located, x max is the horizontal coordinate of the line where the second boundary is located, y maxis the ordinate of the line where the third boundary is located, y min is the ordinate of the line where the fourth boundary lies.

[0053] It should be noted that the coefficients (0.05 and 0.5) in the boundary calculation formula of the above-mentioned hairstyle area are only example values ​​given to more clearly illustrate the embodiments of the present application, and are not unique values. 0.05 can also be replaced by values ​​such as 0.055 or 0.06, and 0.5 can also be replaced by values ​​such as 0.51 or 0.53, and there is no limitation here.

[0054] It should be noted that in the embodiment of the present application, for the sake of ease of explanation, rectangular frames are used in the face area and the hairstyle area. In actual applications, frames of other shapes may also be used, such as an elliptical frame or a polygonal frame, which is not limited here.

[0055] S103, generating an occlusion image according to the hairstyle region and preset occlusion parameters, wherein the occlusion image includes an occlusion graphic generated according to the occlusion parameters, and the shape of the occlusion image is the same as that of the hairstyle region.

[0056] For example, the captured hairstyle image still has some interference information, which may affect the result of hairstyle recognition in the subsequent hairstyle recognition process. Therefore, the embodiment of the present application shields part of the interference information in the hairstyle image by using an occlusion image. Generally, the size of the occlusion image is the same as the size of the hairstyle image, so that it is convenient to superimpose the occlusion image and the hairstyle image. The occlusion image includes an occlusion pattern, and the pattern boundary of the occlusion pattern is determined according to the occlusion parameters. By modifying the occlusion parameters, the shape of the occlusion pattern can be modified.

[0057] In some embodiments, an occlusion frame is generated based on the hairstyle area, and the shape of the occlusion frame is the same as the shape of the hairstyle area; an occlusion boundary is determined in the occlusion frame based on the occlusion parameters, and the occlusion boundary is used to enclose and form an occlusion figure; and an occlusion image is generated based on the occlusion frame and the occlusion figure.

[0058] See also Figure 4 , Figure 4 A schematic diagram of an occluded image provided by an embodiment of the present application is shown. Figure 4As shown, the black filled part in the occlusion image is the occlusion figure, the value of the area to which the occlusion figure belongs is set to 0, and the value of other areas is set to 1. When generating the occlusion figure, the occlusion parameters that need to be input include x1=1 / 4h, x2=3 / 4h, y1=1 / 4w and y2=3 / 4w, where h is the height of the hairstyle image, w is the width of the hairstyle image, and the figure surrounded by x1, x2, y1, y2 and the boundary of the occlusion image is the occlusion figure. The above occlusion parameters are only used as examples for explanation and are not used to limit this application. According to the needs of actual applications, the above occlusion parameters can be modified to form different occlusion figures. The shape of the occlusion figure also includes semi-ellipse, polygon, etc., which are not limited here.

[0059] By blocking the image, a forced attention mechanism is formed, which is equivalent to forcing the hairstyle recognition model to pay attention to the hair area. Compared with smoother automatic attention mechanisms such as SE, it reduces the amount of calculation required for the recognition process and improves the calculation speed and accuracy of the results.

[0060] S104, based on the hairstyle recognition model, superimposing the hairstyle image and the occlusion image so that the occlusion pattern covers the corresponding area on the hairstyle image, generating a hairstyle recognition image, and outputting a hairstyle recognition result according to the hairstyle recognition image.

[0061] For example, the hairstyle recognition model is built through a classification network, such as ResNet, MobileNet, etc. Figure 5 , Figure 5 A schematic diagram of a hairstyle recognition model provided by an embodiment of the present application is shown. Figure 5 As shown in the figure, the hairstyle recognition model includes neural network layers such as Conv (convolution layer), BN (normalization layer), ReLU (activation layer), Down (downsampling layer), FC (fully connected layer) and out (output layer). In the recognition process, it is necessary to introduce occlusion images multiple times between neural network layers.

[0062] In some embodiments, based on the hairstyle recognition model, the hairstyle image and the occlusion image are superimposed, including: inputting the hairstyle image into the convolution layer and the normalization layer of the hairstyle recognition model to generate a reduced hairstyle image; compressing the occlusion image to generate a reduced occlusion image, the shape of the reduced occlusion image is the same as the shape of the reduced hairstyle image; and superimposing the reduced hairstyle image and the reduced occlusion image.

[0063] For example, after the hairstyle image is processed by the convolution layer and the normalization layer, a reduced hairstyle image is obtained. Therefore, the occluded image needs to be proportionally compressed, that is, before the occluded image is input into the hairstyle recognition model, the occluded image is resized to ensure that the reduced hairstyle image and the reduced occluded image are of the same size.

[0064] In some embodiments, superimposing the reduced hairstyle image and the reduced occlusion image includes: performing phase multiplication on the reduced hairstyle image and the reduced occlusion image.

[0065] In some implementations, the hairstyle recognition results include a first type, a second type, and a third type, and outputting the hairstyle recognition results based on the hairstyle recognition image includes: detecting the hair length and hair texture in the hairstyle recognition image; when the hair length is detected to be zero, outputting the hairstyle recognition result as the first type; when the hair length is detected to be less than a preset threshold and the hair texture does not contain a preset texture, outputting the hairstyle recognition result as the second type; when the hair length is detected to be less than a preset threshold and the hair texture contains a preset texture, outputting the hairstyle recognition result as the third type.

[0066] Exemplarily, when the hair length is zero, the corresponding hairstyle is "bald", that is, the first type is "bald". When the hair length is less than a preset threshold, for example, the preset threshold is 1 cm, and the hair texture does not contain the preset texture, the corresponding hairstyle is "crew cut", that is, the second type is "crew cut". Among them, the preset threshold can be adjusted by the user and is not limited here. When the hair length is less than the preset threshold, and the hair texture contains the preset texture, the corresponding hairstyle is long hair, that is, the third type is "long hair". It should be noted that when the user ties his long hair into a ponytail, the hairstyle recognition model may mistakenly recognize the user's hairstyle as "crew cut". Therefore, it is necessary to improve the accuracy of the hairstyle recognition result by identifying the hair texture.

[0067] See also Figure 6 , Figure 6 The embodiment of the present application also provides a schematic block diagram of a hairstyle recognition device, wherein the hairstyle recognition device 300 is used to execute the aforementioned hairstyle recognition method. The hairstyle recognition device can be configured in a server or a terminal device.

[0068] The server may be an independent server or a server cluster, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device may be an electronic device such as a mobile phone, tablet computer, laptop computer, desktop computer, user digital assistant, and wearable device.

[0069] like Figure 6 As shown, the hairstyle recognition device 300 includes: a face recognition module 301, an image capture module 302, an image generation module 303 and a result output module 304.

[0070] The face recognition module 301 is used to obtain a face image and determine a plurality of face key identifiers and face regions in the face image based on a face recognition model.

[0071] In some embodiments, when the face recognition module 301 is used to determine multiple face key identifiers and face areas in a face image based on a face recognition model, it is specifically used to implement: performing feature recognition on the face image to generate multiple face key identifiers, where the face key identifiers are used to indicate the facial features of the face image; determining a first edge identifier, a second edge identifier, a third edge identifier and a fourth edge identifier based on the distances between the multiple face key identifiers, wherein the first edge identifier and the second edge identifier are the farthest apart in the first direction, the third edge identifier and the fourth edge identifier are the farthest apart in the second direction, and the first direction and the second direction are perpendicular; determining the face area based on the first edge identifier, the second edge identifier, the third edge identifier and the fourth edge identifier.

[0072] The image capture module 302 is used to determine the hairstyle area in the face image according to the face key identifier and the face area based on the face recognition model, and capture the hairstyle image in the face image according to the hairstyle area.

[0073] In some embodiments, when the image capture module 302 is used to implement determining the hairstyle area in the face image based on the face recognition model according to the face key identifier and the face area, it is specifically used to implement: obtaining the width and height of the face area; determining the first boundary and the second boundary according to the first edge identifier, the second edge identifier and the width of the face area, and the first boundary and the second boundary are both parallel to the second direction; determining the third boundary and the fourth boundary according to the third edge identifier and the height of the face area, and the third boundary and the fourth boundary are parallel to the first direction; determining the hairstyle area according to the first boundary, the second boundary, the third boundary and the fourth boundary.

[0074] The image generation module 303 is used to generate an occlusion image according to the hairstyle region and preset occlusion parameters. The occlusion image includes an occlusion graphic generated according to the occlusion parameters. The shape of the occlusion image is the same as that of the hairstyle region.

[0075] In some embodiments, when the image generation module 303 is used to generate an occlusion image according to a hairstyle area and preset occlusion parameters, it is specifically used to achieve: generating an occlusion frame according to the hairstyle area, the shape of the occlusion frame is the same as the shape of the hairstyle area; determining an occlusion boundary in the occlusion frame according to the occlusion parameters, the occlusion boundary is used to enclose and form an occlusion figure; generating an occlusion image according to the occlusion frame and the occlusion figure.

[0076] The result output module 304 is used to implement the hairstyle recognition model, superimpose the hairstyle image and the occlusion image so that the occlusion pattern covers the corresponding area on the hairstyle image, generate a hairstyle recognition image, and output the hairstyle recognition result according to the hairstyle recognition image.

[0077] In some embodiments, when the result output module 304 is used to implement the superposition of the hairstyle image and the occlusion image based on the hairstyle recognition model, it is specifically used to implement: inputting the hairstyle image into the convolution layer and the normalization layer of the hairstyle recognition model to generate a reduced hairstyle image; compressing the occlusion image to generate a reduced occlusion image, the shape of the reduced occlusion image is the same as the shape of the reduced hairstyle image; and superimposing the reduced hairstyle image and the reduced occlusion image.

[0078] In some embodiments, when the result output module 304 is used to implement the superposition of the reduced hairstyle image and the reduced occlusion image, it is specifically used to implement: performing phase multiplication on the reduced hairstyle image and the reduced occlusion image.

[0079] In some implementations, when the result output module 304 is used to output a hairstyle recognition result based on a hairstyle recognition image, it is specifically used to implement: detecting the hair length and hair texture in the hairstyle recognition image; when the hair length is detected to be zero, outputting the hairstyle recognition result as a first type; when the hair length is detected to be less than a preset threshold and the hair texture does not contain a preset texture, outputting the hairstyle recognition result as a second type; when the hair length is detected to be less than a preset threshold and the hair texture contains a preset texture, outputting the hairstyle recognition result as a third type.

[0080] It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the hairstyle recognition device and each module described above can refer to the corresponding process in the aforementioned hairstyle recognition method embodiment, and will not be repeated here.

[0081] The above-mentioned hairstyle recognition device can be implemented in the form of a computer program. The computer program can be used in Figure 7 Runs on the computer device shown.

[0082] See also Figure 7 , Figure 7 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal device.

[0083] See also Figure 7 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a storage medium and an internal memory.

[0084] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any one of the hairstyle recognition methods provided in the embodiments of the present application.

[0085] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0086] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any hairstyle recognition method. The storage medium can be non-volatile or volatile.

[0087] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0088] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0089] Exemplarily, in one embodiment, the processor is used to run a computer program stored in a memory to implement the following steps: acquiring a facial image, and determining multiple facial key identifiers and facial areas in the facial image based on a facial recognition model; determining a hairstyle area in the facial image based on the facial key identifiers and the facial area based on the facial recognition model, and capturing a hairstyle image in the facial image based on the hairstyle area; generating an occlusion image based on the hairstyle area and preset occlusion parameters, the occlusion image including an occlusion graphic generated based on the occlusion parameters, and the shape of the occlusion image being the same as the hairstyle area; based on the hairstyle recognition model, superimposing the hairstyle image and the occlusion image so that the occlusion graphic covers the corresponding area on the hairstyle image, generating a hairstyle recognition image, and outputting a hairstyle recognition result based on the hairstyle recognition image.

[0090] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A hairstyle recognition method, characterized in that: The method comprises: Acquire a facial image, and determine a plurality of facial key identifiers and facial regions in the facial image based on a facial recognition model; Based on the face recognition model, determining a hairstyle region in the face image according to the face key identifier and the face region, and intercepting a hairstyle image in the face image according to the hairstyle region; generating an occlusion image according to the hairstyle region and preset occlusion parameters, wherein the occlusion image includes an occlusion figure generated according to the occlusion parameters, and the shape of the occlusion image is the same as that of the hairstyle region; Based on the hairstyle recognition model, the hairstyle image and the occlusion image are superimposed so that the occlusion pattern covers the corresponding area on the hairstyle image, a hairstyle recognition image is generated, and a hairstyle recognition result is output according to the hairstyle recognition image.

2. The hairstyle recognition method according to claim 1, characterized in that: The hairstyle recognition result includes a first type, a second type and a third type, and outputting the hairstyle recognition result according to the hairstyle recognition image includes: detecting hair length and hair texture in the hairstyle recognition image; When detecting that the hair length is zero, outputting the hairstyle recognition result as the first type; When it is detected that the hair length is less than a preset threshold and the hair texture does not contain a preset texture, outputting the hairstyle recognition result as the second type; When it is detected that the hair length is less than the preset threshold and the hair texture includes the preset texture, the hairstyle recognition result is output as the third type.

3. The hairstyle recognition method according to claim 1, characterized in that: The step of superimposing the hairstyle image and the occlusion image based on the hairstyle recognition model includes: Inputting the hairstyle image into the convolution layer and the normalization layer of the hairstyle recognition model to generate a reduced hairstyle image; compressing the occlusion image to generate a reduced occlusion image, wherein the shape of the reduced occlusion image is the same as the shape of the reduced hairstyle image; The reduced hairstyle image and the reduced occlusion image are superimposed.

4. The hairstyle recognition method according to claim 3, characterized in that: The step of superimposing the reduced hairstyle image and the reduced occlusion image comprises: Perform phase multiplication on the reduced hairstyle image and the reduced occlusion image.

5. The hairstyle recognition method according to claim 1, characterized in that: The determining of a plurality of key face identifiers and face regions in the face image based on the face recognition model includes: Performing feature recognition on the face image to generate a plurality of face key identifiers, wherein the face key identifiers are used to indicate the facial features of the face image; Determine a first edge marker, a second edge marker, a third edge marker, and a fourth edge marker according to the distances between the plurality of face key markers, wherein the first edge marker and the second edge marker are farthest apart in a first direction, the third edge marker and the fourth edge marker are farthest apart in a second direction, and the first direction is perpendicular to the second direction; The face area is determined according to the first edge identifier, the second edge identifier, the third edge identifier and the fourth edge identifier.

6. The hairstyle recognition method according to claim 5, characterized in that: The determining the hairstyle region in the face image based on the face recognition model and according to the face key identifier and the face region includes: Obtain the width and height of the face area; Determine a first boundary and a second boundary according to the first edge identifier, the second edge identifier, and the width of the face area, wherein the first boundary and the second boundary are both parallel to a second direction; Determine a third boundary and a fourth boundary according to the third edge marker and the height of the face area, wherein the third boundary and the fourth boundary are parallel to the first direction; The hairstyle region is determined according to the first boundary, the second boundary, the third boundary, and the fourth boundary.

7. The hairstyle recognition method according to any one of claims 1 to 6, characterized in that: The generating of the occlusion image according to the hairstyle area and the preset occlusion parameters includes: generating an occlusion frame according to the hairstyle region, wherein the shape of the occlusion frame is the same as the shape of the hairstyle region; Determine an occlusion boundary in the occlusion frame according to the occlusion parameter, wherein the occlusion boundary is used to enclose and form an occlusion figure; The occlusion image is generated according to the occlusion frame and the occlusion graphic.

8. A hairstyle recognition device, characterized in that: include: A face recognition module, used to obtain a face image and determine a plurality of face key identifiers and face areas in the face image based on a face recognition model; An image capture module, configured to determine a hairstyle region in the face image based on the face recognition model, according to the face key identifier and the face region, and capture a hairstyle image in the face image based on the hairstyle region; An image generation module, configured to generate an occlusion image according to the hairstyle region and preset occlusion parameters, wherein the occlusion image includes an occlusion figure generated according to the occlusion parameters, and the shape of the occlusion image is the same as that of the hairstyle region; The result output module is used to superimpose the hairstyle image and the occlusion image based on the hairstyle recognition model so that the occlusion pattern covers the corresponding area on the hairstyle image, generate a hairstyle recognition image, and output the hairstyle recognition result according to the hairstyle recognition image.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the hairstyle recognition method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the hairstyle recognition method according to any one of claims 1 to 7.