WO2022257456A1 - Hair information recognition method, apparatus and device, and storage medium - Google Patents

Hair information recognition method, apparatus and device, and storage medium Download PDF

Info

Publication number
WO2022257456A1
WO2022257456A1 PCT/CN2022/071475 CN2022071475W WO2022257456A1 WO 2022257456 A1 WO2022257456 A1 WO 2022257456A1 CN 2022071475 W CN2022071475 W CN 2022071475W WO 2022257456 A1 WO2022257456 A1 WO 2022257456A1
Authority
WO
WIPO (PCT)
Prior art keywords
hair
information
face
face image
image
Prior art date
Application number
PCT/CN2022/071475
Other languages
French (fr)
Chinese (zh)
Inventor
朱磊
朱运
张霖
俞丽娟
朱艳乔
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022257456A1 publication Critical patent/WO2022257456A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/166Detection; Localisation; Normalisation using acquisition arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships

Definitions

  • the present application relates to the field of artificial intelligence, in particular to a hair information recognition method, device, equipment and storage medium.
  • the popularity of mobile terminals provides users with great convenience. For example, due to the portability of smart terminals, users use mobile phones instead of cameras to take pictures. In the process of taking pictures or processing images, facial information recognition can be carried out on the image. As a step in the whole face, hair also plays an important role in the overall image of a person. In practical applications, the hair details identified Information can also be used for reference in applications. For example, when paying attention to hair health, by identifying the hairline height and hair volume in hair detail information, it can be used as a reference for the hair health of the user to be identified. In the insurance industry, through Identify the length of the bangs of the person in the picture, and adjust the claim settlement strategy for customers with too long bangs who may block the line of sight and have a higher risk of accidents during driving.
  • the hair recognition method in the prior art mainly recognizes the hair region by the pixel gap between the human face and the hair.
  • this recognition method mainly recognizes the entire hair region, which is difficult Accurately and effectively identify many details of hair.
  • the present application provides a hair information recognition method, device, equipment and storage medium, which are used to solve the technical problem of low accuracy in hair detail information recognition in the existing hair recognition methods.
  • the first aspect of the present application provides a hair information recognition method, comprising: acquiring a face image to be recognized; inputting the face image into a pre-trained face key point recognition model for face feature recognition, and obtaining The human face key points of the human face image and coordinate information thereof; the human face image is input into a pre-trained contour recognition model to obtain at least one contour figure of the human face image; according to the human face key point, determine the hair contour graphics of the face image from the contour graphics, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the human face; obtain the hair recognition request input by the user, and analyze The hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier; if the hair recognition task identifier includes a hair detail recognition identifier, then according to the person The coordinate information of the key points of the face and the coordinate information of the hair outline graphics are used to calculate the hair detail information of the human face
  • the second aspect of the present application provides a hair information identification device, including a memory, a processor, and computer-readable instructions stored in the memory and operable on the processor, and the processor executes the computer-readable instructions.
  • the following steps are realized when reading the instruction: obtain the face image to be recognized; input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key of the face image Points and coordinate information thereof; input the face image into a pre-trained contour recognition model to obtain at least one contour figure of the face image; determine from the contour figure according to the key points of the face The hair outline graphic of the face image, and calculate the coordinate information of the hair outline graphic according to the coordinate information of the key points of the face; obtain the hair identification request input by the user, and analyze the hair carried in the hair identification request Recognition task identification, wherein the hair identification task identification includes hair detail identification and/or hairstyle identification; if the hair identification task identification includes hair detail identification, then according to the coordinate information of the key points of the face and the coordinate information of the hair outline
  • the third aspect of the present application provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the computer, the computer is made to perform the following steps: obtain the person to be identified Face image; the face image is input into the pre-trained face key point recognition model to carry out face feature recognition, and the face key point and coordinate information thereof of the face image are obtained; the face image is Input to the pre-trained contour recognition model to obtain at least one contour figure of the human face image; according to the key points of the human face, determine the hair contour figure of the human face image from the contour figure, and according to The coordinate information of the key points of the face is used to calculate the coordinate information of the hair outline graphic; the hair recognition request input by the user is obtained, and the hair recognition task identifier carried in the hair recognition request is analyzed, wherein the hair recognition task identifier includes Hair detail identification and/or hairstyle identification; if the hair identification task identification includes hair detail identification, then according to the coordinate information of the key points of the face and the coordinate
  • the fourth aspect of the present application provides a hair information recognition device, wherein the hair information recognition device includes: a first model input module for inputting the face image into a pre-trained face key point recognition model Perform face feature recognition in the face image to obtain the face key points and coordinate information of the face image; the second model input module is used to input the face image into the pre-trained contour recognition model to obtain the obtained At least one contour figure of the human face image; a hair contour determination module, configured to determine the hair contour figure of the human face image from the contour figure according to the key points of the human face, and determine the hair contour figure of the human face image according to the key points of the human face The coordinate information of the hair outline figure is calculated according to the coordinate information; the task analysis module is used to obtain the hair identification request input by the user, and analyze the hair identification task identification carried in the hair identification request, wherein the hair identification task identification includes Hair detail identification and/or hairstyle identification; hair detail identification module, used for when the hair identification task identification includes hair detail identification, according to the coordinate information of the key points of the human
  • the person of the face image is obtained
  • the coordinate information of the key points of the face and the hair contour graphics of the face image calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the face; obtain the hair recognition request input by the user, and Request to select the corresponding hair recognition task, wherein the hair recognition task includes hair detail recognition and hairstyle recognition; if the hair recognition task is hair detail recognition, then according to the coordinate information of the key points of the face and the hair contour graphics
  • the coordinate information of the human face image is calculated to calculate the hair detail information of the human face image; if the hair recognition task is hairstyle recognition, the hair image features in the human face image are extracted according to the hair contour graphics, and the hair image features are extracted according to the hair image
  • the feature identifies hairstyle information of the face image.
  • this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effective recognition of many hair information improves the recognition accuracy of face images.
  • Fig. 1 is a schematic diagram of the first embodiment of the hair information identification method in the embodiment of the present application
  • Fig. 2 is a schematic diagram of the second embodiment of the hair information identification method in the embodiment of the present application.
  • Fig. 3 is a schematic diagram of the third embodiment of the hair information identification method in the embodiment of the present application.
  • Fig. 4 is a schematic diagram of the fourth embodiment of the hair information identification method in the embodiment of the present application.
  • Fig. 5 is a schematic diagram of a fifth embodiment of the method for identifying hair information in the embodiment of the present application.
  • Fig. 6 is a schematic diagram of an embodiment of the hair information identification device in the embodiment of the present application.
  • Fig. 7 is a schematic diagram of another embodiment of the hair information identification device in the embodiment of the present application.
  • Fig. 8 is a schematic diagram of an embodiment of a device for identifying hair information in the embodiment of the present application.
  • Embodiments of the present application provide a hair information identification method, device, device, and storage medium, which are used to solve the technical problem of low accuracy in identifying detailed hair information in existing hair identification methods.
  • the first embodiment of the method for identifying hair information in the embodiment of the present application includes:
  • the subject of execution of the present application may be a hair information recognition device, and may also be a terminal or a server, which is not specifically limited here.
  • the embodiment of the present application is described by taking the server as an execution subject as an example.
  • the above-mentioned face images can be stored in nodes of a block chain.
  • the face image to be recognized may be a static image or an image such as a photo, or may be a video frame or the like in a dynamic video.
  • the face in the face image may be a frontal face, or a non-frontal face with a certain deflection angle.
  • the face image to be recognized may be an image stored locally, an image acquired from a network or a server, or an image acquired by an image acquisition device, which is not limited in this embodiment.
  • the face image may be all the images in the image to be recognized, or it may be a part of the image in the image to be recognized.
  • the face recognition method recognizes and intercepts the face from the complete image.
  • the intercepted face image should contain all the faces and add part of the background area.
  • the face recognition method may use dlib, or other face recognition methods, which are not limited in this embodiment.
  • the neural network structure used by the face key point recognition model is PFLD (A Practical Facial Landmark Detector), which is a face key point detection model with high precision, fast speed and small model.
  • PFLD uses an auxiliary network to estimate the face pose information of face samples, predicts face pose while training key point regression, and solves the problem of data imbalance by punishing rare and excessively large pose angle samples, thereby improving Prediction accuracy.
  • the neural network structure used by the contour recognition model is PSPNet (Pyramid Scene Parseing Network, Pyramid Scene Parseing Network), and PSPNet can aggregate context information in different regions, thereby improving the ability to obtain global information.
  • PSPNet Pulid Scene Parseing Network, Pyramid Scene Parseing Network
  • PSPNet uses a pre-trained ResNet model with an extended network strategy to extract the feature map.
  • the main network is composed of ResNet101, using the method of residual network, hole convolution and dimensionality reduction convolution (first use 1 *1 reduces the dimension, then uses 3*3 convolution, and then restores the dimension with 1*1).
  • the pyramid pooling module is divided into 4 levels, and the pooling kernel sizes are all, half and a small part of the image, and finally they can be fused into global features Then, the fused global features are concatenated with the original feature map, and finally, the final prediction map is generated through a convolutional layer.
  • the contour recognition model recognizes multiple contour images in the human face image, such as human face contours, hair contours, etc., by determining the left eye key points and right eye key points in the human face key points, and Determine the contour region above the left eye key point and the right eye key point as the hair contour, and determine the hair contour graphics.
  • the facial key point recognition model outputs the position information of the key point of the human face, which is mainly the coordinates of the key points of the human face in the face image, and the coordinates of the key points of the human face can be used to calculate the position of each point in the hair contour graph.
  • the vector between the key points of the face and the outline of the hair can be obtained through the distance between the key points of the face and the outline of the hair, and the vector is split into two directions of the x-axis and the y-axis in the coordinate axis Vector, calculate the coordinate information of each point on the hair outline graphic according to the length of the two directions and the coordinates of the corresponding key points of the face, or calculate the coordinate information of the hair outline graphic through the coordinate origin in the preset coordinate axis.
  • the hair recognition task identification includes the hair detail identification identification, then calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
  • the hair detail information mainly includes information such as hairline height, hair volume, and bangs length.
  • the hairline height, hair volume, etc. in the hair detail information the hair health of the user to be identified is referred to.
  • the insurance industry by identifying the length of the bangs of the person in the picture, the claim settlement strategy is adjusted for the customers whose bangs are too long during the driving process, because they may block the line of sight and the risk of accident may be higher, according to different
  • different types of hair detail information can be obtained through different definitions of hair, such as the length of sideburns, by identifying the vertical distance between the lowest point in the hair contour graph and the line before the two eyes, and dividing it by the calculated face length , the sideburn length can be calculated, and the application does not limit the type of hair detail information.
  • the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphics, and recognize the hairstyle information of the face image according to the hair image features.
  • the face image within the range of the hair outline graphics is processed by a convolutional neural network to extract the hair image features in the face image.
  • the convolutional neural network (Convolutional Neural Network, referred to as CNN) is an artificial neural network. network.
  • the convolutional neural network includes a convolutional layer (Convolutional Layer) and a sub-sampling layer (Pooling Layer).
  • Subsampling is also called pooling (Pooling), usually in two forms: mean subsampling (Mean Pooling) and maximum subsampling (Max Pooling).
  • the pooling operation is an effective way to reduce dimensionality and prevent overfitting. Convolution and subsampling greatly simplify the complexity of the neural network and reduce the parameters of the neural network.
  • a multi-task convolutional neural network is a convolutional neural network that can perform multi-task learning.
  • the multi-task convolutional neural network can have multiple outputs for the input, and each output corresponds to a task, so it can extract multiple hair image features in the face image.
  • the face image by acquiring the face image to be recognized; inputting the face image into a pre-trained face key point recognition model for face feature recognition, obtaining the face key points and their coordinates of the face image Information; the face image is input into the pre-trained contour recognition model to obtain at least one contour figure of the face image; according to the key points of the face, the hair contour figure of the face image is determined from the contour figure, and according to the face Calculate the coordinate information of the hair outline graphics from the coordinate information of the key points; obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or the hairstyle recognition identifier ; If the hair recognition task identification includes the hair detail identification identification, then according to the coordinate information of the key points of the face and the coordinate information of the hair contour graphics, calculate the hair detail information of the face image; if the hair identification task identification includes the hairstyle identification, then according to The hair contour graph extracts the hair image
  • this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effectively identify a lot of hair information.
  • the second embodiment of the hair information identification method in the embodiment of the present application includes:
  • the main face key points used are 68, so the human face
  • the training sample set uses a data set of 300W, a total of 600 pictures, and 68 key points.
  • other key point data sets can also be used, such as the XM2VTS data set with 68 key points.
  • the WFLW data set of 98 key points, etc. are not limited in this application.
  • the neural network structure used is PFLD, which can adjust the loss function according to the pose information of the face image, solve the problem of data imbalance, and improve the accuracy of recognition, so it is necessary to Each key point is marked to obtain the face pose information of each key point.
  • the PRnet model is used to mark the face pose, and three pose data (yaw, pitch, roll) are obtained.
  • C represents different types of faces, including: front face, side face, head up, head down, expression and occlusion, Adjusted according to the number of training samples, Calculated from the master-branch network, Indicates the L2 distance, by calculating the loss value, and judging whether the loss value is less than the preset threshold value, iterative training of PFLD is performed until the loss value is less than the preset threshold value, and the face key point recognition model is obtained.
  • the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
  • the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
  • Steps 206-211 in this embodiment are similar to steps 101-106 in the first embodiment, and will not be repeated here.
  • this embodiment describes in detail the training process of the face key point recognition model.
  • the face key point model in this embodiment uses PFLD, which is a high precision, fast, small model
  • PFLD a high precision, fast, small model
  • the face key point detection model solves the problem of data imbalance by using an auxiliary network to estimate the face pose information of the face sample, thereby improving the accuracy of the model prediction.
  • the third embodiment of the hair information identification method in the embodiment of the present application includes:
  • the training sample set includes sample face images
  • the test set includes test face images
  • the corresponding marking information can be obtained by manually marking each pixel value in the sample face image and the test face image, for example, by manually identifying the hair region and non- In the hair area, the pixel value of the hair area is marked as 1, the pixel value of the non-hair area is marked as 0, and the area marked as 1 is masked to obtain a mask image, and the sample face image is input to the semantic segmentation After the network, the semantic segmentation image is obtained, and the formula of the cross-entropy loss function is as follows:
  • the intersection ratio and pixel accuracy are used as the segmentation evaluation index of the semantic segmentation network, wherein the intersection ratio is calculated by calculating the mask image corresponding to the test set and the semantic segmentation image obtained after inputting the semantic segmentation network after training.
  • the overlap rate between them that is, the ratio of their intersection and union
  • the pixel accuracy is the ratio of the correct pixel value predicted by the semantic segmentation image to the total pixel value between the mask image and the semantic segmentation image, by Determine whether the intersection ratio and pixel accuracy meet the preset standards.
  • the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier
  • the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
  • the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
  • Steps 306-308 in this embodiment are similar to steps 104-106 in the first embodiment, and will not be repeated here.
  • This embodiment describes the training process of the contour recognition model in detail on the basis of the previous embodiment.
  • the contour recognition model can recognize the hair contour according to the pixel values in different regions of the face image, and the recognition accuracy is high, so that the subsequent calculation of hair detail information more precise.
  • the fourth embodiment of the hair information identification method in the embodiment of the present application includes:
  • the hair recognition task identifier includes a hair detail recognition identifier and a hairstyle recognition identifier
  • the hair recognition task identification includes the hair detail identification identification, divide the face image into a left area, a middle area, and a right area according to the coordinate information of the left eye key point and the right eye key point;
  • the formula is:
  • the face length is defined as follows:
  • the connecting line between the key point of the left eye and the key point of the right eye is defined as between_eyes_line, and the point at the bottom of the hair contour graphics in each area is defined as hair_bottom_point, and the formula for calculating the height of the forehead is:
  • forehead_length dist(hair_bottom_point, between_eyes_line)
  • the formula for defining the hairline height is:
  • the height of the forehead is a normalized value between 0 and 1, so the height of the hairline is also a value between 0 and 1.
  • the width of the rectangle is hair_x_len
  • the height is hair_y_len
  • the hair volume area can be roughly expressed as hair_x_len*hair_y_len
  • the construction method can be obtained by obtaining the hair outline
  • the four points on the uppermost edge, the lowermost edge, the leftmost edge, and the rightmost edge of the graph, the vertical distance between the uppermost edge and the lowermost edge is taken as the height of the rectangle, and the distance between the leftmost and rightmost points is The vertical distance of is defined as the height of the rectangle.
  • the face rectangle is obtained by obtaining the four points of the uppermost edge, the lowermost edge, the leftmost edge, and the rightmost point of the key points of the face. Divide the two to get the volume information, the calculation formula is:
  • the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
  • this embodiment describes in detail how to calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair contour figure.
  • the fifth embodiment of the hair information recognition method in the embodiment of the present application includes:
  • the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier
  • the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
  • the hair recognition task identifier includes a hairstyle recognition identifier, then extract the hair image in the face image according to the hair contour graphic;
  • the hair image feature is the image feature about hair extracted from the face image, wherein the image feature is a feature representing the color, texture, shape or spatial relationship of the image.
  • the hair image feature can specifically be the data extracted by the computer device from the hairstyle image, which can represent the color, length or shape of the hair, etc., which can be regarded as the representation or description of the "non-image" of the hairstyle image, Such as numeric values, vectors, matrices, or symbols.
  • the face image within the range of the hair outline graphics can be processed through the convolutional neural network to extract the hair image features in the face image, and a multi-task convolutional neural network may be set for different hairstyle information required Multi-feature extraction is carried out.
  • hairstyle information may include hair length and hair color, including long hair, medium hair, short hair, ultra-short hair, bald head, and tied hair. Hair colors can include: black, brown, blonde, off-white, red, etc.
  • this embodiment describes in detail the process of extracting the hair image features in the face image according to the hair contour graphics, and identifying the hairstyle information of the face image according to the hair image features , extract the hair image in the face image through the hair contour graph; extract the hair image features in the hair image according to the preset multi-task convolutional neural network; perform at least one hairstyle recognition task according to the extracted hair image features, Get at least one hairstyle information.
  • various hair image features can be extracted, and various hairstyle information can be correspondingly obtained.
  • An embodiment of the hair information recognition device in the embodiment of the present application includes:
  • the obtaining module 601 is used to obtain the face image to be recognized;
  • the first model input module 602 is used to input the face image into the pre-trained face key point recognition model for face feature recognition, and obtain the The face key points of the face image and their coordinate information;
  • the second model input module 603 is used to input the face image into a pre-trained contour recognition model to obtain at least one contour of the face image Graphics;
  • hair contour determination module 604 used to determine the hair contour pattern of the human face image from the contour pattern according to the key points of the human face, and calculate the hair contour pattern according to the coordinate information of the key points of the human face The coordinate information of the contour graphics;
  • the task parsing module 605, configured to obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or or hairstyle identification;
  • the hair detail identification module 606 is used to calculate the The hair detail information of the face image;
  • the above-mentioned face images can be stored in nodes of a block chain.
  • the hair information recognition device runs the above hair information recognition method, the hair information recognition device obtains the face image to be recognized; respectively inputs the face image into the pre-trained face key
  • the point recognition model and the contour recognition model the coordinate information of the key points of the human face and the hair contour figure of the human face image are obtained; the hair contour figure is calculated according to the coordinate information of the key points of the human face coordinate information; obtain the hair recognition request input by the user, and select the corresponding hair recognition task according to the hair recognition request, wherein the hair recognition task includes hair detail recognition and hairstyle recognition; if the hair recognition task is hair detail recognition, Then, according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic, calculate the hair detail information of the human face image; if the hair recognition task is hairstyle recognition, then extract The features of the hair image in the face image, and identifying the hairstyle information of the face image according to the features of the hair image.
  • this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effective identification of many hair information.
  • the second embodiment of the hair information recognition device in the embodiment of the present application includes:
  • the obtaining module 601 is used to obtain the face image to be recognized;
  • the first model input module 602 is used to input the face image into the pre-trained face key point recognition model for face feature recognition, and obtain the The face key points of the face image and their coordinate information;
  • the second model input module 603 is used to input the face image into a pre-trained contour recognition model to obtain at least one contour of the face image Graphics;
  • hair contour determination module 604 used to determine the hair contour pattern of the human face image from the contour pattern according to the key points of the human face, and calculate the hair contour pattern according to the coordinate information of the key points of the human face The coordinate information of the contour graphics;
  • the task parsing module 605, configured to obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or or hairstyle identification;
  • the hair detail identification module 606 is used to calculate the The hair detail information of the face image;
  • the hair information recognition device further includes a first model training module 608, and the first model training module 608 is specifically used to: obtain a training sample set, wherein the training sample set includes a sample face image; obtain the The first sample human face key point information of the sample human face image, and the first sample human face key point information is marked to obtain the first sample human face posture information; the sample human face image is input to the preset In the neural network, obtain the second sample human face key point information and the second sample human face posture information; combine the first sample human face key point information and the first sample human face posture information with the second sample Comparing the face key point information with the second sample face pose information, calculating a loss function; judging whether the loss function is greater than a preset threshold; if so, adjusting the parameters of the neural network according to the loss function, and The sample face image is input into the neural network after parameter adjustment, and the model training is repeated until the loss function is not greater than the preset threshold, and a face key point recognition model is obtained.
  • the training sample set includes a sample face image
  • the hair information recognition device further includes a second model training module 609, and the second model training module 609 is specifically used to: obtain a preset test set, wherein the test set includes a test face image; obtain the The mark information of the sample face image and the test face image, and generate the mask image corresponding to the sample face image and the test face image according to the mark information; input the sample face image In the semantic segmentation network, the semantic segmentation image is obtained, and the loss value between the semantic segmentation image and the mask image corresponding to the sample face image is calculated through the cross-entropy loss function, and the semantic segmentation is adjusted according to the value Segment the parameters of the network for the next round of training until the end of the preset rounds of training; input the test set into the semantic segmentation network after the training to obtain the corresponding semantic segmentation image, and according to the test set Calculate the segmentation evaluation index for the corresponding mask image and the semantic segmentation image corresponding to the test set; judge whether the segmentation evaluation index reaches the preset standard; if not, adjust the cross
  • the face key points include left eye key points and right eye key points
  • the hair detail information includes fringe length information
  • the hair detail recognition module 606 is specifically configured to: according to the left eye key points and The coordinate information of the key point of the right eye is divided into the left area, the middle area and the right area; according to the coordinate information of the lowest point of the key point of the human face in the middle area and the hair outline
  • the coordinate information of the highest point in the graph is used to calculate the length of the face in the face image; according to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left area, the middle area and the right area, the calculation is obtained
  • the hair lengths of the left region, the middle region and the right region dividing the hair length by the face length to obtain the length information of bangs.
  • the hair detail information also includes hairline height information
  • the hair detail identification module 605 is specifically further configured to: connect the left eye key point and the right eye key point to obtain a connecting line; respectively calculate The distance value between the lowest point and the connecting line in the hair contour graphics of the left region, the middle region and the right region, and select the maximum value of the distance value in the left region, the middle region and the right region divided by the human face length to obtain the forehead height of the human face image; subtract one from the forehead height to obtain the hairline height information of the human face image.
  • the hair detail identification module 605 is specifically further configured to: construct a minimum hair region rectangle according to the coordinate information of the hair outline graphic, and calculate an area of the minimum hair region rectangle, wherein the minimum hair region The rectangle is the smallest rectangle containing the hair outline graphics; according to the coordinate information of the key points of the human face, the minimum face rectangle is constructed, and the area of the minimum face rectangle is calculated, wherein the minimum face rectangle contains all The minimum rectangle of the key points of the human face; dividing the area of the minimum facial rectangle by the area of the minimum facial rectangle to obtain the hair volume information of the human face image.
  • the hair style information identification module 607 is specifically configured to: extract the hair image in the face image according to the hair contour graphic; extract the hair image in the hair image according to a preset multi-task convolutional neural network. Hair image features; according to the extracted hair image features, perform at least one hairstyle recognition task, and obtain at least one hairstyle information.
  • this embodiment describes in detail the specific functions of each module and the unit composition of some modules.
  • the face image is recognized, and the hair outline and human body are obtained.
  • Face key points define hair information based on application scenarios, and calculate hair information, not only can identify the overall area of hair, but also can accurately and effectively identify many information of hair.
  • Fig. 8 is a schematic structural diagram of a hair information recognition device provided by an embodiment of the present application.
  • the hair information recognition device 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units) , CPU) 810 (eg, one or more processors) and memory 820, and one or more storage media 830 (eg, one or more mass storage devices) for storing application programs 833 or data 832 .
  • the memory 820 and the storage medium 830 may be temporary storage or persistent storage.
  • the program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations for the hair information recognition device 800 .
  • the processor 810 may be configured to communicate with the storage medium 830, and execute a series of instruction operations in the storage medium 830 on the hair information identification device 800, so as to realize the steps of the above hair information identification method.
  • the hair information identification device 800 can also include one or more power sources 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and/or, one or more operating systems 831, such as Windows Server , Mac OS X, Unix, Linux, FreeBSD, etc.
  • operating systems 831 such as Windows Server , Mac OS X, Unix, Linux, FreeBSD, etc.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with each other using cryptographic methods. Each data block contains a batch of network transaction information for verification The validity of its information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • the computer-readable storage medium may also be a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are run on the computer, the computer is made to execute the steps of the method for identifying hair information.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)

Abstract

The present application relates to the field of artificial intelligence, and discloses a hair information recognition method, apparatus and device, and a storage medium. The method comprises: acquiring a face image, and respectively inputting the face image into a face key point recognition model and a contour recognition model to obtain coordinate information of a face key point, and a plurality of contour graphs; determining a hair contour graph from the contour graphs according to the face key point, and calculating coordinate information of the hair contour graph according to the coordinate information of the face key point; and acquiring a hair recognition request, and then selecting a corresponding hair recognition task, and respectively obtaining hair detail information and hairstyle information. According to the method, the face image is recognized on the basis of the deep learning technology, the hair contour and the face key point are obtained, the hair information is defined on the basis of the application scene, and is calculated, the overall area of the hair can be recognized, and a large variety of information of the hair can be accurately recognized. In addition, the present application also relates to blockchain technology, and the face image can be stored in a blockchain.

Description

头发信息识别方法、装置、设备及存储介质Hair information identification method, device, equipment and storage medium
本申请要求于2021年06月10日提交中国专利局、申请号为202110645384.2、发明名称为“头发信息识别方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of the Chinese patent application with the application number 202110645384.2 and the title of the invention "hair information identification method, device, equipment and storage medium" submitted to the China Patent Office on June 10, 2021, the entire contents of which are incorporated by reference in application.
技术领域technical field
本申请涉及人工智能领域,尤其涉及一种头发信息识别方法、装置、设备及存储介质。The present application relates to the field of artificial intelligence, in particular to a hair information recognition method, device, equipment and storage medium.
背景技术Background technique
随着互联网技术的不断发展,移动终端的普及给用户提供了极大的便利,例如,由于智能终端的便携性,用户使用手机替代相机进行拍照。在拍照或在对图像进行处理的过程中,可以对图像进行面部的信息识别,作为面部整体的一步,头发在人的整体形象中也起到了重要的作用,在实际应用中,识别的头发细节信息,也能在应用上进行参考,例如在关注头发健康状况时,通过识别头发细节信息中的发际线高度,发量等,能够对待识别用户的头发健康进行参考,在保险行业中,通过识别图片上人的刘海长度,针对刘海长度过长的客户在驾车过程中,由于可能遮挡视线,出事故的风险可能会更高的情况进行理赔策略的调整等。With the continuous development of Internet technology, the popularity of mobile terminals provides users with great convenience. For example, due to the portability of smart terminals, users use mobile phones instead of cameras to take pictures. In the process of taking pictures or processing images, facial information recognition can be carried out on the image. As a step in the whole face, hair also plays an important role in the overall image of a person. In practical applications, the hair details identified Information can also be used for reference in applications. For example, when paying attention to hair health, by identifying the hairline height and hair volume in hair detail information, it can be used as a reference for the hair health of the user to be identified. In the insurance industry, through Identify the length of the bangs of the person in the picture, and adjust the claim settlement strategy for customers with too long bangs who may block the line of sight and have a higher risk of accidents during driving.
现有技术中对头发进行识别的方式主要通过对人脸与头发之间的像素差距进行头发区域的识别,然而,发明人意思到,这种识别方式主要是对头发的整体区域进行识别,难以准确地对头发的诸多细节信息进行有效识别。The hair recognition method in the prior art mainly recognizes the hair region by the pixel gap between the human face and the hair. However, the inventor realizes that this recognition method mainly recognizes the entire hair region, which is difficult Accurately and effectively identify many details of hair.
发明内容Contents of the invention
本申请提供了一种头发信息识别方法、装置、设备及存储介质,用于解决现有的头发识别方式,对于头发的细节信息识别精准度较低的技术问题。The present application provides a hair information recognition method, device, equipment and storage medium, which are used to solve the technical problem of low accuracy in hair detail information recognition in the existing hair recognition methods.
本申请第一方面提供了一种头发信息识别方法,包括:获取待识别的人脸图像;将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The first aspect of the present application provides a hair information recognition method, comprising: acquiring a face image to be recognized; inputting the face image into a pre-trained face key point recognition model for face feature recognition, and obtaining The human face key points of the human face image and coordinate information thereof; the human face image is input into a pre-trained contour recognition model to obtain at least one contour figure of the human face image; according to the human face key point, determine the hair contour graphics of the face image from the contour graphics, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the human face; obtain the hair recognition request input by the user, and analyze The hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier; if the hair recognition task identifier includes a hair detail recognition identifier, then according to the person The coordinate information of the key points of the face and the coordinate information of the hair outline graphics are used to calculate the hair detail information of the human face image; features of the hair image in the face image, and identify hairstyle information of the face image according to the features of the hair image.
本申请第二方面提供了一种头发信息识别设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:获取待识别的人脸图像;将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取 所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The second aspect of the present application provides a hair information identification device, including a memory, a processor, and computer-readable instructions stored in the memory and operable on the processor, and the processor executes the computer-readable instructions. The following steps are realized when reading the instruction: obtain the face image to be recognized; input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key of the face image Points and coordinate information thereof; input the face image into a pre-trained contour recognition model to obtain at least one contour figure of the face image; determine from the contour figure according to the key points of the face The hair outline graphic of the face image, and calculate the coordinate information of the hair outline graphic according to the coordinate information of the key points of the face; obtain the hair identification request input by the user, and analyze the hair carried in the hair identification request Recognition task identification, wherein the hair identification task identification includes hair detail identification and/or hairstyle identification; if the hair identification task identification includes hair detail identification, then according to the coordinate information of the key points of the face and the the coordinate information of the hair outline figure, and calculate the hair detail information of the human face image; if the hair recognition task identification includes a hairstyle recognition identification, then extract the hair image features in the human face image according to the hair outline figure, and Identifying hairstyle information of the face image according to the hair image features.
本申请的第三方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:获取待识别的人脸图像;将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The third aspect of the present application provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the computer, the computer is made to perform the following steps: obtain the person to be identified Face image; the face image is input into the pre-trained face key point recognition model to carry out face feature recognition, and the face key point and coordinate information thereof of the face image are obtained; the face image is Input to the pre-trained contour recognition model to obtain at least one contour figure of the human face image; according to the key points of the human face, determine the hair contour figure of the human face image from the contour figure, and according to The coordinate information of the key points of the face is used to calculate the coordinate information of the hair outline graphic; the hair recognition request input by the user is obtained, and the hair recognition task identifier carried in the hair recognition request is analyzed, wherein the hair recognition task identifier includes Hair detail identification and/or hairstyle identification; if the hair identification task identification includes hair detail identification, then according to the coordinate information of the key points of the face and the coordinate information of the hair outline figure, calculate the The hair detail information of the image; if the hair recognition task identification includes a hairstyle recognition identification, then extract the hair image features in the face image according to the hair contour graphics, and identify the face image according to the hair image features hairstyle information.
本申请第四方面提供了一种头发信息识别装置,其中,所述头发信息识别装置包括:第一模型输入模块,用于将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;第二模型输入模块,用于将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;头发轮廓确定模块,用于根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;任务解析模块,用于获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;头发细节识别模块,用于当所述头发识别任务标识包括头发细节识别标识时,根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;发型信息识别模块,用于当所述头发识别任务标识包括发型识别标识时,根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The fourth aspect of the present application provides a hair information recognition device, wherein the hair information recognition device includes: a first model input module for inputting the face image into a pre-trained face key point recognition model Perform face feature recognition in the face image to obtain the face key points and coordinate information of the face image; the second model input module is used to input the face image into the pre-trained contour recognition model to obtain the obtained At least one contour figure of the human face image; a hair contour determination module, configured to determine the hair contour figure of the human face image from the contour figure according to the key points of the human face, and determine the hair contour figure of the human face image according to the key points of the human face The coordinate information of the hair outline figure is calculated according to the coordinate information; the task analysis module is used to obtain the hair identification request input by the user, and analyze the hair identification task identification carried in the hair identification request, wherein the hair identification task identification includes Hair detail identification and/or hairstyle identification; hair detail identification module, used for when the hair identification task identification includes hair detail identification, according to the coordinate information of the key points of the human face and the coordinates of the hair contour figure information, calculating hair detail information of the human face image; a hair style information recognition module, used to extract hair image features in the human face image according to the hair contour figure when the hair recognition task identification includes a hair style recognition identification , and identify the hairstyle information of the face image according to the hair image features.
本申请提供的技术方案中,通过获取待识别的人脸图像;将所述人脸图像分别输入至预先训练好的人脸关键点识别模型和轮廓识别模型中,得到所述人脸图像的人脸关键点的坐标信息和所述人脸图像的头发轮廓图形;根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;获取用户输入的头发识别请求,根据所述头发识别请求选择对应的头发识别任务,其中所述头发识别任务包括头发细节识别和发型识别;若所述头发识别任务为头发细节识别,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;若所述头发识别任务为发型识别,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。本方法基于深度学习技术,对人脸图像进行识别,得到头发轮廓和人脸关键点,基于应用场景定义头发信息,进行头发信息的计算,不仅能够对头发的整体区域进行识别,同时能够准确地对头发的诸多信息进行有效识别,提高了人脸图像的识别精准度。In the technical solution provided by this application, by acquiring the face image to be recognized; inputting the face image into the pre-trained face key point recognition model and the contour recognition model respectively, the person of the face image is obtained The coordinate information of the key points of the face and the hair contour graphics of the face image; calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the face; obtain the hair recognition request input by the user, and Request to select the corresponding hair recognition task, wherein the hair recognition task includes hair detail recognition and hairstyle recognition; if the hair recognition task is hair detail recognition, then according to the coordinate information of the key points of the face and the hair contour graphics The coordinate information of the human face image is calculated to calculate the hair detail information of the human face image; if the hair recognition task is hairstyle recognition, the hair image features in the human face image are extracted according to the hair contour graphics, and the hair image features are extracted according to the hair image The feature identifies hairstyle information of the face image. Based on deep learning technology, this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effective recognition of many hair information improves the recognition accuracy of face images.
附图说明Description of drawings
图1为本申请实施例中头发信息识别方法的第一个实施例示意图;Fig. 1 is a schematic diagram of the first embodiment of the hair information identification method in the embodiment of the present application;
图2为本申请实施例中头发信息识别方法的第二个实施例示意图;Fig. 2 is a schematic diagram of the second embodiment of the hair information identification method in the embodiment of the present application;
图3为本申请实施例中头发信息识别方法的第三个实施例示意图;Fig. 3 is a schematic diagram of the third embodiment of the hair information identification method in the embodiment of the present application;
图4为本申请实施例中头发信息识别方法的第四个实施例示意图;Fig. 4 is a schematic diagram of the fourth embodiment of the hair information identification method in the embodiment of the present application;
图5为本申请实施例中头发信息识别方法的第五个实施例示意图;Fig. 5 is a schematic diagram of a fifth embodiment of the method for identifying hair information in the embodiment of the present application;
图6为本申请实施例中头发信息识别装置的一个实施例示意图;Fig. 6 is a schematic diagram of an embodiment of the hair information identification device in the embodiment of the present application;
图7为本申请实施例中头发信息识别装置的另一个实施例示意图;Fig. 7 is a schematic diagram of another embodiment of the hair information identification device in the embodiment of the present application;
图8为本申请实施例中头发信息识别设备的一个实施例示意图。Fig. 8 is a schematic diagram of an embodiment of a device for identifying hair information in the embodiment of the present application.
具体实施方式Detailed ways
本申请实施例提供了一种头发信息识别方法、装置、设备及存储介质,用于解决现有的头发识别方式,对于头发的细节信息识别精准度较低的技术问题。Embodiments of the present application provide a hair information identification method, device, device, and storage medium, which are used to solve the technical problem of low accuracy in identifying detailed hair information in existing hair identification methods.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、***、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and not necessarily Used to describe a specific sequence or sequence. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the term "comprising" or "having" and any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to those explicitly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
为便于理解,下面对本申请实施例的具体流程进行描述,请参阅图1,本申请实施例中头发信息识别方法的第一个实施例包括:For ease of understanding, the following describes the specific process of the embodiment of the present application. Please refer to FIG. 1. The first embodiment of the method for identifying hair information in the embodiment of the present application includes:
101、获取待识别的人脸图像;101. Obtain a face image to be recognized;
可以理解的是,本申请的执行主体可以为头发信息识别装置,还可以是终端或者服务器,具体此处不做限定。本申请实施例以服务器为执行主体为例进行说明。It can be understood that the subject of execution of the present application may be a hair information recognition device, and may also be a terminal or a server, which is not specifically limited here. The embodiment of the present application is described by taking the server as an execution subject as an example.
需要强调的是,为保证数据的私密和安全性,上述人脸图像可以存储于一区块链的节点中。It should be emphasized that, in order to ensure the privacy and security of data, the above-mentioned face images can be stored in nodes of a block chain.
在本实施例中,待识别的人脸图像可以为呈现静态的图像或者照片等图像,也可以为呈现动态的视频中的视频帧等。该人脸图像中的人脸可以为正脸,也可以为存在一定偏转角度的非正脸。待识别的人脸图像可以是本地存储的图像,也可以是从网络或服务器获取的图像,还可以是通过图像采集装置采集的图像,本实施例不作限定。In this embodiment, the face image to be recognized may be a static image or an image such as a photo, or may be a video frame or the like in a dynamic video. The face in the face image may be a frontal face, or a non-frontal face with a certain deflection angle. The face image to be recognized may be an image stored locally, an image acquired from a network or a server, or an image acquired by an image acquisition device, which is not limited in this embodiment.
在本实施例中,人脸图像可以是需要识别的图像中的所有图像,也可以是需要识别的图像中的部分图像,例如,对于某些图像中的部分区域存在人脸图像,可以采用人脸识别方法,将人脸从完整图像中识别并截取出来,截取的人脸图像应能包含全部的人脸并附加部分背景区域。人脸识别方法可以使用dlib,也可以为其他人脸识别方法,本实施例不作限定。In this embodiment, the face image may be all the images in the image to be recognized, or it may be a part of the image in the image to be recognized. The face recognition method recognizes and intercepts the face from the complete image. The intercepted face image should contain all the faces and add part of the background area. The face recognition method may use dlib, or other face recognition methods, which are not limited in this embodiment.
102、将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;102. Input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and coordinate information of the face image;
在本实施例中,人脸关键点识别模型所使用的神经网络结构为PFLD(A Practical Facial Landmark Detector),是一个精度高,速度快,模型小的人脸关键点检测模型。In this embodiment, the neural network structure used by the face key point recognition model is PFLD (A Practical Facial Landmark Detector), which is a face key point detection model with high precision, fast speed and small model.
在实际应用中,数据不平衡是经常限制准确检测性能的问题。例如,训练集可能包含大量正面,而缺少那些姿势较大的面孔。导致由这样的训练集训练的模型不能很好地处理大型姿势情况。在这种情况下,“平均”惩罚每个样本将使其不平等。PFLD采用辅助网络来估计人脸样本的人脸姿态信息,在训练关键点回归的同时预测人脸姿态,通过对稀有以及姿态角度过大的样本进行大的惩罚,解决数据不平衡问题,从而提高预测的精度。In practical applications, data imbalance is a problem that often limits the performance of accurate detection. For example, the training set may contain a large number of frontal faces, missing those faces with larger poses. As a result, models trained by such a training set cannot handle large pose cases well. Penalizing each sample "on average" would make them unequal in this case. PFLD uses an auxiliary network to estimate the face pose information of face samples, predicts face pose while training key point regression, and solves the problem of data imbalance by punishing rare and excessively large pose angle samples, thereby improving Prediction accuracy.
103、将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;103. Input the face image into a pre-trained contour recognition model to obtain at least one contour figure of the face image;
在本实施例中,轮廓识别模型使用的神经网络结构为PSPNet(Pyramid Scene Parseing Network,金字塔场景解析网络),PSPNet能够聚合不同区域的上下文信息,从而提高获取全局信息的能力。In this embodiment, the neural network structure used by the contour recognition model is PSPNet (Pyramid Scene Parseing Network, Pyramid Scene Parseing Network), and PSPNet can aggregate context information in different regions, thereby improving the ability to obtain global information.
PSPNet对于输入图像,使用一个带有扩展网络策略且预训练过的ResNet模型来提取特征图,主体网络由ResNet101构成,使用了残差网络、空洞卷积和降维卷积的方法(先使用1*1降低维度,然后使用3*3卷积,再用1*1恢复维度)。网络中一共出现三次特征图缩小,一次使用maxpool,两次使用conv,每次减少二分之一大小,最终得到的特征图是原尺寸的1/8。对上述特征图使用(金字塔池化模块来获取语境信息,其中,金字塔池化模块分4个层级,其池化核大小分别为图像的全部、一半和小部分,最终它们可融合为全局特征。然后,将融合得到的全局特征与原始特征图连接起来,最后,通过一层卷积层生成最终的预测图。For the input image, PSPNet uses a pre-trained ResNet model with an extended network strategy to extract the feature map. The main network is composed of ResNet101, using the method of residual network, hole convolution and dimensionality reduction convolution (first use 1 *1 reduces the dimension, then uses 3*3 convolution, and then restores the dimension with 1*1). There are a total of three feature map reductions in the network, one using maxpool, two using conv, each time reducing the size by half, and the final feature map is 1/8 of the original size. Use the (pyramid pooling module) for the above feature map to obtain context information. Among them, the pyramid pooling module is divided into 4 levels, and the pooling kernel sizes are all, half and a small part of the image, and finally they can be fused into global features Then, the fused global features are concatenated with the original feature map, and finally, the final prediction map is generated through a convolutional layer.
104、根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;104. According to the key points of the face, determine the hair contour figure of the face image from the contour figure, and calculate the coordinate information of the hair contour figure according to the coordinate information of the key points of the face;
在本实施例中,轮廓识别模型识别出人脸图像中的多个轮廓图像,例如人脸轮廓,头发轮廓等,可以通过确定人脸关键点中的左眼关键点和右眼关键点,并将不包含左眼关键点和右眼关键点且在左眼关键点和右眼关键点上方的轮廓区域确定为头发轮廓,并确定头发轮廓图形。In this embodiment, the contour recognition model recognizes multiple contour images in the human face image, such as human face contours, hair contours, etc., by determining the left eye key points and right eye key points in the human face key points, and Determine the contour region above the left eye key point and the right eye key point as the hair contour, and determine the hair contour graphics.
在本实施例中,人脸关键点识别模型输出人脸关键点的位置信息,主要为人脸关键点在人脸图像中的坐标,通过人脸关键点的坐标能够计算头发轮廓图形中各点的坐标,可以通过人脸关键点和头发轮廓图形之间的距离,获得人脸关键点和头发轮廓图形之间的向量,并将该向量拆分成坐标轴中x轴和y轴两个方向的向量,根据两个方向的长度与对应人脸关键点的坐标计算头发轮廓图形上各点的坐标信息,或者通过预先设定的坐标轴中的坐标原点对头发轮廓图形的坐标信息进行计算。In this embodiment, the facial key point recognition model outputs the position information of the key point of the human face, which is mainly the coordinates of the key points of the human face in the face image, and the coordinates of the key points of the human face can be used to calculate the position of each point in the hair contour graph. Coordinates, the vector between the key points of the face and the outline of the hair can be obtained through the distance between the key points of the face and the outline of the hair, and the vector is split into two directions of the x-axis and the y-axis in the coordinate axis Vector, calculate the coordinate information of each point on the hair outline graphic according to the length of the two directions and the coordinates of the corresponding key points of the face, or calculate the coordinate information of the hair outline graphic through the coordinate origin in the preset coordinate axis.
105、获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,其中头发识别任务标识包括头发细节识别标识和/或发型识别标识;105. Obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, where the hair recognition task identifier includes hair detail recognition identifier and/or hairstyle recognition identifier;
106、若头发识别任务标识包括头发细节识别标识,则根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息;106. If the hair recognition task identification includes the hair detail identification identification, then calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
在本实施例中,所述头发细节信息主要包括发际线高度、发量和刘海长度等信息,通过头发细节信息中的发际线高度,发量等,对待识别用户的头发健康进行参考,在保险行业中,通过识别图片上人的刘海长度,针对刘海长度过长的客户在驾车过程中,由于可能遮挡视线,出事故的风险可能会更高的情况进行理赔策略的调整,根据不同的应用场景,可以通过对头发的不同定义获得不同类型的头发细节信息,例如鬓角长度,通过识别头发轮廓图形中的最低点与两眼之前连线的垂直距离,并除以计算得到的人脸长度,即可计算得到鬓角长度,对于头发细节信息的类型,本申请不做限定。In this embodiment, the hair detail information mainly includes information such as hairline height, hair volume, and bangs length. Through the hairline height, hair volume, etc. in the hair detail information, the hair health of the user to be identified is referred to, In the insurance industry, by identifying the length of the bangs of the person in the picture, the claim settlement strategy is adjusted for the customers whose bangs are too long during the driving process, because they may block the line of sight and the risk of accident may be higher, according to different In the application scenario, different types of hair detail information can be obtained through different definitions of hair, such as the length of sideburns, by identifying the vertical distance between the lowest point in the hair contour graph and the line before the two eyes, and dividing it by the calculated face length , the sideburn length can be calculated, and the application does not limit the type of hair detail information.
107、若头发识别任务标识包括发型识别标识,则根据头发轮廓图形提取人脸图像中的头发图像特征,并根据头发图像特征识别人脸图像的发型信息。107. If the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphics, and recognize the hairstyle information of the face image according to the hair image features.
在本实施例中,通过卷积神经网络处理头发轮廓图形范围内的人脸图像,以提取人脸图像中的头发图像特征,卷积神经网络(Convolutional Neural Network,简称CNN)是一种人工神经网络。卷积神经网络包括卷积层(Convolutional Layer)和子采样层(Pooling Layer)。子采样也叫做池化(Pooling),通常有均值子采样(Mean Pooling)和最大值子采样(Max Pooling)两种形式。池化操作是一种有效的降维方式,可以防止过拟合。卷积和子采样大大简化了神经网络的复杂度,减少了神经网络的参数。多任务卷积神经网络是可以进行多任务学习的卷积神经网络。多任务卷积神经网络则针对输入可以有多个输出,每个输出对应一个任务,也就可以提取出人脸图像中的多个头发图像特征。In this embodiment, the face image within the range of the hair outline graphics is processed by a convolutional neural network to extract the hair image features in the face image. The convolutional neural network (Convolutional Neural Network, referred to as CNN) is an artificial neural network. network. The convolutional neural network includes a convolutional layer (Convolutional Layer) and a sub-sampling layer (Pooling Layer). Subsampling is also called pooling (Pooling), usually in two forms: mean subsampling (Mean Pooling) and maximum subsampling (Max Pooling). The pooling operation is an effective way to reduce dimensionality and prevent overfitting. Convolution and subsampling greatly simplify the complexity of the neural network and reduce the parameters of the neural network. A multi-task convolutional neural network is a convolutional neural network that can perform multi-task learning. The multi-task convolutional neural network can have multiple outputs for the input, and each output corresponds to a task, so it can extract multiple hair image features in the face image.
在本实施例中,通过获取待识别的人脸图像;将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;将人脸图 像输入至预先训练好的轮廓识别模型中,得到人脸图像的至少一个轮廓图形;根据人脸关键点,从轮廓图形中确定人脸图像的头发轮廓图形,并根据人脸关键点的坐标信息计算头发轮廓图形的坐标信息;获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,其中头发识别任务标识包括头发细节识别标识和/或发型识别标识;若头发识别任务标识包括头发细节识别标识,则根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息;若头发识别任务标识包括发型识别标识,则根据头发轮廓图形提取人脸图像中的头发图像特征,并根据头发图像特征识别人脸图像的发型信息。本方法基于深度学习技术,对人脸图像进行识别,得到头发轮廓和人脸关键点,基于应用场景定义头发信息,进行头发信息的计算,不仅能够对头发的整体区域进行识别,同时能够准确地对头发的诸多信息进行有效识别。In this embodiment, by acquiring the face image to be recognized; inputting the face image into a pre-trained face key point recognition model for face feature recognition, obtaining the face key points and their coordinates of the face image Information; the face image is input into the pre-trained contour recognition model to obtain at least one contour figure of the face image; according to the key points of the face, the hair contour figure of the face image is determined from the contour figure, and according to the face Calculate the coordinate information of the hair outline graphics from the coordinate information of the key points; obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or the hairstyle recognition identifier ; If the hair recognition task identification includes the hair detail identification identification, then according to the coordinate information of the key points of the face and the coordinate information of the hair contour graphics, calculate the hair detail information of the face image; if the hair identification task identification includes the hairstyle identification identification, then according to The hair contour graph extracts the hair image features in the face image, and recognizes the hairstyle information of the face image according to the hair image features. Based on deep learning technology, this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effectively identify a lot of hair information.
请参阅图2,本申请实施例中头发信息识别方法的第二个实施例包括:Please refer to Fig. 2, the second embodiment of the hair information identification method in the embodiment of the present application includes:
201、获取训练样本集,训练样本集包括样本人脸图像;201. Obtain a training sample set, where the training sample set includes sample face images;
在实际应用中,常见的几种关键点数据集有5关键点、21关键点、68关键点、98关键点等,在本实施例中,主要应用的人脸关键点为68个,所以人脸关键点检测模型的训练,训练样本集采用的数据集是300W,共600张图片,68个关键点,此外也可以使用其他的的关键点数据集,例如有68个关键点的XM2VTS数据集,98个关键点的WFLW数据集等,本申请不做限定。In practical applications, several common key point data sets include 5 key points, 21 key points, 68 key points, 98 key points, etc. In this embodiment, the main face key points used are 68, so the human face For the training of the face key point detection model, the training sample set uses a data set of 300W, a total of 600 pictures, and 68 key points. In addition, other key point data sets can also be used, such as the XM2VTS data set with 68 key points. , the WFLW data set of 98 key points, etc., are not limited in this application.
202、获取样本人脸图像的第一样本人脸关键点信息,并对第一样本人脸关键点信息进行标注,得到第一样本人脸姿态信息;202. Obtain the first sample face key point information of the sample face image, and mark the first sample face key point information to obtain the first sample face pose information;
203、将样本人脸图像输入至预设的神经网络中,得到第二样本人脸关键点信息和第二样本人脸姿态信息;203. Input the sample face image into the preset neural network to obtain the key point information of the second sample face and the pose information of the second sample face;
204、将第一样本人脸关键点信息和第一样本人脸姿态信息分别与第二样本人脸关键点信息和第二样本人脸姿态信息进行比较,计算损失函数;204. Comparing the first sample face key point information and the first sample face pose information with the second sample face key point information and the second sample face pose information respectively, and calculating a loss function;
205、判断损失函数是否大于预设阈值;205. Determine whether the loss function is greater than a preset threshold;
206、若是,则根据损失函数调整神经网络的参数,并将样本人脸图像输入至参数调整后的神经网络中,重复模型训练,直至损失函数不大于预设阈值,得到人脸关键点识别模型;206. If so, adjust the parameters of the neural network according to the loss function, and input the sample face image into the parameter-adjusted neural network, repeat the model training until the loss function is not greater than the preset threshold, and obtain the facial key point recognition model ;
在本实施例中,使用的神经网络结构为PFLD,该神经网络结构能够根据人脸图像的姿态信息对损失函数进行调整,解决数据不平衡问题,提高识别的准确度,所以需要对训练集中的每个关键点进行标注,得到每个关键点的人脸姿态信息,人脸姿态标注采用的是PRnet模型,获取到三个姿态数据(yaw,pitch,roll),通过将样本人脸图像输入至PFLD中,得到PFLD处理后的样本人脸关键点信息和样本人脸姿态信息,根据预设的损失函数计算损失值,其中,损失函数的公式如下:In this embodiment, the neural network structure used is PFLD, which can adjust the loss function according to the pose information of the face image, solve the problem of data imbalance, and improve the accuracy of recognition, so it is necessary to Each key point is marked to obtain the face pose information of each key point. The PRnet model is used to mark the face pose, and three pose data (yaw, pitch, roll) are obtained. By inputting the sample face image into In PFLD, the key point information of the sample face and the pose information of the sample face after PFLD processing are obtained, and the loss value is calculated according to the preset loss function, where the formula of the loss function is as follows:
Figure PCTCN2022071475-appb-000001
Figure PCTCN2022071475-appb-000001
其中,
Figure PCTCN2022071475-appb-000002
为最终的样本权重,M为样本个数,N为特征点个数,θ 1,θ 2,θ 3(k=3)分别表示yaw,pitch,roll这三个角度的偏差,它由辅助网络计算得到,偏差越大其余弦值越小,而1-cos值将会越大;C表示不同的类别的人脸,包括:正脸,侧脸,抬头,低头,表情以及遮挡情况,
Figure PCTCN2022071475-appb-000003
根据 训练样本数进行调整,
Figure PCTCN2022071475-appb-000004
由主分支网络计算得到,
Figure PCTCN2022071475-appb-000005
表示L2距离,通过计算损失值,并判断损失值是否小于预设的阈值进行PFLD的迭代训练,直到损失值小于预设阈值,得到人脸关键点识别模型。
in,
Figure PCTCN2022071475-appb-000002
is the final sample weight, M is the number of samples, N is the number of feature points, θ 1 , θ 2 , θ 3 (k=3) respectively represent the deviations of the three angles of yaw, pitch, and roll, which are determined by the auxiliary network Calculated, the larger the deviation, the smaller the cosine value, and the larger the 1-cos value; C represents different types of faces, including: front face, side face, head up, head down, expression and occlusion,
Figure PCTCN2022071475-appb-000003
Adjusted according to the number of training samples,
Figure PCTCN2022071475-appb-000004
Calculated from the master-branch network,
Figure PCTCN2022071475-appb-000005
Indicates the L2 distance, by calculating the loss value, and judging whether the loss value is less than the preset threshold value, iterative training of PFLD is performed until the loss value is less than the preset threshold value, and the face key point recognition model is obtained.
207、获取待识别的人脸图像;207. Obtain a face image to be recognized;
208、将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;208. Input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and their coordinate information of the face image;
209、将人脸图像输入至预先训练好的轮廓识别模型中,得到人脸图像的至少一个轮廓图形;209. Input the face image into a pre-trained contour recognition model to obtain at least one contour figure of the face image;
210、根据人脸关键点,从轮廓图形中确定人脸图像的头发轮廓图形,并根据人脸关键点的坐标信息计算头发轮廓图形的坐标信息;210. According to the key points of the face, determine the hair contour figure of the face image from the contour figure, and calculate the coordinate information of the hair contour figure according to the coordinate information of the key points of the face;
211、获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,其中头发识别任务标识包括头发细节识别标识和/或发型识别标识;211. Obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, where the hair recognition task identifier includes hair detail recognition identifiers and/or hairstyle recognition identifiers;
212、若头发识别任务标识包括头发细节识别标识,则根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息;212. If the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
213、若头发识别任务标识包括发型识别标识,则根据头发轮廓图形提取人脸图像中的头发图像特征,并根据头发图像特征识别人脸图像的发型信息。213. If the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
本实施例中的步骤206-211与第一实施例中的步骤101-106相似,此处不再赘述。Steps 206-211 in this embodiment are similar to steps 101-106 in the first embodiment, and will not be repeated here.
本实施例在上一实施例的基础上,详细描述了人脸关键点识别模型的训练过程,本实施例中的人脸关键点模型使用PFLD,是一种精度高,速度快,模型小的人脸关键点检测模型,通过采用辅助网络来估计人脸样本的人脸姿态信息,解决数据不平衡问题,从而提高模型预测的精度。On the basis of the previous embodiment, this embodiment describes in detail the training process of the face key point recognition model. The face key point model in this embodiment uses PFLD, which is a high precision, fast, small model The face key point detection model solves the problem of data imbalance by using an auxiliary network to estimate the face pose information of the face sample, thereby improving the accuracy of the model prediction.
请参阅图3,本申请实施例中头发信息识别方法的第三个实施例包括:Please refer to Fig. 3, the third embodiment of the hair information identification method in the embodiment of the present application includes:
301、获取预设的测试集和训练样本集,训练样本集包括样本人脸图像,测试集包括测试人脸图像;301. Obtain a preset test set and training sample set, the training sample set includes sample face images, and the test set includes test face images;
302、获取样本人脸图像和测试人脸图像的标记信息,并根据标记信息生成样本人脸图像和测试人脸图像对应的掩模图像;302. Acquire marking information of the sample face image and the test face image, and generate a mask image corresponding to the sample face image and the test face image according to the mark information;
303、将样本人脸图像输入至语义分割网络中,得到语义分割图像,并通过交叉熵损失函数计算语义分割图像与样本人脸图像对应的掩模图像之间的损失值,并根据值调整语义分割网络的参数进行下一轮训练,直至进行完预设轮数训练后结束;303. Input the sample face image into the semantic segmentation network to obtain the semantic segmentation image, and calculate the loss value between the semantic segmentation image and the mask image corresponding to the sample face image through the cross-entropy loss function, and adjust the semantic value according to the value Divide the parameters of the network for the next round of training until the preset number of rounds of training is completed;
304、将测试集输入至训练结束后的语义分割网络中,得到对应的语义分割图像,并根据测试集对应的掩模图像和测试集对应的语义分割图像计算分割评价指标;304. Input the test set into the semantic segmentation network after training, obtain the corresponding semantic segmentation image, and calculate the segmentation evaluation index according to the mask image corresponding to the test set and the semantic segmentation image corresponding to the test set;
305、判断分割评价指标是否达到预设标准;305. Judging whether the segmentation evaluation index reaches the preset standard;
306若否,则调整交叉熵损失函数,并再次对语义分割网络进行训练和测试,直至分割评价指标达到预设标准,得到轮廓识别模型;306 If not, adjust the cross-entropy loss function, and train and test the semantic segmentation network again until the segmentation evaluation index reaches the preset standard, and obtain the contour recognition model;
在本实施例中,可以通过对样本人脸图像和所述测试人脸图像中的每个像素值进行人工标记,得到对应的标记信息,例如通过人工识别出人脸图像中的头发区域和非头发区域,将头发区域的像素值标记为1,将非头发区域的像素值标记为0,将像素值标记为1的区域进行掩模,得到掩模图像,将样本人脸图像输入至语义分割网络后,得到语义分割图像,交叉熵损失函数的公式如下:In this embodiment, the corresponding marking information can be obtained by manually marking each pixel value in the sample face image and the test face image, for example, by manually identifying the hair region and non- In the hair area, the pixel value of the hair area is marked as 1, the pixel value of the non-hair area is marked as 0, and the area marked as 1 is masked to obtain a mask image, and the sample face image is input to the semantic segmentation After the network, the semantic segmentation image is obtained, and the formula of the cross-entropy loss function is as follows:
Figure PCTCN2022071475-appb-000006
Figure PCTCN2022071475-appb-000006
其中p(x)为真实分布,q(x)为非真实分布。Where p(x) is the real distribution and q(x) is the non-real distribution.
在本实施例中,将交并比和像素精度作为语义分割网络的分割评价指标,其中交并比通过计算测试集对应的掩模图像与输入训练结束后的语义分割网络后得到的语义分割图像之间的交叠率,即它们的交集与并集的比值,而像素精度是通过掩模图像和语义分割图像之间,语义分割图像预测的正确像素值在总像素值中的占比,通过判断交并比和像素精度是否达到预设的标准,若未达到预设的标准,则通过调整整网络的单次训练的样本数、损失函数、学习率和优化器等参数,并再此对网络进行训练和测试,直到网络达到预期标准,得到轮廓识别模型。In this embodiment, the intersection ratio and pixel accuracy are used as the segmentation evaluation index of the semantic segmentation network, wherein the intersection ratio is calculated by calculating the mask image corresponding to the test set and the semantic segmentation image obtained after inputting the semantic segmentation network after training. The overlap rate between them, that is, the ratio of their intersection and union, and the pixel accuracy is the ratio of the correct pixel value predicted by the semantic segmentation image to the total pixel value between the mask image and the semantic segmentation image, by Determine whether the intersection ratio and pixel accuracy meet the preset standards. If they do not meet the preset standards, adjust the parameters such as the number of samples, loss function, learning rate and optimizer of the entire network for a single training, and then adjust the The network is trained and tested until the network reaches the expected standard, resulting in a contour recognition model.
307、获取待识别的人脸图像;307. Obtain a face image to be recognized;
308、将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;308. Input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and their coordinate information of the face image;
309、将人脸图像输入至预先训练好的轮廓识别模型中,得到人脸图像的至少一个轮廓图形;309. Input the face image into the pre-trained contour recognition model to obtain at least one contour figure of the face image;
310、根据人脸关键点,从轮廓图形中确定人脸图像的头发轮廓图形,并根据人脸关键点的坐标信息计算头发轮廓图形的坐标信息;310. Determine the hair outline graphic of the face image from the outline graphic according to the key points of the face, and calculate the coordinate information of the hair outline graphic according to the coordinate information of the key points of the face;
311、获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,其中头发识别任务标识包括头发细节识别标识和/或发型识别标识;311. Obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, where the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
312、若头发识别任务标识包括头发细节识别标识,则根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息;312. If the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
313、若头发识别任务标识包括发型识别标识,则根据头发轮廓图形提取人脸图像中的头发图像特征,并根据头发图像特征识别人脸图像的发型信息。313. If the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
本实施例中的步骤306-308与第一实施例中的步骤104-106相似,此处不再赘述。Steps 306-308 in this embodiment are similar to steps 104-106 in the first embodiment, and will not be repeated here.
本实施例在前实施例的基础上,详细描述了轮廓识别模型的训练过程,轮廓识别模型能够根据人脸图像不同区域的像素值进行头发轮廓的识别,识别精度高,使得后续计算头发细节信息更加精准。This embodiment describes the training process of the contour recognition model in detail on the basis of the previous embodiment. The contour recognition model can recognize the hair contour according to the pixel values in different regions of the face image, and the recognition accuracy is high, so that the subsequent calculation of hair detail information more precise.
请参阅图4,本申请实施例中头发信息识别方法的第四个实施例包括:Please refer to Fig. 4, the fourth embodiment of the hair information identification method in the embodiment of the present application includes:
401、获取待识别的人脸图像;401. Obtain a face image to be recognized;
402、将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;402. Input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and their coordinate information of the face image;
403、将人脸图像输入至预先训练好的轮廓识别模型中,得到人脸图像的至少一个轮廓图形;403. Input the face image into the pre-trained contour recognition model to obtain at least one contour figure of the face image;
404、根据人脸关键点,从轮廓图形中确定人脸图像的头发轮廓图形,并根据人脸关键点的坐标信息计算头发轮廓图形的坐标信息;404. Determine the hair contour graphics of the face image from the contour graphics according to the key points of the face, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the face;
405、获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,头发识别任务标识包括头发细节识别标识和发型识别标识;405. Obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, where the hair recognition task identifier includes a hair detail recognition identifier and a hairstyle recognition identifier;
406、若头发识别任务标识包括头发细节识别标识,则根据左眼关键点和右眼关键点的坐标信息,将人脸图像划分为左区域、中区域和右区域;406. If the hair recognition task identification includes the hair detail identification identification, divide the face image into a left area, a middle area, and a right area according to the coordinate information of the left eye key point and the right eye key point;
407、根据中区域中人脸关键点的最低点的坐标信息和头发轮廓图形中最高点的坐标信息,计算人脸图像中的人脸长度;407. Calculate the length of the face in the face image according to the coordinate information of the lowest point of the face key point in the middle area and the coordinate information of the highest point in the hair outline graphic;
408、分别根据左区域、中区域和右区域中的头发轮廓图形中的最高点和最低点的坐标信息,计算得到左区域、中区域和右区域的头发长度;408. According to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left area, middle area, and right area respectively, calculate and obtain the hair lengths in the left area, middle area, and right area;
409、将头发长度除以人脸长度,得到刘海长度信息;409. Divide the length of the hair by the length of the face to obtain the length information of the bangs;
在本实施例中,通过定位人脸图像中的人脸关键点的位置关系,定位人脸关键点中的 左眼关键点和右眼关键点,通过对两关键点做垂直线,将人脸图像分为三个区域,分别为左区域、中区域和右区域,并分别计算三个区域的头发长度,将头发长度定义为len=dist(max(top),min(bottom)),其中,max(top)表示该区域的头发轮廓图形中最上沿的坐标点,min(bottom)表示该区域的头发轮廓图形中最下沿的坐标点,dist()表示欧氏距离,通过得到左区域、中区域和右区域max(top)和min(bottom)的距离值得到fringe_middle_len,fringe_left_len,fringe_right_len,对其取最大值,然后除人脸长度face_len即得到刘海长度,公式为:In this embodiment, by locating the positional relationship of the key points of the face in the face image, the key points of the left eye and the key points of the right eye in the key points of the face are located, and by making a vertical line to the two key points, the face The image is divided into three regions, namely the left region, the middle region and the right region, and the hair lengths of the three regions are calculated respectively, and the hair length is defined as len=dist(max(top),min(bottom)), where, max(top) indicates the uppermost coordinate point in the hair contour graph of this region, min(bottom) represents the lowermost coordinate point in the hair contour graph of this region, dist() represents the Euclidean distance, by obtaining the left region, The distance values of max(top) and min(bottom) in the middle area and the right area get fringe_middle_len, fringe_left_len, fringe_right_len, take the maximum value, and then divide the face length face_len to get the length of bangs. The formula is:
Figure PCTCN2022071475-appb-000007
Figure PCTCN2022071475-appb-000007
其中人脸长度的定义如下:The face length is defined as follows:
face_len=dist(hair_middle_top_point,chin_bottom_point)face_len=dist(hair_middle_top_point, chin_bottom_point)
也即是头发轮廓图形的中区域的最上沿的点的坐标,与人脸关键点中最下沿的点的坐标之间的距离。That is, the distance between the coordinates of the uppermost point in the middle area of the hair contour graph and the coordinates of the lowermost point in the key points of the face.
410、连接左眼关键点和右眼关键点,得到连接线;410. Connect the key points of the left eye and the key points of the right eye to obtain a connecting line;
411、分别计算左区域、中区域和右区域的头发轮廓图形中的最低点与连接线的距离值,并选择左区域、中区域和右区域中的距离值的最大值除以人脸长度,得到人脸图像的额头高度;411. Calculate the distance values between the lowest point and the connecting line in the hair contour graph of the left area, the middle area, and the right area respectively, and select the maximum value of the distance values in the left area, the middle area, and the right area divided by the length of the face, Get the forehead height of the face image;
412、将一减去额头高度,得到人脸图像的发际线高度信息;412. Subtract the forehead height from one to obtain the hairline height information of the face image;
在本实施例中,将左眼关键点和右眼关键点两点之间的连接线定义为between_eyes_line,定义各区域中头发轮廓图形中最下沿的点为hair_bottom_point,计算额头高度的公式为:In this embodiment, the connecting line between the key point of the left eye and the key point of the right eye is defined as between_eyes_line, and the point at the bottom of the hair contour graphics in each area is defined as hair_bottom_point, and the formula for calculating the height of the forehead is:
forehead_length=dist(hair_bottom_point,between_eyes_line)forehead_length = dist(hair_bottom_point, between_eyes_line)
取左区域、中区域和右区域中的额头高度的最大值,定义发际线高度的公式为:Taking the maximum value of the forehead heights in the left, middle and right regions, the formula for defining the hairline height is:
Figure PCTCN2022071475-appb-000008
Figure PCTCN2022071475-appb-000008
由于除以了人脸长度,额头高度是一个归一化的值,介于0~1之间,所以发际线高度也是介于0~1之间的值。Since it is divided by the length of the face, the height of the forehead is a normalized value between 0 and 1, so the height of the hairline is also a value between 0 and 1.
413、根据头发轮廓图形的坐标信息,构建最小发域矩形,并计算最小发域矩形的面积,其中,最小发域矩形为包含头发轮廓图形的最小矩形;413. Construct the minimum hair region rectangle according to the coordinate information of the hair contour figure, and calculate the area of the minimum hair region rectangle, wherein the minimum hair region rectangle is the smallest rectangle containing the hair contour figure;
414、根据人脸关键点的坐标信息,构建最小脸部矩形,并计算最小脸部矩形的面积,其中最小脸部矩形为包含所有人脸关键点的最小矩形;414. Construct the minimum face rectangle according to the coordinate information of the key points of the face, and calculate the area of the minimum face rectangle, wherein the minimum face rectangle is the smallest rectangle containing all the key points of the face;
415、将最小发域矩形的面积除以最小脸部矩形的面积,得到人脸图像的发量信息;415. Divide the area of the smallest hair region rectangle by the area of the smallest face rectangle to obtain hair volume information of the face image;
在本实施例中,首先构建一个最小矩形框将头发轮廓图形覆盖,该矩形的宽为hair_x_len,高为hair_y_len,所以发量面积可以粗略的表示为hair_x_len*hair_y_len,构建的方式可以通过获取头发轮廓图形的最上沿、最下沿、最左侧和最右侧的四个点,将最上沿和最下沿之间的垂直距离作为矩形的高,将最左侧和最右侧的点之间的垂直距离定义为矩形的高,同理,通过相同方法,通过获取人脸关键点中的最上沿、最下沿、最左侧和最右侧的四个点进行计算,得到面部矩形,将两者相除即得到发量信息,计算公式为:In this embodiment, first construct a minimum rectangular frame to cover the hair outline graphics, the width of the rectangle is hair_x_len, and the height is hair_y_len, so the hair volume area can be roughly expressed as hair_x_len*hair_y_len, and the construction method can be obtained by obtaining the hair outline The four points on the uppermost edge, the lowermost edge, the leftmost edge, and the rightmost edge of the graph, the vertical distance between the uppermost edge and the lowermost edge is taken as the height of the rectangle, and the distance between the leftmost and rightmost points is The vertical distance of is defined as the height of the rectangle. Similarly, by the same method, the face rectangle is obtained by obtaining the four points of the uppermost edge, the lowermost edge, the leftmost edge, and the rightmost point of the key points of the face. Divide the two to get the volume information, the calculation formula is:
Figure PCTCN2022071475-appb-000009
Figure PCTCN2022071475-appb-000009
416、若头发识别任务标识包括发型识别标识,则根据头发轮廓图形提取人脸图像中的头发图像特征,并根据头发图像特征识别人脸图像的发型信息。416. If the hair recognition task identifier includes a hairstyle recognition identifier, extract the hair image features in the face image according to the hair contour graphic, and recognize the hairstyle information of the face image according to the hair image features.
本实施例在前实施例的基础上,详细描述了根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息。通过实现定义头发细节信息的计算公式,进行头发细节信息的计算,能够高效获得对应的头发细节信息。On the basis of the previous embodiments, this embodiment describes in detail how to calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair contour figure. By realizing the calculation formula for defining the hair detail information and performing the calculation of the hair detail information, the corresponding hair detail information can be obtained efficiently.
请参阅图5,本申请实施例中头发信息识别方法的第五个实施例包括:Please refer to Fig. 5, the fifth embodiment of the hair information recognition method in the embodiment of the present application includes:
501、获取待识别的人脸图像;501. Obtain a face image to be recognized;
502、将人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到人脸图像的人脸关键点及其坐标信息;502. Input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and their coordinate information of the face image;
503、将人脸图像输入至预先训练好的轮廓识别模型中,得到人脸图像的至少一个轮廓图形;503. Input the face image into the pre-trained contour recognition model to obtain at least one contour figure of the face image;
504、根据人脸关键点,从轮廓图形中确定人脸图像的头发轮廓图形,并根据人脸关键点的坐标信息计算头发轮廓图形的坐标信息;504. Determine the hair contour graphics of the face image from the contour graphics according to the key points of the face, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the face;
505、获取用户输入的头发识别请求,并解析头发识别请求中携带的头发识别任务标识,其中头发识别任务标识包括头发细节识别标识和/或发型识别标识;505. Obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, where the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
506、若头发识别任务标识包括头发细节识别标识,则根据人脸关键点的坐标信息和头发轮廓图形的坐标信息,计算人脸图像的头发细节信息;506. If the hair recognition task identifier includes the hair detail recognition identifier, calculate the hair detail information of the face image according to the coordinate information of the key points of the face and the coordinate information of the hair outline graphic;
506、若头发识别任务标识包括发型识别标识,则根据头发轮廓图形,提取人脸图像中的头发图像;506. If the hair recognition task identifier includes a hairstyle recognition identifier, then extract the hair image in the face image according to the hair contour graphic;
507、根据预设的多任务卷积神经网络,提取头发图像中的头发图像特征;507. Extract hair image features in the hair image according to the preset multi-task convolutional neural network;
508、根据提取到的头发图像特征,执行至少一个发型识别任务,得到至少一个发型信息。508. Perform at least one hairstyle recognition task according to the extracted hair image features to obtain at least one hairstyle information.
在本实施例中,头发图像特征是从人脸图像中提取出的关于头发的图像特征,其中,图像特征是表示图像的颜色、纹理、形状或空间关系等的特征。在本实施例中,头发图像特征具体可以是计算机设备从发型图像中提取出的可以表示头发的颜色、长度或形状等的数据,可以看作是发型图像的“非图像”的表示或描述,如数值、向量、矩阵或符号等。In this embodiment, the hair image feature is the image feature about hair extracted from the face image, wherein the image feature is a feature representing the color, texture, shape or spatial relationship of the image. In this embodiment, the hair image feature can specifically be the data extracted by the computer device from the hairstyle image, which can represent the color, length or shape of the hair, etc., which can be regarded as the representation or description of the "non-image" of the hairstyle image, Such as numeric values, vectors, matrices, or symbols.
在本实施例中,可通过卷积神经网络处理头发轮廓图形范围内的人脸图像,以提取人脸图像中的头发图像特征,针对需要的不同的发型信息,可能设置多任务卷积神经网络进行多特征提取,本实施例中,发型信息可以包括头发长度、头发颜色,包括长发、中发、短发、超短发、光头和绑头发等。头发颜色可以包括:黑色、棕色、金色、灰白色、红色等。In this embodiment, the face image within the range of the hair outline graphics can be processed through the convolutional neural network to extract the hair image features in the face image, and a multi-task convolutional neural network may be set for different hairstyle information required Multi-feature extraction is carried out. In this embodiment, hairstyle information may include hair length and hair color, including long hair, medium hair, short hair, ultra-short hair, bald head, and tied hair. Hair colors can include: black, brown, blonde, off-white, red, etc.
本实施例在前实施例的基础上,详细描述了根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息的过程,通过头发轮廓图形,提取人脸图像中的头发图像;根据预设的多任务卷积神经网络,提取头发图像中的头发图像特征;根据提取到的头发图像特征,执行至少一个发型识别任务,得到至少一个发型信息。通过本方法,能够对进行多种头发图像特征进行提取,并对应得到多种发型信息。On the basis of the previous embodiments, this embodiment describes in detail the process of extracting the hair image features in the face image according to the hair contour graphics, and identifying the hairstyle information of the face image according to the hair image features , extract the hair image in the face image through the hair contour graph; extract the hair image features in the hair image according to the preset multi-task convolutional neural network; perform at least one hairstyle recognition task according to the extracted hair image features, Get at least one hairstyle information. Through this method, various hair image features can be extracted, and various hairstyle information can be correspondingly obtained.
上面对本申请实施例中头发信息识别方法进行了描述,下面对本申请实施例中头发信息识别装置进行描述,请参阅图6,本申请实施例中头发信息识别装置一个实施例包括:The hair information recognition method in the embodiment of the present application is described above, and the hair information recognition device in the embodiment of the present application is described below. Please refer to FIG. 6. An embodiment of the hair information recognition device in the embodiment of the present application includes:
获取模块601,用于获取待识别的人脸图像;第一模型输入模块602,用于将所述人脸 图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;第二模型输入模块603,用于将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;头发轮廓确定模块604,用于根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;任务解析模块605,用于获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;头发细节识别模块606,用于当所述头发识别任务标识包括头发细节识别标识时,根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;发型信息识别模块607,用于当所述头发识别任务标识包括发型识别标识时,根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The obtaining module 601 is used to obtain the face image to be recognized; the first model input module 602 is used to input the face image into the pre-trained face key point recognition model for face feature recognition, and obtain the The face key points of the face image and their coordinate information; the second model input module 603 is used to input the face image into a pre-trained contour recognition model to obtain at least one contour of the face image Graphics; hair contour determination module 604, used to determine the hair contour pattern of the human face image from the contour pattern according to the key points of the human face, and calculate the hair contour pattern according to the coordinate information of the key points of the human face The coordinate information of the contour graphics; the task parsing module 605, configured to obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or or hairstyle identification; the hair detail identification module 606 is used to calculate the The hair detail information of the face image; the hair style information recognition module 607, used to extract the hair image features in the face image according to the hair contour figure when the hair recognition task identification includes the hair style recognition identification, and according to the The hairstyle information of the face image is identified based on the hair image feature.
需要强调的是,为保证数据的私密和安全性,上述人脸图像可以存储于一区块链的节点中。It should be emphasized that, in order to ensure the privacy and security of data, the above-mentioned face images can be stored in nodes of a block chain.
本申请实施例中,所述头发信息识别装置运行上述头发信息识别方法,所述头发信息识别装置通过获取待识别的人脸图像;将所述人脸图像分别输入至预先训练好的人脸关键点识别模型和轮廓识别模型中,得到所述人脸图像的人脸关键点的坐标信息和所述人脸图像的头发轮廓图形;根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;获取用户输入的头发识别请求,根据所述头发识别请求选择对应的头发识别任务,其中所述头发识别任务包括头发细节识别和发型识别;若所述头发识别任务为头发细节识别,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;若所述头发识别任务为发型识别,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。本方法基于深度学习技术,对人脸图像进行识别,得到头发轮廓和人脸关键点,基于应用场景定义头发信息,进行头发信息的计算,不仅能够对头发的整体区域进行识别,同时能够准确地对头发的诸多信息进行有效识别。In the embodiment of the present application, the hair information recognition device runs the above hair information recognition method, the hair information recognition device obtains the face image to be recognized; respectively inputs the face image into the pre-trained face key In the point recognition model and the contour recognition model, the coordinate information of the key points of the human face and the hair contour figure of the human face image are obtained; the hair contour figure is calculated according to the coordinate information of the key points of the human face coordinate information; obtain the hair recognition request input by the user, and select the corresponding hair recognition task according to the hair recognition request, wherein the hair recognition task includes hair detail recognition and hairstyle recognition; if the hair recognition task is hair detail recognition, Then, according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic, calculate the hair detail information of the human face image; if the hair recognition task is hairstyle recognition, then extract The features of the hair image in the face image, and identifying the hairstyle information of the face image according to the features of the hair image. Based on deep learning technology, this method recognizes the face image, obtains the hair outline and key points of the face, defines the hair information based on the application scene, and calculates the hair information. It can not only identify the overall hair area, but also accurately Effective identification of many hair information.
请参阅图7,本申请实施例中头发信息识别装置的第二个实施例包括:Please refer to Figure 7, the second embodiment of the hair information recognition device in the embodiment of the present application includes:
获取模块601,用于获取待识别的人脸图像;第一模型输入模块602,用于将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;第二模型输入模块603,用于将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;头发轮廓确定模块604,用于根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;任务解析模块605,用于获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;头发细节识别模块606,用于当所述头发识别任务标识包括头发细节识别标识时,根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;发型信息识别模块607,用于当所述头发识别任务标识包括发型识别标识时,根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。The obtaining module 601 is used to obtain the face image to be recognized; the first model input module 602 is used to input the face image into the pre-trained face key point recognition model for face feature recognition, and obtain the The face key points of the face image and their coordinate information; the second model input module 603 is used to input the face image into a pre-trained contour recognition model to obtain at least one contour of the face image Graphics; hair contour determination module 604, used to determine the hair contour pattern of the human face image from the contour pattern according to the key points of the human face, and calculate the hair contour pattern according to the coordinate information of the key points of the human face The coordinate information of the contour graphics; the task parsing module 605, configured to obtain the hair recognition request input by the user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes the hair detail recognition identifier and/or or hairstyle identification; the hair detail identification module 606 is used to calculate the The hair detail information of the face image; the hair style information recognition module 607, used to extract the hair image features in the face image according to the hair contour figure when the hair recognition task identification includes the hair style recognition identification, and according to the The hairstyle information of the face image is identified based on the hair image features.
其中,所述头发信息识别装置还包括第一模型训练模块608,所述第一模型训练模块608具体用于:获取训练样本集,其中,所述训练样本集包括样本人脸图像;获取所述样本人脸图像的第一样本人脸关键点信息,并对所述第一样本人脸关键点信息进行标注,得 到第一样本人脸姿态信息;将所述样本人脸图像输入至预设的神经网络中,得到第二样本人脸关键点信息和第二样本人脸姿态信息;将所述第一样本人脸关键点信息和所述第一样本人脸姿态信息分别与所述第二样本人脸关键点信息和第二样本人脸姿态信息进行比较,计算损失函数;判断所述损失函数是否大于预设阈值;若是,则根据所述损失函数调整所述神经网络的参数,并将所述样本人脸图像输入至参数调整后的神经网络中,重复模型训练,直至所述损失函数不大于预设阈值,得到人脸关键点识别模型。Wherein, the hair information recognition device further includes a first model training module 608, and the first model training module 608 is specifically used to: obtain a training sample set, wherein the training sample set includes a sample face image; obtain the The first sample human face key point information of the sample human face image, and the first sample human face key point information is marked to obtain the first sample human face posture information; the sample human face image is input to the preset In the neural network, obtain the second sample human face key point information and the second sample human face posture information; combine the first sample human face key point information and the first sample human face posture information with the second sample Comparing the face key point information with the second sample face pose information, calculating a loss function; judging whether the loss function is greater than a preset threshold; if so, adjusting the parameters of the neural network according to the loss function, and The sample face image is input into the neural network after parameter adjustment, and the model training is repeated until the loss function is not greater than the preset threshold, and a face key point recognition model is obtained.
其中,所述头发信息识别装置还包括第二模型训练模块609,所述第二模型训练模块609具体用于:获取预设的测试集,其中,所述测试集包括测试人脸图像;获取所述样本人脸图像和所述测试人脸图像的标记信息,并根据所述标记信息生成所述样本人脸图像和所述测试人脸图像对应的掩模图像;将所述样本人脸图像输入至语义分割网络中,得到语义分割图像,并通过交叉熵损失函数计算所述语义分割图像与所述样本人脸图像对应的掩模图像之间的损失值,并根据所述值调整所述语义分割网络的参数进行下一轮训练,直至进行完预设轮数训练后结束;将所述测试集输入至训练结束后的语义分割网络中,得到对应的语义分割图像,并根据所述测试集对应的掩模图像和所述测试集对应的语义分割图像计算分割评价指标;判断所述分割评价指标是否达到预设标准;若否,则调整所述交叉熵损失函数,并再次对所述语义分割网络进行训练和测试,直至所述分割评价指标达到预设标准,得到轮廓识别模型。Wherein, the hair information recognition device further includes a second model training module 609, and the second model training module 609 is specifically used to: obtain a preset test set, wherein the test set includes a test face image; obtain the The mark information of the sample face image and the test face image, and generate the mask image corresponding to the sample face image and the test face image according to the mark information; input the sample face image In the semantic segmentation network, the semantic segmentation image is obtained, and the loss value between the semantic segmentation image and the mask image corresponding to the sample face image is calculated through the cross-entropy loss function, and the semantic segmentation is adjusted according to the value Segment the parameters of the network for the next round of training until the end of the preset rounds of training; input the test set into the semantic segmentation network after the training to obtain the corresponding semantic segmentation image, and according to the test set Calculate the segmentation evaluation index for the corresponding mask image and the semantic segmentation image corresponding to the test set; judge whether the segmentation evaluation index reaches the preset standard; if not, adjust the cross-entropy loss function, and perform the semantic Segment the network for training and testing until the segmentation evaluation index reaches a preset standard to obtain a contour recognition model.
可选的,所述人脸关键点包括左眼关键点和右眼关键点,所述头发细节信息包括刘海长度信息,所述头发细节识别模块606具体用于:根据所述左眼关键点和所述右眼关键点的坐标信息,将所述人脸图像划分为左区域、中区域和右区域;根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度;分别根据所述左区域、中区域和右区域中的头发轮廓图形中的最高点和最低点的坐标信息,计算得到左区域、中区域和右区域的头发长度;将所述头发长度除以所述人脸长度,得到刘海长度信息。Optionally, the face key points include left eye key points and right eye key points, the hair detail information includes fringe length information, and the hair detail recognition module 606 is specifically configured to: according to the left eye key points and The coordinate information of the key point of the right eye is divided into the left area, the middle area and the right area; according to the coordinate information of the lowest point of the key point of the human face in the middle area and the hair outline The coordinate information of the highest point in the graph is used to calculate the length of the face in the face image; according to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left area, the middle area and the right area, the calculation is obtained The hair lengths of the left region, the middle region and the right region; dividing the hair length by the face length to obtain the length information of bangs.
可选的,所述头发细节信息还包括发际线高度信息,所述头发细节识别模块605具体还用于:连接所述左眼关键点和所述右眼关键点,得到连接线;分别计算所述左区域、中区域和右区域的头发轮廓图形中的最低点与所述连接线的距离值,并选择左区域、中区域和右区域中的距离值的最大值除以所述人脸长度,得到所述人脸图像的额头高度;将一减去所述额头高度,得到所述人脸图像的发际线高度信息。Optionally, the hair detail information also includes hairline height information, and the hair detail identification module 605 is specifically further configured to: connect the left eye key point and the right eye key point to obtain a connecting line; respectively calculate The distance value between the lowest point and the connecting line in the hair contour graphics of the left region, the middle region and the right region, and select the maximum value of the distance value in the left region, the middle region and the right region divided by the human face length to obtain the forehead height of the human face image; subtract one from the forehead height to obtain the hairline height information of the human face image.
可选的,所述头发细节识别模块605具体还用于:根据所述头发轮廓图形的坐标信息,构建最小发域矩形,并计算所述最小发域矩形的面积,其中,所述最小发域矩形为包含所述头发轮廓图形的最小矩形;根据所述人脸关键点的坐标信息,构建最小脸部矩形,并计算所述最小脸部矩形的面积,其中所述最小脸部矩形为包含所有所述人脸关键点的最小矩形;将所述最小发域矩形的面积除以所述最小脸部矩形的面积,得到所述人脸图像的发量信息。Optionally, the hair detail identification module 605 is specifically further configured to: construct a minimum hair region rectangle according to the coordinate information of the hair outline graphic, and calculate an area of the minimum hair region rectangle, wherein the minimum hair region The rectangle is the smallest rectangle containing the hair outline graphics; according to the coordinate information of the key points of the human face, the minimum face rectangle is constructed, and the area of the minimum face rectangle is calculated, wherein the minimum face rectangle contains all The minimum rectangle of the key points of the human face; dividing the area of the minimum facial rectangle by the area of the minimum facial rectangle to obtain the hair volume information of the human face image.
可选的,所述发型信息识别模块607具体用于:根据所述头发轮廓图形,提取所述人脸图像中的头发图像;根据预设的多任务卷积神经网络,提取所述头发图像中的头发图像特征;根据提取到的头发图像特征,执行至少一个发型识别任务,得到至少一个发型信息。Optionally, the hair style information identification module 607 is specifically configured to: extract the hair image in the face image according to the hair contour graphic; extract the hair image in the hair image according to a preset multi-task convolutional neural network. Hair image features; according to the extracted hair image features, perform at least one hairstyle recognition task, and obtain at least one hairstyle information.
本实施例在上一实施例的基础上,详细描述了各个模块的具体功能以及部分模块的单元构成,通过新增的模块,基于深度学习技术,对人脸图像进行识别,得到头发轮廓和人脸关键点,基于应用场景定义头发信息,进行头发信息的计算,不仅能够对头发的整体区域进行识别,同时能够准确地对头发的诸多信息进行有效识别。On the basis of the previous embodiment, this embodiment describes in detail the specific functions of each module and the unit composition of some modules. Through the newly added module, based on deep learning technology, the face image is recognized, and the hair outline and human body are obtained. Face key points, define hair information based on application scenarios, and calculate hair information, not only can identify the overall area of hair, but also can accurately and effectively identify many information of hair.
上面图6和图7从模块化功能实体的角度对本申请实施例中的中头发信息识别装置进 行详细描述,下面从硬件处理的角度对本申请实施例中头发信息识别设备进行详细描述。The above Figures 6 and 7 describe in detail the hair information recognition device in the embodiment of the present application from the perspective of modular functional entities, and the following describes the hair information recognition device in the embodiment of the present application in detail from the perspective of hardware processing.
图8是本申请实施例提供的一种头发信息识别设备的结构示意图,该头发信息识别设备800可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)810(例如,一个或一个以上处理器)和存储器820,一个或一个以上存储应用程序833或数据832的存储介质830(例如一个或一个以上海量存储设备)。其中,存储器820和存储介质830可以是短暂存储或持久存储。存储在存储介质830的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对头发信息识别设备800中的一系列指令操作。更进一步地,处理器810可以设置为与存储介质830通信,在头发信息识别设备800上执行存储介质830中的一系列指令操作,以实现上述头发信息识别方法的步骤。Fig. 8 is a schematic structural diagram of a hair information recognition device provided by an embodiment of the present application. The hair information recognition device 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units) , CPU) 810 (eg, one or more processors) and memory 820, and one or more storage media 830 (eg, one or more mass storage devices) for storing application programs 833 or data 832 . Wherein, the memory 820 and the storage medium 830 may be temporary storage or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations for the hair information recognition device 800 . Furthermore, the processor 810 may be configured to communicate with the storage medium 830, and execute a series of instruction operations in the storage medium 830 on the hair information identification device 800, so as to realize the steps of the above hair information identification method.
头发信息识别设备800还可以包括一个或一个以上电源840,一个或一个以上有线或无线网络接口850,一个或一个以上输入输出接口860,和/或,一个或一个以上操作***831,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图8示出的头发信息识别设备结构并不构成对本申请提供的头发信息识别设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The hair information identification device 800 can also include one or more power sources 840, one or more wired or wireless network interfaces 850, one or more input and output interfaces 860, and/or, one or more operating systems 831, such as Windows Server , Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand that the structure of the hair information recognition device shown in Figure 8 does not constitute a limitation to the hair information recognition device provided in this application, and may include more or less components than those shown in the illustration, or combine some components, or different component arrangements.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Block chain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain (Block chain), essentially a decentralized database, is a series of data blocks associated with each other using cryptographic methods. Each data block contains a batch of network transaction information for verification The validity of its information (anti-counterfeiting) and the generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,该计算机可读存储介质也可以为易失性计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行所述头发信息识别方法的步骤。The present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium may also be a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium, and when the instructions are run on the computer, the computer is made to execute the steps of the method for identifying hair information.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的***或装置、单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the system, device, and unit described above can refer to the corresponding process in the foregoing method embodiments, and details are not repeated here.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or part of the contribution to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions described in each embodiment are modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the application.

Claims (20)

  1. 一种头发信息识别方法,其中,所述头发信息识别方法包括:A method for identifying hair information, wherein the method for identifying hair information includes:
    获取待识别的人脸图像;Obtain the face image to be recognized;
    将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;The face image is input into the pre-trained face key point recognition model to perform face feature recognition, and the face key points and coordinate information thereof of the human face image are obtained;
    将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;Inputting the human face image into a pre-trained contour recognition model to obtain at least one contour figure of the human face image;
    根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;According to the key points of the human face, determine the hair contour graphics of the human face image from the contour graphics, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the human face;
    获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;Obtaining a hair recognition request input by a user, and parsing the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
    若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;If the hair recognition task identification includes a hair detail identification identification, then calculate the hair detail information of the human face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic;
    若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。If the hair recognition task identifier includes a hairstyle recognition identifier, extract hair image features in the face image according to the hair contour graphic, and identify hairstyle information of the face image according to the hair image features.
  2. 根据权利要求1所述的头发信息识别方法,其中,所述人脸关键点识别模型通过以下步骤训练得到:The hair information recognition method according to claim 1, wherein the key point recognition model of human face is obtained through the following steps of training:
    获取训练样本集,其中,所述训练样本集包括样本人脸图像;Obtain a training sample set, wherein the training sample set includes a sample face image;
    获取所述样本人脸图像的第一样本人脸关键点信息,并对所述第一样本人脸关键点信息进行标注,得到第一样本人脸姿态信息;Acquiring the first sample face key point information of the sample face image, and marking the first sample face key point information to obtain the first sample face pose information;
    将所述样本人脸图像输入至预设的神经网络中,得到第二样本人脸关键点信息和第二样本人脸姿态信息;The sample face image is input into a preset neural network to obtain the second sample face key point information and the second sample face pose information;
    将所述第一样本人脸关键点信息和所述第一样本人脸姿态信息分别与所述第二样本人脸关键点信息和第二样本人脸姿态信息进行比较,计算损失函数;Comparing the first sample face key point information and the first sample face pose information with the second sample face key point information and the second sample face pose information respectively, and calculating a loss function;
    判断所述损失函数是否大于预设阈值;judging whether the loss function is greater than a preset threshold;
    若是,则根据所述损失函数调整所述神经网络的参数,并将所述样本人脸图像输入至参数调整后的神经网络中,重复模型训练,直至所述损失函数不大于预设阈值,得到人脸关键点识别模型。If so, adjust the parameters of the neural network according to the loss function, and input the sample face image into the parameter-adjusted neural network, and repeat the model training until the loss function is not greater than the preset threshold, and obtain Face key point recognition model.
  3. 根据权利要求2所述的头发信息识别方法,其中,所述轮廓识别模型通过以下步骤训练得到:The hair information recognition method according to claim 2, wherein the contour recognition model is obtained through the following steps of training:
    获取预设的测试集,其中,所述测试集包括测试人脸图像;Obtain a preset test set, wherein the test set includes a test face image;
    获取所述样本人脸图像和所述测试人脸图像的标记信息,并根据所述标记信息生成所述样本人脸图像和所述测试人脸图像对应的掩模图像;Obtaining the tag information of the sample face image and the test face image, and generating a mask image corresponding to the sample face image and the test face image according to the tag information;
    将所述样本人脸图像输入至语义分割网络中,得到语义分割图像,并通过交叉熵损失函数计算所述语义分割图像与所述样本人脸图像对应的掩模图像之间的损失值,并根据所述值调整所述语义分割网络的参数进行下一轮训练,直至进行完预设轮数训练后结束;The sample human face image is input into the semantic segmentation network to obtain the semantic segmentation image, and the loss value between the semantic segmentation image and the mask image corresponding to the sample human face image is calculated by a cross-entropy loss function, and Adjust the parameters of the semantic segmentation network according to the value for the next round of training until the preset number of rounds of training is completed;
    将所述测试集输入至训练结束后的语义分割网络中,得到对应的语义分割图像,并根据所述测试集对应的掩模图像和所述测试集对应的语义分割图像计算分割评价指标;The test set is input into the semantic segmentation network after the training to obtain the corresponding semantic segmentation image, and the segmentation evaluation index is calculated according to the mask image corresponding to the test set and the semantic segmentation image corresponding to the test set;
    判断所述分割评价指标是否达到预设标准;judging whether the segmentation evaluation index reaches a preset standard;
    若否,则调整所述交叉熵损失函数,并再次对所述语义分割网络进行训练和测试,直至所述分割评价指标达到预设标准,得到轮廓识别模型。If not, the cross-entropy loss function is adjusted, and the semantic segmentation network is trained and tested again until the segmentation evaluation index reaches a preset standard to obtain a contour recognition model.
  4. 根据权利要求1-3中任一项所述的头发信息识别方法,其中,所述人脸关键点包括左眼关键点和右眼关键点,所述头发细节信息包括刘海长度信息;The method for identifying hair information according to any one of claims 1-3, wherein the key points of the human face include key points of the left eye and key points of the right eye, and the detail information of the hair includes the length information of bangs;
    所述根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息包括:According to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic, calculating the hair detail information of the human face image includes:
    根据所述左眼关键点和所述右眼关键点的坐标信息,将所述人脸图像划分为左区域、中区域和右区域;According to the coordinate information of the key point of the left eye and the key point of the right eye, the face image is divided into a left area, a middle area and a right area;
    根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度;Calculate the length of the face in the face image according to the coordinate information of the lowest point of the key points of the face in the middle area and the coordinate information of the highest point in the hair outline graphic;
    分别根据所述左区域、中区域和右区域中的头发轮廓图形中的最高点和最低点的坐标信息,计算得到左区域、中区域和右区域的头发长度;Calculate the hair lengths in the left, middle and right regions according to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left, middle and right regions respectively;
    将所述头发长度除以所述人脸长度,得到刘海长度信息。Divide the length of the hair by the length of the face to obtain the length information of the bangs.
  5. 根据权利要求4所述的头发信息识别方法,其中,所述头发细节信息还包括发际线高度信息;The hair information identification method according to claim 4, wherein the hair detail information further includes hairline height information;
    在所述根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度之后,还包括:After calculating the length of the face in the face image according to the coordinate information of the lowest point of the key point of the face in the middle area and the coordinate information of the highest point in the hair outline graphic, it also includes:
    连接所述左眼关键点和所述右眼关键点,得到连接线;Connecting the key points of the left eye and the key points of the right eye to obtain a connecting line;
    分别计算所述左区域、中区域和右区域的头发轮廓图形中的最低点与所述连接线的距离值,并选择左区域、中区域和右区域中的距离值的最大值除以所述人脸长度,得到所述人脸图像的额头高度;Calculate respectively the distance value between the lowest point and the connecting line in the hair outline graphics of the left region, the middle region and the right region, and select the maximum value of the distance values in the left region, the middle region and the right region divided by the Face length, obtain the forehead height of described face image;
    将一减去所述额头高度,得到所述人脸图像的发际线高度信息。The forehead height is subtracted from one to obtain the hairline height information of the face image.
  6. 根据权利要求5所述的头发信息识别方法,其中,所述头发细节信息还包括发量信息;The hair information identification method according to claim 5, wherein the hair detail information also includes hair volume information;
    所述根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息还包括:The calculating the hair detail information of the human face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphics further includes:
    根据所述头发轮廓图形的坐标信息,构建最小发域矩形,并计算所述最小发域矩形的面积,其中,所述最小发域矩形为包含所述头发轮廓图形的最小矩形;Constructing a minimum hair region rectangle according to the coordinate information of the hair contour figure, and calculating the area of the minimum hair region rectangle, wherein the minimum hair region rectangle is the smallest rectangle containing the hair contour figure;
    根据所述人脸关键点的坐标信息,构建最小脸部矩形,并计算所述最小脸部矩形的面积,其中所述最小脸部矩形为包含所有所述人脸关键点的最小矩形;According to the coordinate information of the key points of the human face, construct the minimum face rectangle, and calculate the area of the minimum face rectangle, wherein the minimum face rectangle is the minimum rectangle containing all the key points of the human face;
    将所述最小发域矩形的面积除以所述最小脸部矩形的面积,得到所述人脸图像的发量信息。Divide the area of the minimum hair region rectangle by the area of the minimum face rectangle to obtain the hair volume information of the face image.
  7. 根据权利要求1-3中任一项所述的头发信息识别方法,其中,所述根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息包括:The hair information recognition method according to any one of claims 1-3, wherein the hair image features in the face image are extracted according to the hair contour graphics, and the hair image features are identified according to the hair image features. The hairstyle information of the face image includes:
    根据所述头发轮廓图形,提取所述人脸图像中的头发图像;Extracting the hair image in the face image according to the hair contour figure;
    根据预设的多任务卷积神经网络,提取所述头发图像中的头发图像特征;Extracting hair image features in the hair image according to a preset multi-task convolutional neural network;
    根据提取到的头发图像特征,执行至少一个发型识别任务,得到至少一个发型信息。According to the extracted hair image features, at least one hairstyle recognition task is performed to obtain at least one hairstyle information.
  8. 一种头发信息识别设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:A hair information identification device, comprising a memory, a processor, and computer-readable instructions stored on the memory and operable on the processor, and the processor implements the following steps when executing the computer-readable instructions:
    获取待识别的人脸图像;Obtain the face image to be recognized;
    将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;The face image is input into the pre-trained face key point recognition model to perform face feature recognition, and the face key points and coordinate information thereof of the human face image are obtained;
    将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;Inputting the human face image into a pre-trained contour recognition model to obtain at least one contour figure of the human face image;
    根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;According to the key points of the human face, determine the hair contour graphics of the human face image from the contour graphics, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the human face;
    获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;Obtaining a hair recognition request input by a user, and parsing the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
    若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;If the hair recognition task identification includes a hair detail identification identification, then calculate the hair detail information of the human face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic;
    若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。If the hair recognition task identifier includes a hairstyle recognition identifier, extract hair image features in the face image according to the hair contour graphic, and identify hairstyle information of the face image according to the hair image features.
  9. 根据权利要求8所述的头发信息识别设备,其中,所述人脸关键点识别模型通过以下步骤训练得到:The hair information recognition device according to claim 8, wherein the facial key point recognition model is obtained through the following steps of training:
    获取训练样本集,其中,所述训练样本集包括样本人脸图像;Obtain a training sample set, wherein the training sample set includes a sample face image;
    获取所述样本人脸图像的第一样本人脸关键点信息,并对所述第一样本人脸关键点信息进行标注,得到第一样本人脸姿态信息;Acquiring the first sample face key point information of the sample face image, and marking the first sample face key point information to obtain the first sample face pose information;
    将所述样本人脸图像输入至预设的神经网络中,得到第二样本人脸关键点信息和第二样本人脸姿态信息;The sample face image is input into a preset neural network to obtain the second sample face key point information and the second sample face pose information;
    将所述第一样本人脸关键点信息和所述第一样本人脸姿态信息分别与所述第二样本人脸关键点信息和第二样本人脸姿态信息进行比较,计算损失函数;Comparing the first sample face key point information and the first sample face pose information with the second sample face key point information and the second sample face pose information respectively, and calculating a loss function;
    判断所述损失函数是否大于预设阈值;judging whether the loss function is greater than a preset threshold;
    若是,则根据所述损失函数调整所述神经网络的参数,并将所述样本人脸图像输入至参数调整后的神经网络中,重复模型训练,直至所述损失函数不大于预设阈值,得到人脸关键点识别模型。If so, adjust the parameters of the neural network according to the loss function, and input the sample face image into the parameter-adjusted neural network, and repeat the model training until the loss function is not greater than the preset threshold, and obtain Face key point recognition model.
  10. 根据权利要求9所述的头发信息识别设备,其中,所述轮廓识别模型通过以下步骤训练得到:The hair information recognition device according to claim 9, wherein the contour recognition model is trained through the following steps:
    获取预设的测试集,其中,所述测试集包括测试人脸图像;Obtain a preset test set, wherein the test set includes a test face image;
    获取所述样本人脸图像和所述测试人脸图像的标记信息,并根据所述标记信息生成所述样本人脸图像和所述测试人脸图像对应的掩模图像;Obtaining the tag information of the sample face image and the test face image, and generating a mask image corresponding to the sample face image and the test face image according to the tag information;
    将所述样本人脸图像输入至语义分割网络中,得到语义分割图像,并通过交叉熵损失函数计算所述语义分割图像与所述样本人脸图像对应的掩模图像之间的损失值,并根据所述值调整所述语义分割网络的参数进行下一轮训练,直至进行完预设轮数训练后结束;The sample human face image is input into the semantic segmentation network to obtain the semantic segmentation image, and the loss value between the semantic segmentation image and the mask image corresponding to the sample human face image is calculated by a cross-entropy loss function, and Adjust the parameters of the semantic segmentation network according to the value for the next round of training until the preset number of rounds of training is completed;
    将所述测试集输入至训练结束后的语义分割网络中,得到对应的语义分割图像,并根据所述测试集对应的掩模图像和所述测试集对应的语义分割图像计算分割评价指标;The test set is input into the semantic segmentation network after the training to obtain the corresponding semantic segmentation image, and the segmentation evaluation index is calculated according to the mask image corresponding to the test set and the semantic segmentation image corresponding to the test set;
    判断所述分割评价指标是否达到预设标准;judging whether the segmentation evaluation index reaches a preset standard;
    若否,则调整所述交叉熵损失函数,并再次对所述语义分割网络进行训练和测试,直至所述分割评价指标达到预设标准,得到轮廓识别模型。If not, the cross-entropy loss function is adjusted, and the semantic segmentation network is trained and tested again until the segmentation evaluation index reaches a preset standard to obtain a contour recognition model.
  11. 根据权利要求8-10中任一项所述的头发信息识别设备,其中,所述人脸关键点包括左眼关键点和右眼关键点,所述头发细节信息包括刘海长度信息;The hair information recognition device according to any one of claims 8-10, wherein the face key points include left eye key points and right eye key points, and the hair detail information includes bangs length information;
    所述根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息包括:According to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic, calculating the hair detail information of the human face image includes:
    根据所述左眼关键点和所述右眼关键点的坐标信息,将所述人脸图像划分为左区域、中区域和右区域;According to the coordinate information of the key point of the left eye and the key point of the right eye, the face image is divided into a left area, a middle area and a right area;
    根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度;Calculate the length of the face in the face image according to the coordinate information of the lowest point of the key points of the face in the middle area and the coordinate information of the highest point in the hair outline graphic;
    分别根据所述左区域、中区域和右区域中的头发轮廓图形中的最高点和最低点的坐标信息,计算得到左区域、中区域和右区域的头发长度;Calculate the hair lengths in the left, middle and right regions according to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left, middle and right regions respectively;
    将所述头发长度除以所述人脸长度,得到刘海长度信息。Divide the length of the hair by the length of the face to obtain the length information of the bangs.
  12. 根据权利要求11所述的头发信息识别设备,其中,所述头发细节信息还包括发际线高度信息;The hair information identification device according to claim 11, wherein the hair detail information further includes hairline height information;
    在所述根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度之后,还包括:After calculating the length of the face in the face image according to the coordinate information of the lowest point of the key point of the face in the middle area and the coordinate information of the highest point in the hair outline graphic, it also includes:
    连接所述左眼关键点和所述右眼关键点,得到连接线;Connecting the key points of the left eye and the key points of the right eye to obtain a connecting line;
    分别计算所述左区域、中区域和右区域的头发轮廓图形中的最低点与所述连接线的距离值,并选择左区域、中区域和右区域中的距离值的最大值除以所述人脸长度,得到所述人脸图像的额头高度;Calculate respectively the distance value between the lowest point and the connecting line in the hair outline graphics of the left region, the middle region and the right region, and select the maximum value of the distance values in the left region, the middle region and the right region divided by the Face length, obtain the forehead height of described face image;
    将一减去所述额头高度,得到所述人脸图像的发际线高度信息。The forehead height is subtracted from one to obtain the hairline height information of the face image.
  13. 根据权利要求12所述的头发信息识别设备,其中,所述头发细节信息还包括发量信息;The hair information identification device according to claim 12, wherein the hair detail information further includes hair volume information;
    所述根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息还包括:The calculating the hair detail information of the human face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphics further includes:
    根据所述头发轮廓图形的坐标信息,构建最小发域矩形,并计算所述最小发域矩形的面积,其中,所述最小发域矩形为包含所述头发轮廓图形的最小矩形;Constructing a minimum hair region rectangle according to the coordinate information of the hair contour figure, and calculating the area of the minimum hair region rectangle, wherein the minimum hair region rectangle is the smallest rectangle containing the hair contour figure;
    根据所述人脸关键点的坐标信息,构建最小脸部矩形,并计算所述最小脸部矩形的面积,其中所述最小脸部矩形为包含所有所述人脸关键点的最小矩形;According to the coordinate information of the key points of the human face, construct the minimum face rectangle, and calculate the area of the minimum face rectangle, wherein the minimum face rectangle is the minimum rectangle containing all the key points of the human face;
    将所述最小发域矩形的面积除以所述最小脸部矩形的面积,得到所述人脸图像的发量信息。Divide the area of the minimum hair region rectangle by the area of the minimum face rectangle to obtain the hair volume information of the face image.
  14. 根据权利要求8-10中任一项所述的头发信息识别设备,其中,所述根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息包括:The hair information recognition device according to any one of claims 8-10, wherein the hair image features in the face image are extracted according to the hair contour graphics, and the hair image features are identified according to the hair image features. The hairstyle information of the face image includes:
    根据所述头发轮廓图形,提取所述人脸图像中的头发图像;Extracting the hair image in the face image according to the hair contour figure;
    根据预设的多任务卷积神经网络,提取所述头发图像中的头发图像特征;Extracting hair image features in the hair image according to a preset multi-task convolutional neural network;
    根据提取到的头发图像特征,执行至少一个发型识别任务,得到至少一个发型信息。According to the extracted hair image features, at least one hairstyle recognition task is performed to obtain at least one hairstyle information.
  15. 一种计算机可读存储介质,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:A computer-readable storage medium, wherein computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the computer, the computer is made to perform the following steps:
    获取待识别的人脸图像;Obtain the face image to be recognized;
    将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;The face image is input into the pre-trained face key point recognition model to perform face feature recognition, and the face key points and coordinate information thereof of the human face image are obtained;
    将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;Inputting the human face image into a pre-trained contour recognition model to obtain at least one contour figure of the human face image;
    根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;According to the key points of the human face, determine the hair contour graphics of the human face image from the contour graphics, and calculate the coordinate information of the hair contour graphics according to the coordinate information of the key points of the human face;
    获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;Obtaining a hair recognition request input by a user, and parsing the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
    若所述头发识别任务标识包括头发细节识别标识,则根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;If the hair recognition task identification includes a hair detail identification identification, then calculate the hair detail information of the human face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic;
    若所述头发识别任务标识包括发型识别标识,则根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。If the hair recognition task identifier includes a hairstyle recognition identifier, extract hair image features in the face image according to the hair contour graphic, and identify hairstyle information of the face image according to the hair image features.
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述人脸关键点识别模型通过以下步骤训练得到:The computer-readable storage medium according to claim 15, wherein the human face key point recognition model is obtained through the following steps of training:
    获取训练样本集,其中,所述训练样本集包括样本人脸图像;Obtain a training sample set, wherein the training sample set includes a sample face image;
    获取所述样本人脸图像的第一样本人脸关键点信息,并对所述第一样本人脸关键点信息进行标注,得到第一样本人脸姿态信息;Acquiring the first sample face key point information of the sample face image, and marking the first sample face key point information to obtain the first sample face pose information;
    将所述样本人脸图像输入至预设的神经网络中,得到第二样本人脸关键点信息和第二样本人脸姿态信息;The sample face image is input into a preset neural network to obtain the second sample face key point information and the second sample face posture information;
    将所述第一样本人脸关键点信息和所述第一样本人脸姿态信息分别与所述第二样本人脸关键点信息和第二样本人脸姿态信息进行比较,计算损失函数;Comparing the first sample face key point information and the first sample face pose information with the second sample face key point information and the second sample face pose information respectively, and calculating a loss function;
    判断所述损失函数是否大于预设阈值;judging whether the loss function is greater than a preset threshold;
    若是,则根据所述损失函数调整所述神经网络的参数,并将所述样本人脸图像输入至参数调整后的神经网络中,重复模型训练,直至所述损失函数不大于预设阈值,得到人脸关键点识别模型。If so, adjust the parameters of the neural network according to the loss function, and input the sample face image into the parameter-adjusted neural network, and repeat the model training until the loss function is not greater than the preset threshold, and obtain Face key point recognition model.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述轮廓识别模型通过以下步骤训练得到:The computer-readable storage medium according to claim 16, wherein the contour recognition model is obtained by training through the following steps:
    获取预设的测试集,其中,所述测试集包括测试人脸图像;Obtain a preset test set, wherein the test set includes a test face image;
    获取所述样本人脸图像和所述测试人脸图像的标记信息,并根据所述标记信息生成所述样本人脸图像和所述测试人脸图像对应的掩模图像;Obtaining the tag information of the sample face image and the test face image, and generating a mask image corresponding to the sample face image and the test face image according to the tag information;
    将所述样本人脸图像输入至语义分割网络中,得到语义分割图像,并通过交叉熵损失函数计算所述语义分割图像与所述样本人脸图像对应的掩模图像之间的损失值,并根据所述值调整所述语义分割网络的参数进行下一轮训练,直至进行完预设轮数训练后结束;The sample human face image is input into the semantic segmentation network to obtain the semantic segmentation image, and the loss value between the semantic segmentation image and the mask image corresponding to the sample human face image is calculated by a cross-entropy loss function, and Adjust the parameters of the semantic segmentation network according to the value for the next round of training until the preset number of rounds of training is completed;
    将所述测试集输入至训练结束后的语义分割网络中,得到对应的语义分割图像,并根据所述测试集对应的掩模图像和所述测试集对应的语义分割图像计算分割评价指标;The test set is input into the semantic segmentation network after the training to obtain the corresponding semantic segmentation image, and the segmentation evaluation index is calculated according to the mask image corresponding to the test set and the semantic segmentation image corresponding to the test set;
    判断所述分割评价指标是否达到预设标准;judging whether the segmentation evaluation index reaches a preset standard;
    若否,则调整所述交叉熵损失函数,并再次对所述语义分割网络进行训练和测试,直至所述分割评价指标达到预设标准,得到轮廓识别模型。If not, the cross-entropy loss function is adjusted, and the semantic segmentation network is trained and tested again until the segmentation evaluation index reaches a preset standard to obtain a contour recognition model.
  18. 根据权利要求15-17所述的计算机可读存储介质,其中,所述人脸关键点包括左眼关键点和右眼关键点,所述头发细节信息包括刘海长度信息;The computer-readable storage medium according to claims 15-17, wherein the face key points include left eye key points and right eye key points, and the hair detail information includes fringe length information;
    所述根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息包括:According to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic, calculating the hair detail information of the human face image includes:
    根据所述左眼关键点和所述右眼关键点的坐标信息,将所述人脸图像划分为左区域、中区域和右区域;According to the coordinate information of the key point of the left eye and the key point of the right eye, the face image is divided into a left area, a middle area and a right area;
    根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度;Calculate the length of the face in the face image according to the coordinate information of the lowest point of the key points of the face in the middle area and the coordinate information of the highest point in the hair outline graphic;
    分别根据所述左区域、中区域和右区域中的头发轮廓图形中的最高点和最低点的坐标信息,计算得到左区域、中区域和右区域的头发长度;Calculate the hair lengths in the left, middle and right regions according to the coordinate information of the highest point and the lowest point in the hair outline graphics in the left, middle and right regions respectively;
    将所述头发长度除以所述人脸长度,得到刘海长度信息。Divide the length of the hair by the length of the face to obtain the length information of the bangs.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述头发细节信息还包括发际线高度信息;The computer-readable storage medium according to claim 18, wherein the hair detail information further includes hairline height information;
    在所述根据所述中区域中所述人脸关键点的最低点的坐标信息和所述头发轮廓图形中最高点的坐标信息,计算所述人脸图像中的人脸长度之后,还包括:After calculating the length of the face in the face image according to the coordinate information of the lowest point of the key point of the face in the middle area and the coordinate information of the highest point in the hair outline graphic, it also includes:
    连接所述左眼关键点和所述右眼关键点,得到连接线;Connecting the key points of the left eye and the key points of the right eye to obtain a connecting line;
    分别计算所述左区域、中区域和右区域的头发轮廓图形中的最低点与所述连接线的距离值,并选择左区域、中区域和右区域中的距离值的最大值除以所述人脸长度,得到所述人脸图像的额头高度;Calculate respectively the distance value between the lowest point and the connecting line in the hair outline graphics of the left region, the middle region and the right region, and select the maximum value of the distance values in the left region, the middle region and the right region divided by the Face length, obtain the forehead height of described face image;
    将一减去所述额头高度,得到所述人脸图像的发际线高度信息。The forehead height is subtracted from one to obtain the hairline height information of the face image.
  20. 一种头发信息识别装置,其中,所述头发信息识别装置包括:A hair information identification device, wherein the hair information identification device includes:
    获取模块,用于获取待识别的人脸图像;An acquisition module, configured to acquire a face image to be identified;
    第一模型输入模块,用于将所述人脸图像输入至预先训练好的人脸关键点识别模型中进行人脸特征识别,得到所述人脸图像的人脸关键点及其坐标信息;The first model input module is used to input the face image into the pre-trained face key point recognition model to perform face feature recognition, and obtain the face key points and coordinate information of the face image;
    第二模型输入模块,用于将所述人脸图像输入至预先训练好的轮廓识别模型中,得到所述人脸图像的至少一个轮廓图形;The second model input module is used to input the human face image into a pre-trained contour recognition model to obtain at least one contour figure of the human face image;
    头发轮廓确定模块,用于根据所述人脸关键点,从所述轮廓图形中确定所述人脸图像的头发轮廓图形,并根据所述人脸关键点的坐标信息计算所述头发轮廓图形的坐标信息;A hair contour determining module, configured to determine the hair contour pattern of the face image from the contour pattern according to the key points of the human face, and calculate the hair contour pattern of the hair contour pattern according to the coordinate information of the key points of the human face coordinate information;
    任务解析模块,用于获取用户输入的头发识别请求,并解析所述头发识别请求中携带的头发识别任务标识,其中所述头发识别任务标识包括头发细节识别标识和/或发型识别标识;A task parsing module, configured to acquire a hair recognition request input by a user, and parse the hair recognition task identifier carried in the hair recognition request, wherein the hair recognition task identifier includes a hair detail recognition identifier and/or a hairstyle recognition identifier;
    头发细节识别模块,用于当所述头发识别任务标识包括头发细节识别标识时,根据所述人脸关键点的坐标信息和所述头发轮廓图形的坐标信息,计算所述人脸图像的头发细节信息;A hair detail identification module, configured to calculate the hair details of the face image according to the coordinate information of the key points of the human face and the coordinate information of the hair outline graphic when the hair identification task identification includes the hair detail identification identification information;
    发型信息识别模块,用于当所述头发识别任务标识包括发型识别标识时,根据所述头发轮廓图形提取所述人脸图像中的头发图像特征,并根据所述头发图像特征识别所述人脸图像的发型信息。A hairstyle information identification module, configured to extract hair image features in the face image according to the hair contour graphic when the hair identification task identification includes a hairstyle identification identification, and identify the human face according to the hair image features Hairstyle information for the image.
PCT/CN2022/071475 2021-06-10 2022-01-12 Hair information recognition method, apparatus and device, and storage medium WO2022257456A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110645384.2 2021-06-10
CN202110645384.2A CN113255561B (en) 2021-06-10 2021-06-10 Hair information identification method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022257456A1 true WO2022257456A1 (en) 2022-12-15

Family

ID=77187246

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/071475 WO2022257456A1 (en) 2021-06-10 2022-01-12 Hair information recognition method, apparatus and device, and storage medium

Country Status (2)

Country Link
CN (1) CN113255561B (en)
WO (1) WO2022257456A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115984426A (en) * 2023-03-21 2023-04-18 美众(天津)科技有限公司 Method, device, terminal and storage medium for generating hair style demonstration image
CN117237397A (en) * 2023-07-13 2023-12-15 天翼爱音乐文化科技有限公司 Portrait segmentation method, system, equipment and storage medium based on feature fusion

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113255561B (en) * 2021-06-10 2021-11-02 平安科技(深圳)有限公司 Hair information identification method, device, equipment and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001344278A (en) * 2000-03-29 2001-12-14 Seiko Epson Corp Method and device for retrieval, storage medium having retrieval program stored therein, method and device for retrieval object map generation, method and device for image retrieval, storage medium having image retrieval program stored therein, storage medium having image retrieval data stored therein, and method and device for image map generation
CN107451950A (en) * 2016-05-30 2017-12-08 北京旷视科技有限公司 Face image synthesis method, human face recognition model training method and related device
CN108009470A (en) * 2017-10-20 2018-05-08 深圳市朗形网络科技有限公司 A kind of method and apparatus of image zooming-out
CN108960167A (en) * 2018-07-11 2018-12-07 腾讯科技(深圳)有限公司 Hair style recognition methods, device, computer readable storage medium and computer equipment
CN110021000A (en) * 2019-05-06 2019-07-16 厦门欢乐逛科技股份有限公司 Hair line restorative procedure and device based on figure layer deformation
CN111582278A (en) * 2019-02-19 2020-08-25 北京嘀嘀无限科技发展有限公司 Portrait segmentation method and device and electronic equipment
CN111814573A (en) * 2020-06-12 2020-10-23 深圳禾思众成科技有限公司 Face information detection method and device, terminal equipment and storage medium
CN111931908A (en) * 2020-07-23 2020-11-13 北京电子科技学院 Face image automatic generation method based on face contour
CN112836566A (en) * 2020-12-01 2021-05-25 北京智云视图科技有限公司 Multitask neural network face key point detection method for edge equipment
CN113255561A (en) * 2021-06-10 2021-08-13 平安科技(深圳)有限公司 Hair information identification method, device, equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102121654B1 (en) * 2018-06-29 2020-06-10 전자부품연구원 Deep Learning Based Automatic Gesture Recognition Method and System
CN109829431B (en) * 2019-01-31 2021-02-12 北京字节跳动网络技术有限公司 Method and apparatus for generating information
US11594074B2 (en) * 2019-09-10 2023-02-28 Amarjot Singh Continuously evolving and interactive Disguised Face Identification (DFI) with facial key points using ScatterNet Hybrid Deep Learning (SHDL) network
CN112257504A (en) * 2020-09-16 2021-01-22 深圳数联天下智能科技有限公司 Face recognition method, face recognition model training method and related device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001344278A (en) * 2000-03-29 2001-12-14 Seiko Epson Corp Method and device for retrieval, storage medium having retrieval program stored therein, method and device for retrieval object map generation, method and device for image retrieval, storage medium having image retrieval program stored therein, storage medium having image retrieval data stored therein, and method and device for image map generation
CN107451950A (en) * 2016-05-30 2017-12-08 北京旷视科技有限公司 Face image synthesis method, human face recognition model training method and related device
CN108009470A (en) * 2017-10-20 2018-05-08 深圳市朗形网络科技有限公司 A kind of method and apparatus of image zooming-out
CN108960167A (en) * 2018-07-11 2018-12-07 腾讯科技(深圳)有限公司 Hair style recognition methods, device, computer readable storage medium and computer equipment
CN111582278A (en) * 2019-02-19 2020-08-25 北京嘀嘀无限科技发展有限公司 Portrait segmentation method and device and electronic equipment
CN110021000A (en) * 2019-05-06 2019-07-16 厦门欢乐逛科技股份有限公司 Hair line restorative procedure and device based on figure layer deformation
CN111814573A (en) * 2020-06-12 2020-10-23 深圳禾思众成科技有限公司 Face information detection method and device, terminal equipment and storage medium
CN111931908A (en) * 2020-07-23 2020-11-13 北京电子科技学院 Face image automatic generation method based on face contour
CN112836566A (en) * 2020-12-01 2021-05-25 北京智云视图科技有限公司 Multitask neural network face key point detection method for edge equipment
CN113255561A (en) * 2021-06-10 2021-08-13 平安科技(深圳)有限公司 Hair information identification method, device, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115984426A (en) * 2023-03-21 2023-04-18 美众(天津)科技有限公司 Method, device, terminal and storage medium for generating hair style demonstration image
CN115984426B (en) * 2023-03-21 2023-07-04 美众(天津)科技有限公司 Method, device, terminal and storage medium for generating hairstyle demonstration image
CN117237397A (en) * 2023-07-13 2023-12-15 天翼爱音乐文化科技有限公司 Portrait segmentation method, system, equipment and storage medium based on feature fusion
CN117237397B (en) * 2023-07-13 2024-05-28 天翼爱音乐文化科技有限公司 Portrait segmentation method, system, equipment and storage medium based on feature fusion

Also Published As

Publication number Publication date
CN113255561A (en) 2021-08-13
CN113255561B (en) 2021-11-02

Similar Documents

Publication Publication Date Title
US11256905B2 (en) Face detection method and apparatus, service processing method, terminal device, and storage medium
WO2022257456A1 (en) Hair information recognition method, apparatus and device, and storage medium
US11651797B2 (en) Real time video processing for changing proportions of an object in the video
WO2020063527A1 (en) Human hairstyle generation method based on multi-feature retrieval and deformation
CN109325437B (en) Image processing method, device and system
US11403874B2 (en) Virtual avatar generation method and apparatus for generating virtual avatar including user selected face property, and storage medium
WO2017193906A1 (en) Image processing method and processing system
US7512255B2 (en) Multi-modal face recognition
JP4950787B2 (en) Image processing apparatus and method
WO2020103700A1 (en) Image recognition method based on micro facial expressions, apparatus and related device
CN108629336B (en) Face characteristic point identification-based color value calculation method
CN107463865B (en) Face detection model training method, face detection method and device
CN110147721A (en) A kind of three-dimensional face identification method, model training method and device
JPH09251534A (en) Device and method for authenticating person
CN108446672B (en) Face alignment method based on shape estimation of coarse face to fine face
JP5644773B2 (en) Apparatus and method for collating face images
CN105335719A (en) Living body detection method and device
CN113570684A (en) Image processing method, image processing device, computer equipment and storage medium
CN113591763B (en) Classification recognition method and device for face shapes, storage medium and computer equipment
CN108615256A (en) A kind of face three-dimensional rebuilding method and device
JP2000030065A (en) Pattern recognizing device and its method
CN115050064A (en) Face living body detection method, device, equipment and medium
CN112101127A (en) Face shape recognition method and device, computing equipment and computer storage medium
CN107153806B (en) Face detection method and device
CN110321935A (en) Business event relationship determines method and device, computer readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22819064

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22819064

Country of ref document: EP

Kind code of ref document: A1