WO2021056531A1 - Face gender recognition method, face gender classifier training method and device - Google Patents

Face gender recognition method, face gender classifier training method and device Download PDF

Info

Publication number
WO2021056531A1
WO2021056531A1 PCT/CN2019/109014 CN2019109014W WO2021056531A1 WO 2021056531 A1 WO2021056531 A1 WO 2021056531A1 CN 2019109014 W CN2019109014 W CN 2019109014W WO 2021056531 A1 WO2021056531 A1 WO 2021056531A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
image
feature
gender
gray
Prior art date
Application number
PCT/CN2019/109014
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 京东方科技集团股份有限公司
Priority to PCT/CN2019/109014 priority Critical patent/WO2021056531A1/en
Priority to CN201980001859.5A priority patent/CN110785769A/en
Publication of WO2021056531A1 publication Critical patent/WO2021056531A1/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/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/50Extraction of image or video features by performing operations within image blocks; by using histograms, e.g. histogram of oriented gradients [HoG]; by summing image-intensity values; Projection analysis
    • 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/172Classification, e.g. identification

Definitions

  • the present disclosure relates to the field of image processing technology, and in particular to a method for facial gender recognition, a method and device for training a facial gender classifier.
  • Human face is a very important biological feature of human beings. Face-based recognition function has gradually become the focus of research in recent years. Face gender recognition has broad development prospects and application value in pattern recognition, artificial intelligence, computer vision, information security, etc.
  • the present disclosure provides a face gender recognition method, a face gender classifier training method and device.
  • the present disclosure provides a face gender recognition method, including:
  • the gender feature of the target face is input into the trained face gender classifier to obtain the gender recognition result of the target face.
  • the method further includes:
  • the facial feature points geometrically correct the target face to obtain a corrected image.
  • the line between the two eyes of the target face is a horizontal line.
  • the performing feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
  • the image of the region of interest of the face is scaled to a specified size.
  • the performing feature extraction on the facial region of interest image to obtain a feature image includes: using a symbiotic local binary pattern feature extraction algorithm to perform feature extraction on the facial region of interest image to obtain multiple Feature images;
  • the obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
  • the performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the gray-scale compressed image includes:
  • n is a positive integer greater than or equal to 2
  • m is a positive integer greater than or equal to 2
  • the present disclosure provides a method for training a face gender classifier, including:
  • multiple face image samples where the multiple face image samples include multiple images with male faces and multiple images with female faces;
  • the face gender classifier is trained by using the gender features of the target face in all the face image samples to obtain a trained face gender classifier.
  • the method further includes:
  • the facial feature points geometrically correct the target face to obtain a corrected image.
  • the line between the two eyes of the target face is a horizontal line.
  • the performing feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
  • the image of the region of interest of the face is scaled to a specified size.
  • the performing feature extraction on the face region of interest image to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the face region of interest image to obtain multiple feature images;
  • the obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
  • the performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the gray-scale compressed image includes:
  • n is a positive integer greater than or equal to 2
  • m is a positive integer greater than or equal to 2
  • the present disclosure provides a face gender recognition device, including:
  • a face detector configured to perform face detection on the image to be recognized, and obtain the target face in the image to be recognized
  • a face feature point extractor for extracting face feature points on the target face
  • a face region of interest obtainer configured to obtain an image of a face region of interest according to the facial feature points
  • An image feature extractor which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • a gray-scale compression processor configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression
  • a gender feature obtainer configured to obtain the gender feature of the target face according to the grayscale histogram
  • the gender recognizer is used to input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
  • the present disclosure provides a training device for a face gender classifier, including:
  • a face image sample acquirer configured to acquire multiple face image samples, the multiple face image samples including multiple images with male faces and multiple images with female faces;
  • a face feature point extractor for extracting face feature points on the target face
  • a face region of interest obtainer configured to obtain an image of a face region of interest according to the facial feature points
  • An image feature extractor which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • a gray-scale compression processor configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression
  • a gender feature obtainer configured to obtain the gender feature of the target face according to the grayscale histogram
  • the trainer is used to train the face gender classifier by using the gender characteristics of the target face in all the face image samples to obtain the trained face gender classifier.
  • the present disclosure provides a face gender recognition device, including a processor, a memory, and a computer program stored on the memory and running on the processor, and the computer program is executed by the processor.
  • the steps of the above face gender recognition method are realized during execution.
  • the present disclosure provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned face gender recognition method are realized; or, When the computer program is executed by the processor, the steps of the training method of the face gender classifier are realized.
  • FIG. 1 is a schematic flowchart of a face gender recognition method provided by some embodiments of the present disclosure
  • FIG. 2 is a schematic flowchart of obtaining a grayscale histogram of an image after grayscale compression according to some embodiments of the present disclosure
  • FIG. 3 is a schematic flowchart of a method for training a face gender classifier provided by some embodiments of the present disclosure
  • FIG. 4 is a schematic flowchart of obtaining a grayscale histogram of an image after grayscale compression according to some other embodiments of the present disclosure
  • FIG. 5 is a schematic structural diagram of a face gender recognition device provided by some embodiments of the present disclosure.
  • FIG. 6 is a schematic structural diagram of a grayscale compression processor provided by some embodiments of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a training device for a face gender classifier provided by some embodiments of the present disclosure.
  • FIG. 8 is a schematic structural diagram of a gray scale compression processor provided by some other embodiments of the present disclosure.
  • FIG. 9 is another schematic structural diagram of a face gender recognition device provided by some embodiments of the present disclosure.
  • FIG. 10 is a schematic diagram of another structure of a training device for a face gender classifier provided by some embodiments of the present disclosure.
  • FIG. 1 is a schematic flowchart of a face gender recognition method provided by some embodiments of the present disclosure. The method includes:
  • Step 11 Perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
  • Face detection is to search for a face from an image and determine the position and size of the face.
  • the Dlib library can be used for face detection.
  • Dlib is a toolbox that contains machine learning algorithms and tools for creating complex software to solve real-world problems.
  • the Dlib library includes tools for object detection in images, including frontal face detection and object pose estimation.
  • the present disclosure can also use other algorithms for face detection.
  • Step 12 Perform face feature point extraction on the target face
  • the Dlib library can be used to extract 68 facial feature points.
  • the number of facial feature points extracted in the present disclosure may be other numbers, which is not limited here.
  • Step 13 Obtain a region of interest (ROI) image of the face according to the feature points of the face;
  • ROI region of interest
  • Step 14 Perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • Step 15 Perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after gray-scale compression;
  • the gray level of the feature image before compression is 256, that is, the range of gray value is 0 to 255
  • the feature image is subjected to gray level compression processing, and the gray level of the compressed image is less than 256, for example, it is 16, that is, the image's gray level is less than 256.
  • the range of gray value is 0-15.
  • the gray level in the present disclosure can be in other ranges, which are not limited here.
  • Step 16 Obtain the gender characteristics of the target face according to the grayscale histogram
  • Step 17 Input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
  • the feature image is subjected to gray-scale compression processing to reduce the dimensionality of the features in the feature image, thereby reducing the influence of the age, expression, and illumination of the target face on gender recognition, improving the recognition accuracy, and making
  • the face gender recognition method is not only suitable for laboratory scenes, but can also be used in natural environments and other scenes.
  • the recognition speed can also be effectively improved, and it is suitable for devices that require high recognition speed such as embedded devices without GPU (graphics processing unit).
  • step 12 optionally, after extracting facial feature points on the target face in step 12, before obtaining a face region of interest image based on the facial feature points in step 13 , It also includes: preprocessing the image to be recognized.
  • the preprocessing may include: filtering the image to be recognized.
  • Image filtering is to suppress image noise while preserving the details of the image as much as possible. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis.
  • a Gaussian filter may be used to filter the image to be recognized to remove image noise.
  • the preprocessing may include: performing geometric correction on the target face according to the facial feature points to obtain a corrected image, and in the corrected image, the target face The line between the two eyes is a horizontal line.
  • the affine transformation matrix may be determined according to the feature points of the face, and the geometric correction of the target face may be performed according to the affine transformation matrix.
  • the target face detected from the image to be recognized may have a tilt problem. Therefore, the target face needs to be geometrically corrected so that the line between the two eyes in the corrected target face is a horizontal line, which can be used for subsequent
  • the feature extraction process plays an optimization role.
  • the coordinates of the feature points of the face in the corrected image it is also necessary to obtain the coordinates of the feature points of the face in the corrected image to determine the region of interest of the face.
  • the highest point, lowest point, leftmost point, and rightmost point in the coordinates of the feature points of the face can be obtained, and the circumscribed matrix of the face can be determined, and a screenshot of the circumscribed matrix area can be taken to obtain the area of interest of the face image.
  • performing feature extraction on the facial region of interest image in step 14 above to obtain a feature image also includes: scaling the facial region of interest image to a specified size. . That is, down-sampling the image of the area of interest of the face to make the image of the area of interest of the face have a fixed size, thereby reducing the impact of factors such as image resolution and the distance between the camera and the face on the face gender recognition, and improving the recognition method Robustness.
  • performing feature extraction on the image of the region of interest of the face in step 14 to obtain a feature image includes: using a CoLBP (Co-occurrence Local Binary Pattern) feature extraction algorithm to perform Feature extraction is performed on the image of the region of interest of the face to obtain multiple feature images. For example, 8 feature images are obtained.
  • the number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
  • the obtaining the gender characteristics of the target face according to the gray-level histogram in step 16 includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender characteristics of the target face .
  • the CoLBP feature extraction algorithm Compared with the existing CNN (Convolutional Neural Network) feature extraction algorithm, the CoLBP feature extraction algorithm has greatly reduced computational complexity, which can effectively improve the recognition speed. It is suitable for the recognition speed requirements of embedded devices without GPU. Higher equipment.
  • the CoLBP feature extraction algorithm can be specifically as follows: first use multiple directional filters to extract the edge response feature images of the face region of interest image in multiple directions; and then obtain the LBP( Local binary mode) feature to obtain multiple feature images.
  • eight directional filters are used to extract the edge response feature images of the image of the region of interest in the face in multiple directions; then, the edge response feature images in the eight directions are respectively calculated for LBP features to obtain multiple feature images.
  • the eight directions may respectively include two directions on the horizontal center line of the image, two directions on the vertical center line, and four directions on the diagonal line.
  • the use of 8 directional filters can provide more refined image edge response characteristics.
  • the present disclosure does not exclude the use of 4 directional filters or more than 8 directional filters.
  • Performing gray-scale compression processing on the feature image in step 15 above and obtaining a gray-scale histogram of the image after gray-scale compression includes:
  • Step 151 Divide the characteristic image into n ⁇ m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2; for example, n is 7, the value of m N can be the same or different.
  • Step 152 For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image level;
  • the gray level of the characteristic image is, for example, 256, and the first value is, for example, 16.
  • Step 153 Obtain a grayscale histogram of the image after grayscale compression
  • the grayscale histogram is a normalized histogram.
  • Step 154 Connect the gray histograms of the n ⁇ m image blocks to obtain the gray histogram of the characteristic image.
  • the grayscale histograms of each image block of a feature image can be connected in the order from left to right and top to bottom to obtain the grayscale histogram of the feature image.
  • the gray histograms of the eight feature images are connected to obtain the gender feature of the target face.
  • FIG. 3 is a schematic flowchart of a method for training a face gender classifier according to some embodiments of the present disclosure. The method includes:
  • Step 21 Obtain multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
  • the number of images with male faces and images with female faces may be the same or approximately the same.
  • the images with male faces and the images with female faces include images of people of different age groups, so that the obtained face gender classifier can identify people of different age groups.
  • Step 22 Perform face detection on the face image sample, and determine the position of the target face in the face image sample
  • Face detection is to search for a face from an image and determine the position and size of the face.
  • the Dlib library can be used for face detection.
  • Step 23 Perform face feature point extraction on the target face
  • the Dlib library can be used to extract 68 facial feature points.
  • the number of facial feature points extracted in the present disclosure can be other numbers, which is not limited here.
  • Step 24 Obtain an image of the region of interest of the face according to the feature points of the face;
  • Step 25 Perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • Step 26 Perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
  • the gray level of the feature image before compression is 256, that is, the range of gray value is 0 to 255
  • the feature image is subjected to gray level compression processing, and the gray level of the compressed image is less than 256, for example, it is 16, that is, the image's gray level is less than 256.
  • the range of gray value is 0-15.
  • the gray level in the present disclosure can be in other ranges, which are not limited here.
  • Step 27 Obtain the gender characteristics of the target face according to the grayscale histogram
  • Step 28 Use the gender features of the target face in all the face image samples to train the face gender classifier to obtain a trained face gender classifier.
  • the feature image is subjected to gray-scale compression processing to reduce the dimensionality of the features in the feature image, thereby reducing the influence of factors such as age, expression, and lighting of the target face on gender recognition, improving the recognition accuracy, so that
  • the face gender classifier is not only suitable for laboratory scenes, but can also be used in natural environments and other scenes.
  • step 24 optionally, after the face feature points are extracted on the target face in step 23, before the face region of interest image is obtained according to the face feature points in step 24, , It also includes: preprocessing the face image sample.
  • the preprocessing may include: filtering the face image samples.
  • Image filtering is to suppress image noise while preserving the details of the image as much as possible. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis.
  • a Gaussian filter may be used to filter the face image samples to remove image noise.
  • the preprocessing may include: performing geometric correction on the target face according to the facial feature points to obtain a corrected image, and in the corrected image, the target face The line between the two eyes is a horizontal line.
  • the affine transformation matrix may be determined according to the feature points of the face, and the geometric correction of the target face may be performed according to the affine transformation matrix.
  • the target face detected from the face image sample may have the problem of tilt. Therefore, the target face needs to be geometrically corrected so that the line between the two eyes in the corrected target face is a horizontal line, which can be corrected.
  • the subsequent feature extraction process plays an optimization role.
  • the coordinates of the feature points of the face in the corrected image it is also necessary to obtain the coordinates of the feature points of the face in the corrected image to determine the region of interest of the face.
  • the highest point, lowest point, leftmost point, and rightmost point in the coordinates of the feature points of the face can be obtained, and the circumscribed matrix of the face can be determined, and a screenshot of the circumscribed matrix area can be taken to obtain the area of interest of the face image.
  • performing feature extraction on the facial region of interest image in step 25 above to obtain a feature image also includes: scaling the facial region of interest image to a specified size. . That is, the image of the region of interest of the face is down-sampled to make the image of the region of interest of the face a fixed size, thereby reducing the impact of factors such as image resolution and the distance between the camera and the face on the face gender recognition, and improving the face Robustness of gender classifiers.
  • performing feature extraction on the face region of interest image in step 25 to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the face region of interest image Perform feature extraction to obtain multiple feature images. For example, 8 feature images are obtained. The number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
  • obtaining the gender characteristics of the target face according to the grayscale histogram includes: connecting the grayscale histograms of the multiple feature images to obtain the gender characteristics of the target face .
  • the CoLBP feature extraction algorithm Compared with the existing CNN feature extraction algorithm, the CoLBP feature extraction algorithm has a greatly reduced computational complexity, which can effectively improve the recognition speed. It is suitable for devices that require high recognition speed such as embedded devices without GPU.
  • the CoLBP feature extraction algorithm can be specifically as follows: first use multiple directional filters to extract the edge response feature images of the face region of interest image in multiple directions; and then obtain the LBP features of the edge response feature images in the multiple directions. , Get multiple feature images.
  • performing gray-scale compression processing on the feature image in step 26 and obtaining a gray-scale histogram of the image after gray-scale compression includes:
  • Step 261 Divide the characteristic image into n ⁇ m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2; for example, n is 7, the value of m It can be the same as n or different.
  • Step 262 For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image level;
  • the gray level of the characteristic image is, for example, 256, and the first value is, for example, 16.
  • Step 263 Obtain a grayscale histogram of the image after grayscale compression
  • the grayscale histogram is a normalized histogram.
  • Step 264 Connect the gray histograms of the n ⁇ m image blocks to obtain the gray histogram of the characteristic image.
  • the grayscale histograms of each image block of a feature image can be connected in the order from left to right and top to bottom to obtain the grayscale histogram of the feature image.
  • the gray histograms of the eight feature images are connected to obtain the gender feature of the target face.
  • SVM Small Vector Machine
  • the kernel function of the SVM adopts a linear kernel function.
  • FIG. 5 is a schematic structural diagram of the face gender recognition device of the present disclosure.
  • the face gender recognition device 30 includes:
  • the face detector 31 is configured to perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
  • the face feature point extractor 32 is configured to perform face feature point extraction on the target face
  • the face interest area obtainer 33 is configured to obtain an image of the face interest area according to the face feature points;
  • the image feature extractor 34 is configured to perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • the gray level compression processor 35 is configured to perform gray level compression processing on the characteristic image, and obtain a gray level histogram of the image after the gray level compression;
  • the gender feature obtainer 36 is configured to obtain the gender feature of the target face according to the gray histogram
  • the gender recognizer 37 is configured to input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
  • the face gender recognition device of the present disclosure further includes:
  • the corrector is used to perform geometric correction on the target face according to the face feature points to obtain a corrected image.
  • the connection between the two eyes of the target face The line is a horizontal line.
  • the face gender recognition device of the present disclosure further includes:
  • the scaler is used to scale the image of the region of interest of the face to a specified size.
  • the image feature extractor 34 is configured to use the CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images; for example, to obtain 8 feature images.
  • the number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
  • the gender feature obtainer 36 is used to connect the gray histograms of the multiple feature images to obtain the gender feature of the target face.
  • the gray scale compression processor 35 includes:
  • the dividing unit 351 is configured to divide the characteristic image into n ⁇ m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
  • the compression unit 352 is configured to compress the gray scale of the image block to a first value for at least one of the image blocks to obtain a gray scale compressed image, where the first value is smaller than the characteristic image The gray level;
  • the obtaining unit 353 is configured to obtain the grayscale histogram of the grayscale compressed image
  • the connecting unit 354 is configured to connect the grayscale histograms of the n ⁇ m image blocks to obtain the grayscale histogram of the characteristic image.
  • Each device in the face gender recognition device in the foregoing embodiment and the unit modules included in each device can be implemented by hardware, for example, by a hardware circuit.
  • FIG. 7 is a schematic structural diagram of a training device for a face gender classifier of the present disclosure.
  • the training device 40 for a face gender classifier includes:
  • the face image sample acquirer 41 is configured to acquire multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
  • the face detector 42 is configured to perform face detection on the face image sample, and determine the position of the target face in the face image sample;
  • the face feature point extractor 43 is configured to perform face feature point extraction on the target face
  • the face region of interest obtainer 44 is configured to obtain an image of the face region of interest according to the facial feature points;
  • the image feature extractor 45 is configured to perform feature extraction on the image of the region of interest of the face to obtain a feature image
  • the gray level compression processor 46 is configured to perform gray level compression processing on the characteristic image, and obtain a gray level histogram of the image after the gray level compression;
  • the gender feature obtainer 47 is configured to obtain the gender feature of the target face according to the grayscale histogram
  • the trainer 48 is configured to train the face gender classifier by using the gender characteristics of the target face in all the face image samples to obtain the trained face gender classifier.
  • the training device for the face gender classifier of the present disclosure further includes:
  • the corrector is used to perform geometric correction on the target face according to the face feature points to obtain a corrected image.
  • the connection between the two eyes of the target face The line is a horizontal line.
  • the training device for the face gender classifier of the present disclosure further includes:
  • the scaler is used to scale the image of the region of interest of the face to a specified size.
  • the image feature extractor 43 is configured to use the CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images; for example, to obtain 8 feature images.
  • the number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
  • the gender feature obtainer 45 is used to connect the gray histograms of the multiple feature images to obtain the gender feature of the target face.
  • the gray-scale compression processor 44 includes:
  • the dividing unit 441 is configured to divide the characteristic image into n ⁇ m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
  • the compression unit 442 is configured to compress the gray scale of the image block to a first value for at least one of the image blocks to obtain a gray scale compressed image, where the first value is smaller than the characteristic image The gray level;
  • the obtaining unit 443 is configured to obtain the grayscale histogram of the grayscale compressed image
  • the connecting unit 444 is configured to connect the gray histograms of the n ⁇ m image blocks to obtain the gray histogram of the characteristic image.
  • the various components of the training device for the face gender classifier in the foregoing embodiment and the unit modules included in each component can be implemented in a hardware manner, for example, through a hardware circuit.
  • FIG. 9 is another structural diagram of the facial gender recognition device of the present disclosure.
  • the facial gender recognition device 50 includes a processor 51, a memory 52, and is stored in the memory 112 and can be stored in the processor.
  • the computer program running on 51 implements the following steps when the computer program is executed by the processor 51:
  • the gender feature of the target face is input into the trained face gender classifier to obtain the gender recognition result of the target face.
  • the method further includes:
  • the facial feature points geometrically correct the target face to obtain a corrected image.
  • the line between the two eyes of the target face is a horizontal line.
  • the feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
  • the image of the region of interest of the face is scaled to a specified size.
  • the performing feature extraction on the image of the region of interest of the face to obtain a feature image includes: using a symbiotic local binary pattern feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images;
  • the obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
  • n is a positive integer greater than or equal to 2
  • m is a positive integer greater than or equal to 2
  • FIG. 10 is another structural diagram of the training device for the face gender classifier of the present disclosure.
  • the face gender recognition device 60 includes a processor 61, a memory 62, and is stored on the memory 112 and can be
  • the computer program running on the processor 61 implements the following steps when the computer program is executed by the processor 61:
  • multiple face image samples where the multiple face image samples include multiple images with male faces and multiple images with female faces;
  • the face gender classifier is trained by using the gender features of the target face in all the face image samples to obtain a trained face gender classifier.
  • the method further includes:
  • the facial feature points geometrically correct the target face to obtain a corrected image.
  • the line between the two eyes of the target face is a horizontal line.
  • the feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
  • the image of the region of interest of the face is scaled to a specified size.
  • the performing feature extraction on the image of the region of interest of the human face to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the human face to obtain multiple feature images;
  • the obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
  • n is a positive integer greater than or equal to 2
  • m is a positive integer greater than or equal to 2
  • the present disclosure also provides a computer-readable storage medium on which a computer program is stored.
  • a computer program is stored.
  • the computer program is executed by a processor, each process of the above-mentioned face gender recognition method embodiment is realized, and can achieve The same technical effect, in order to avoid repetition, will not be repeated here.
  • the present disclosure also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned method for training a face gender classifier is realized, And can achieve the same technical effect, in order to avoid repetition, I will not repeat them here.
  • the computer-readable storage medium such as read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk, or optical disk, etc.
  • the technical solution of the present disclosure essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to make a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present disclosure.
  • a terminal which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

A face gender recognition method, and a face gender classifier training method and device, wherein the face gender recognition method comprises: performing face detection on an image to be recognized, and acquiring a target face in the image to be recognized (11); performing face feature point extraction on the target face (12); obtaining a face region of interest image according to the face feature point (13); performing feature extraction on the face region of interest image to obtain a feature image (14); performing grayscale compression processing on the feature image, and obtaining a grayscale histogram of the grayscale compressed image (15); obtaining a gender feature of the target face according to the grayscale histogram (16); and inputting the gender feature of the target human face into the trained face gender classifier to obtain a gender recognition result of the target face (17).

Description

人脸性别识别方法、人脸性别分类器的训练方法及装置Face gender recognition method, training method and device of face gender classifier 技术领域Technical field
本公开涉及图像处理技术领域,尤其涉及一种人脸性别识别方法、人脸性别分类器的训练方法及装置。The present disclosure relates to the field of image processing technology, and in particular to a method for facial gender recognition, a method and device for training a facial gender classifier.
背景技术Background technique
人脸是人类很重要的生物特征。基于人脸的识别功能逐渐成为近几年研究的重点。人脸性别识别在模式识别、人工智能、计算机视觉、信息安全等方面都有着广泛的发展前景和应用价值。Human face is a very important biological feature of human beings. Face-based recognition function has gradually become the focus of research in recent years. Face gender recognition has broad development prospects and application value in pattern recognition, artificial intelligence, computer vision, information security, etc.
因为男女的脸部特征的差别极其细微,加上人的表情、年龄以及光照等因素的影响,使得通过人脸识别性别更为困难,难以达到理想的准确率。Because the difference between the facial features of men and women is extremely subtle, coupled with the influence of factors such as human expression, age, and light, it is more difficult to identify gender by face, and it is difficult to achieve the desired accuracy.
发明内容Summary of the invention
本公开提供一种人脸性别识别方法、人脸性别分类器的训练方法及装置。The present disclosure provides a face gender recognition method, a face gender classifier training method and device.
第一方面,本公开提供了一种人脸性别识别方法,包括:In the first aspect, the present disclosure provides a face gender recognition method, including:
对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;Performing face detection on the image to be recognized, and acquiring the target face in the image to be recognized;
对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender feature of the target face is input into the trained face gender classifier to obtain the gender recognition result of the target face.
可选的,所述对所述目标人脸进行人脸特征点提取之后,根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:Optionally, after extracting the facial feature points of the target face, before obtaining the image of the region of interest of the face according to the facial feature points, the method further includes:
根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。According to the facial feature points, geometrically correct the target face to obtain a corrected image. In the corrected image, the line between the two eyes of the target face is a horizontal line.
可选的,所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:Optionally, the performing feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
将所述人脸感兴趣区域图像缩放为指定尺寸。The image of the region of interest of the face is scaled to a specified size.
可选的,所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用共生局部二值模式特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;Optionally, the performing feature extraction on the facial region of interest image to obtain a feature image includes: using a symbiotic local binary pattern feature extraction algorithm to perform feature extraction on the facial region of interest image to obtain multiple Feature images;
所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,所述对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:Optionally, the performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the gray-scale compressed image includes:
将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image;
获取灰度级压缩后的图像的灰度直方图;Obtain a grayscale histogram of the image after grayscale compression;
连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
第二方面,本公开提供了一种人脸性别分类器的训练方法,包括:In the second aspect, the present disclosure provides a method for training a face gender classifier, including:
获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;Acquiring multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;Performing face detection on the face image sample, and determining the position of the target face in the face image sample;
对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。The face gender classifier is trained by using the gender features of the target face in all the face image samples to obtain a trained face gender classifier.
可选的,所述对所述目标人脸进行人脸特征点提取之后,根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:Optionally, after extracting the facial feature points of the target face, before obtaining the image of the region of interest of the face according to the facial feature points, the method further includes:
根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。According to the facial feature points, geometrically correct the target face to obtain a corrected image. In the corrected image, the line between the two eyes of the target face is a horizontal line.
可选的,所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:Optionally, the performing feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
将所述人脸感兴趣区域图像缩放为指定尺寸。The image of the region of interest of the face is scaled to a specified size.
可选的,所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用CoLBP特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;Optionally, the performing feature extraction on the face region of interest image to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the face region of interest image to obtain multiple feature images;
所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,所述对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:Optionally, the performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the gray-scale compressed image includes:
将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image;
获取灰度级压缩后的图像的灰度直方图;Obtain a grayscale histogram of the image after grayscale compression;
连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
第三方面,本公开提供了一种人脸性别识别装置,包括:In a third aspect, the present disclosure provides a face gender recognition device, including:
人脸检测器,用于对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;A face detector, configured to perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
人脸特征点提取器,用于对所述目标人脸进行人脸特征点提取;A face feature point extractor for extracting face feature points on the target face;
人脸感兴趣区域获得器,用于根据所述人脸特征点,获得人脸感兴趣区域图像;A face region of interest obtainer, configured to obtain an image of a face region of interest according to the facial feature points;
图像特征提取器,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;An image feature extractor, which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
灰度级压缩处理器,用于对所述特征图像进行灰度级压缩处理,并获取 灰度级压缩后的图像的灰度直方图;A gray-scale compression processor, configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
性别特征获得器,用于根据所述灰度直方图得到所述目标人脸的性别特征;A gender feature obtainer, configured to obtain the gender feature of the target face according to the grayscale histogram;
性别识别器,用于将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender recognizer is used to input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
第四方面,本公开提供了一种人脸性别分类器的训练装置,包括:In a fourth aspect, the present disclosure provides a training device for a face gender classifier, including:
人脸图像样本获取器,用于获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;A face image sample acquirer, configured to acquire multiple face image samples, the multiple face image samples including multiple images with male faces and multiple images with female faces;
人脸特征点提取器,用于对所述目标人脸进行人脸特征点提取;A face feature point extractor for extracting face feature points on the target face;
人脸感兴趣区域获得器,用于根据所述人脸特征点,获得人脸感兴趣区域图像;A face region of interest obtainer, configured to obtain an image of a face region of interest according to the facial feature points;
图像特征提取器,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;An image feature extractor, which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
灰度级压缩处理器,用于对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;A gray-scale compression processor, configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
性别特征获得器,用于根据所述灰度直方图得到所述目标人脸的性别特征;A gender feature obtainer, configured to obtain the gender feature of the target face according to the grayscale histogram;
训练器,用于采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。The trainer is used to train the face gender classifier by using the gender characteristics of the target face in all the face image samples to obtain the trained face gender classifier.
第五方面,本公开提供了一种人脸性别识别装置,包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现上述人脸性别识别方法的步骤。In a fifth aspect, the present disclosure provides a face gender recognition device, including a processor, a memory, and a computer program stored on the memory and running on the processor, and the computer program is executed by the processor. The steps of the above face gender recognition method are realized during execution.
第六方面,本公开提供了一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述人脸性别识别方法的步骤;或者,所述计算机程序被处理器执行时实现上述人脸性别分类器的训练方法的步骤。In a sixth aspect, the present disclosure provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned face gender recognition method are realized; or, When the computer program is executed by the processor, the steps of the training method of the face gender classifier are realized.
附图说明Description of the drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本 领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本公开的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only used for the purpose of illustrating the preferred embodiments, and are not considered as a limitation to the present disclosure. Also, throughout the drawings, the same reference symbols are used to denote the same components. In the attached picture:
图1为本公开一些实施例提供的人脸性别识别方法的流程示意图;FIG. 1 is a schematic flowchart of a face gender recognition method provided by some embodiments of the present disclosure;
图2为本公开一些实施例提供的获取灰度级压缩后的图像的灰度直方图的流程示意图;FIG. 2 is a schematic flowchart of obtaining a grayscale histogram of an image after grayscale compression according to some embodiments of the present disclosure;
图3为本公开一些实施例提供的人脸性别分类器的训练方法的流程示意图;3 is a schematic flowchart of a method for training a face gender classifier provided by some embodiments of the present disclosure;
图4为本公开另外一些实施例提供的获取灰度级压缩后的图像的灰度直方图的流程示意图;FIG. 4 is a schematic flowchart of obtaining a grayscale histogram of an image after grayscale compression according to some other embodiments of the present disclosure;
图5为本公开一些实施例提供的人脸性别识别装置的一结构示意图;FIG. 5 is a schematic structural diagram of a face gender recognition device provided by some embodiments of the present disclosure;
图6为本公开一些实施例提供的灰度级压缩处理器的一结构示意图;FIG. 6 is a schematic structural diagram of a grayscale compression processor provided by some embodiments of the present disclosure;
图7为本公开一些实施例提供的人脸性别分类器的训练装置的一结构示意图;FIG. 7 is a schematic structural diagram of a training device for a face gender classifier provided by some embodiments of the present disclosure;
图8为本公开另外一些实施例提供的灰度级压缩处理器的一结构示意图;FIG. 8 is a schematic structural diagram of a gray scale compression processor provided by some other embodiments of the present disclosure;
图9为本公开一些实施例提供的人脸性别识别装置的另一结构示意图;FIG. 9 is another schematic structural diagram of a face gender recognition device provided by some embodiments of the present disclosure;
图10为本公开一些实施例提供的人脸性别分类器的训练装置的另一结构示意图。FIG. 10 is a schematic diagram of another structure of a training device for a face gender classifier provided by some embodiments of the present disclosure.
具体实施方式detailed description
下面将结合本公开中的附图,对本公开中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The technical solutions in the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings in the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present disclosure.
请参考图1,图1为本公开一些实施例提供的人脸性别识别方法的流程示意图,该方法包括:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a face gender recognition method provided by some embodiments of the present disclosure. The method includes:
步骤11:对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;Step 11: Perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
人脸检测是从图像中搜索人脸并确定人脸的位置和大小。Face detection is to search for a face from an image and determine the position and size of the face.
在一些实施例中,可以采用Dlib库进行人脸检测。Dlib是一种工具箱,其中包含用于创建复杂软件以解决实际问题的机器学习算法和工具。Dlib库包括用于图像中的对象检测的工具,包括正面人脸检测和对象姿势估计等。当然,本公开也可以采用其他算法进行人脸检测。In some embodiments, the Dlib library can be used for face detection. Dlib is a toolbox that contains machine learning algorithms and tools for creating complex software to solve real-world problems. The Dlib library includes tools for object detection in images, including frontal face detection and object pose estimation. Of course, the present disclosure can also use other algorithms for face detection.
步骤12:对所述目标人脸进行人脸特征点提取;Step 12: Perform face feature point extraction on the target face;
在一些实施例中,可以采用Dlib库提取68个人脸特征点。当然,如果本公开采用其他算法进行人脸检测,本公开中提取的人脸特征点数目可以为其他数目,在此不做限定。In some embodiments, the Dlib library can be used to extract 68 facial feature points. Of course, if the present disclosure adopts other algorithms for face detection, the number of facial feature points extracted in the present disclosure may be other numbers, which is not limited here.
步骤13:根据所述人脸特征点,获得人脸感兴趣区域(ROI)图像;Step 13: Obtain a region of interest (ROI) image of the face according to the feature points of the face;
步骤14:对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Step 14: Perform feature extraction on the image of the region of interest of the face to obtain a feature image;
步骤15:对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Step 15: Perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after gray-scale compression;
假设特征图像压缩前的灰度级为256,即灰度值的范围0~255,将特征图像进行灰度级压缩处理,压缩后的图像的灰度级小于256,例如为16,即图像的灰度值的范围0~15。本公开中灰度级可以为其他范围,在此不做限定。Assuming that the gray level of the feature image before compression is 256, that is, the range of gray value is 0 to 255, the feature image is subjected to gray level compression processing, and the gray level of the compressed image is less than 256, for example, it is 16, that is, the image's gray level is less than 256. The range of gray value is 0-15. The gray level in the present disclosure can be in other ranges, which are not limited here.
步骤16:根据所述灰度直方图得到所述目标人脸的性别特征;Step 16: Obtain the gender characteristics of the target face according to the grayscale histogram;
步骤17:将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。Step 17: Input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
在本公开中,对特征图像进行灰度级压缩处理,使得特征图像中的特征降维,从而可以减少目标人脸的年龄、表情以及光照等因素对性别识别的影响,提高识别准确率,使得人脸性别识别方法不仅仅适用于实验室场景,可以在自然环境等场景下使用。同时,由于特征图像中的特征降维,也可以有效提高识别的速度,适用于无GPU(图形处理器)的嵌入式设备等对识别速度要求较高的设备。In the present disclosure, the feature image is subjected to gray-scale compression processing to reduce the dimensionality of the features in the feature image, thereby reducing the influence of the age, expression, and illumination of the target face on gender recognition, improving the recognition accuracy, and making The face gender recognition method is not only suitable for laboratory scenes, but can also be used in natural environments and other scenes. At the same time, due to the feature image dimensionality reduction, the recognition speed can also be effectively improved, and it is suitable for devices that require high recognition speed such as embedded devices without GPU (graphics processing unit).
在一些实施例中,可选的,上述步骤12中的对所述目标人脸进行人脸特征点提取之后,上述步骤13中的根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:对所述待识别图像进行预处理。In some embodiments, optionally, after extracting facial feature points on the target face in step 12, before obtaining a face region of interest image based on the facial feature points in step 13 , It also includes: preprocessing the image to be recognized.
在一些实施例中,所述预处理可以包括:对待识别图像进行滤波处理。 图像滤波,即在尽量保留图像细节特征的条件下对图像的噪声进行抑制,其处理效果的好坏将直接影响到后续图像处理和分析的有效性和可靠性。在一些实施例中,可以采用高斯滤波器对待识别图像进行滤波处理,去除图像噪声。In some embodiments, the preprocessing may include: filtering the image to be recognized. Image filtering is to suppress image noise while preserving the details of the image as much as possible. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. In some embodiments, a Gaussian filter may be used to filter the image to be recognized to remove image noise.
在一些实施例中,所述预处理可以包括:根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。In some embodiments, the preprocessing may include: performing geometric correction on the target face according to the facial feature points to obtain a corrected image, and in the corrected image, the target face The line between the two eyes is a horizontal line.
可选的,可以根据人脸特征点,确定仿射变换矩阵,根据仿射变换矩阵,进行目标人脸的几何校正。Optionally, the affine transformation matrix may be determined according to the feature points of the face, and the geometric correction of the target face may be performed according to the affine transformation matrix.
从待识别图像中检测出的目标人脸可能会存在倾斜的问题,因而需要将目标人脸进行几何校正,使得校正后的目标人脸中两个眼睛之间的连线为水平线,可以对后续的特征提取过程起到优化的作用。The target face detected from the image to be recognized may have a tilt problem. Therefore, the target face needs to be geometrically corrected so that the line between the two eyes in the corrected target face is a horizontal line, which can be used for subsequent The feature extraction process plays an optimization role.
在进行几何校正后,还需要获取校正后的图像中人脸特征点的坐标,以用于确定人脸感兴趣区域。可选的,可以获取人脸特征点坐标中的最高点、最低点、最左侧点和最右侧点,确定人脸的外接矩阵,并对外接矩阵区域进行截图,得到人脸感兴趣区域图像。After performing geometric correction, it is also necessary to obtain the coordinates of the feature points of the face in the corrected image to determine the region of interest of the face. Optionally, the highest point, lowest point, leftmost point, and rightmost point in the coordinates of the feature points of the face can be obtained, and the circumscribed matrix of the face can be determined, and a screenshot of the circumscribed matrix area can be taken to obtain the area of interest of the face image.
在一些实施例中,可选的,上述步骤14中所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:将所述人脸感兴趣区域图像缩放为指定尺寸。即对人脸感兴趣区域图像进行降采样,使得人脸感兴趣区域图像为固定大小,从而减少图像分辨率、相机与人脸的距离不固定等因素对人脸性别识别的影响,提高识别方法的鲁棒性。In some embodiments, optionally, performing feature extraction on the facial region of interest image in step 14 above to obtain a feature image also includes: scaling the facial region of interest image to a specified size. . That is, down-sampling the image of the area of interest of the face to make the image of the area of interest of the face have a fixed size, thereby reducing the impact of factors such as image resolution and the distance between the camera and the face on the face gender recognition, and improving the recognition method Robustness.
在一些实施例中,可选的,上述步骤14中所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用CoLBP(共生局部二值模式)特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像。例如,得到8个特征图像。本公开中获得的特征图像数目可以为其他数目,在此不做限定。In some embodiments, optionally, performing feature extraction on the image of the region of interest of the face in step 14 to obtain a feature image includes: using a CoLBP (Co-occurrence Local Binary Pattern) feature extraction algorithm to perform Feature extraction is performed on the image of the region of interest of the face to obtain multiple feature images. For example, 8 feature images are obtained. The number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
此时,上述步骤16中的所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。At this time, the obtaining the gender characteristics of the target face according to the gray-level histogram in step 16 includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender characteristics of the target face .
CoLBP特征提取算法与现有的CNN(卷积神经网络)特征提取算法相比,计算复杂度极大的降低,因而可以有效提高识别的速度,适用于无GPU的嵌入式设备等对识别速度要求较高的设备。Compared with the existing CNN (Convolutional Neural Network) feature extraction algorithm, the CoLBP feature extraction algorithm has greatly reduced computational complexity, which can effectively improve the recognition speed. It is suitable for the recognition speed requirements of embedded devices without GPU. Higher equipment.
CoLBP特征提取算法具体可以为:首先使用多个方向滤波器提取人脸感兴趣区域图像在多个方向上的边缘响应特征图像;然后分别对该多个方向上的边缘响应特征图像求取LBP(局部二值模式)特征,得到多个特征图像。例如使用8个方向滤波器提取人脸感兴趣区域图像在多个方向上的边缘响应特征图像;然后分别对该8个方向上的边缘响应特征图像求取LBP特征,得到多个特征图像。8个方向可以分别包括图像的水平中线上的两个方向,竖直中线上的两个方向,以及对角线上的四个方向。采用8个方向滤波器能够提供更加精细的图像边缘响应特征,当然,本公开也不排除采用4个方向滤波器,或者多于8个的方向滤波器。The CoLBP feature extraction algorithm can be specifically as follows: first use multiple directional filters to extract the edge response feature images of the face region of interest image in multiple directions; and then obtain the LBP( Local binary mode) feature to obtain multiple feature images. For example, eight directional filters are used to extract the edge response feature images of the image of the region of interest in the face in multiple directions; then, the edge response feature images in the eight directions are respectively calculated for LBP features to obtain multiple feature images. The eight directions may respectively include two directions on the horizontal center line of the image, two directions on the vertical center line, and four directions on the diagonal line. The use of 8 directional filters can provide more refined image edge response characteristics. Of course, the present disclosure does not exclude the use of 4 directional filters or more than 8 directional filters.
在一些实施例中,可选的,请参考图2,上述步骤15中的对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:In some embodiments, optionally, please refer to FIG. 2. Performing gray-scale compression processing on the feature image in step 15 above and obtaining a gray-scale histogram of the image after gray-scale compression includes:
步骤151:将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;例如,n为7,m的值可以为n相同,也可以不同。Step 151: Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2; for example, n is 7, the value of m N can be the same or different.
步骤152:针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;Step 152: For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image level;
所述特征图像的灰度级例如为256,第一数值例如为16。The gray level of the characteristic image is, for example, 256, and the first value is, for example, 16.
步骤153:获取灰度级压缩后的图像的灰度直方图;Step 153: Obtain a grayscale histogram of the image after grayscale compression;
可选的,所述灰度直方图为归一化直方图。Optionally, the grayscale histogram is a normalized histogram.
步骤154:连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Step 154: Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
可选的,可以按照从左到右,从上到下的顺序将一个特征图像的各个图像分块的灰度直方图进行连接,得到该特征图像的灰度直方图。Optionally, the grayscale histograms of each image block of a feature image can be connected in the order from left to right and top to bottom to obtain the grayscale histogram of the feature image.
若特征图像的个数为多个,例如,8个,则将8个特征图像的灰度直方图进行连接,得到目标人脸的性别特征。If the number of feature images is multiple, for example, eight, then the gray histograms of the eight feature images are connected to obtain the gender feature of the target face.
请参考图3,图3为本公开一些实施例提供的人脸性别分类器的训练方法的流程示意图,该方法包括:Please refer to FIG. 3. FIG. 3 is a schematic flowchart of a method for training a face gender classifier according to some embodiments of the present disclosure. The method includes:
步骤21:获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;Step 21: Obtain multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
可选的,具有男性人脸的图像和具有女性人脸的图像的张数可以相同或者大致相同。Optionally, the number of images with male faces and images with female faces may be the same or approximately the same.
可选的,具有男性人脸的图像和具有女性人脸的图像中,包括不同年龄段的人的图像,以使得得到的人脸性别分类器可以识别各个年龄段的人群。Optionally, the images with male faces and the images with female faces include images of people of different age groups, so that the obtained face gender classifier can identify people of different age groups.
步骤22:对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;Step 22: Perform face detection on the face image sample, and determine the position of the target face in the face image sample;
人脸检测是从图像中搜索人脸并确定人脸的位置和大小。Face detection is to search for a face from an image and determine the position and size of the face.
在一些实施例中,可以采用Dlib库进行人脸检测。In some embodiments, the Dlib library can be used for face detection.
步骤23:对所述目标人脸进行人脸特征点提取;Step 23: Perform face feature point extraction on the target face;
在一些实施例中,可以采用Dlib库提取68个人脸特征点。本公开中提取的人脸特征点数目可以为其他数目,在此不做限定。In some embodiments, the Dlib library can be used to extract 68 facial feature points. The number of facial feature points extracted in the present disclosure can be other numbers, which is not limited here.
步骤24:根据所述人脸特征点,获得人脸感兴趣区域图像;Step 24: Obtain an image of the region of interest of the face according to the feature points of the face;
步骤25:对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Step 25: Perform feature extraction on the image of the region of interest of the face to obtain a feature image;
步骤26:对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Step 26: Perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
假设特征图像压缩前的灰度级为256,即灰度值的范围0~255,将特征图像进行灰度级压缩处理,压缩后的图像的灰度级小于256,例如为16,即图像的灰度值的范围0~15。本公开中灰度级可以为其他范围,在此不做限定。Assuming that the gray level of the feature image before compression is 256, that is, the range of gray value is 0 to 255, the feature image is subjected to gray level compression processing, and the gray level of the compressed image is less than 256, for example, it is 16, that is, the image's gray level is less than 256. The range of gray value is 0-15. The gray level in the present disclosure can be in other ranges, which are not limited here.
步骤27:根据所述灰度直方图得到所述目标人脸的性别特征;Step 27: Obtain the gender characteristics of the target face according to the grayscale histogram;
步骤28:采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。Step 28: Use the gender features of the target face in all the face image samples to train the face gender classifier to obtain a trained face gender classifier.
在本公开中,对特征图像进行灰度级压缩处理,使得特征图像中的特征降维,从而可以减少目标人脸的年龄、表情以及光照等因素对性别识别的影响,提高识别准确率,使得人脸性别分类器不仅仅适用于实验室场景,可以在自然环境等场景下使用。In the present disclosure, the feature image is subjected to gray-scale compression processing to reduce the dimensionality of the features in the feature image, thereby reducing the influence of factors such as age, expression, and lighting of the target face on gender recognition, improving the recognition accuracy, so that The face gender classifier is not only suitable for laboratory scenes, but can also be used in natural environments and other scenes.
在一些实施例中,可选的,上述步骤23中的对所述目标人脸进行人脸特征点提取之后,上述步骤24中的根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:对所述人脸图像样本进行预处理。In some embodiments, optionally, after the face feature points are extracted on the target face in step 23, before the face region of interest image is obtained according to the face feature points in step 24, , It also includes: preprocessing the face image sample.
在一些实施例中,所述预处理可以包括:对人脸图像样本进行滤波处理。图像滤波,即在尽量保留图像细节特征的条件下对图像的噪声进行抑制,其处理效果的好坏将直接影响到后续图像处理和分析的有效性和可靠性。在一些实施例中,可以采用高斯滤波器对人脸图像样本进行滤波处理,去除图像噪声。In some embodiments, the preprocessing may include: filtering the face image samples. Image filtering is to suppress image noise while preserving the details of the image as much as possible. The quality of its processing effect will directly affect the effectiveness and reliability of subsequent image processing and analysis. In some embodiments, a Gaussian filter may be used to filter the face image samples to remove image noise.
在一些实施例中,所述预处理可以包括:根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。In some embodiments, the preprocessing may include: performing geometric correction on the target face according to the facial feature points to obtain a corrected image, and in the corrected image, the target face The line between the two eyes is a horizontal line.
可选的,可以根据人脸特征点,确定仿射变换矩阵,根据仿射变换矩阵,进行目标人脸的几何校正。Optionally, the affine transformation matrix may be determined according to the feature points of the face, and the geometric correction of the target face may be performed according to the affine transformation matrix.
从人脸图像样本中检测出的目标人脸可能会存在倾斜的问题,因而需要将目标人脸进行几何校正,使得校正后的目标人脸中两个眼睛之间的连线为水平线,可以对后续的特征提取过程起到优化的作用。The target face detected from the face image sample may have the problem of tilt. Therefore, the target face needs to be geometrically corrected so that the line between the two eyes in the corrected target face is a horizontal line, which can be corrected. The subsequent feature extraction process plays an optimization role.
在进行几何校正后,还需要获取校正后的图像中人脸特征点的坐标,以用于确定人脸感兴趣区域。可选的,可以获取人脸特征点坐标中的最高点、最低点、最左侧点和最右侧点,确定人脸的外接矩阵,并对外接矩阵区域进行截图,得到人脸感兴趣区域图像。After performing geometric correction, it is also necessary to obtain the coordinates of the feature points of the face in the corrected image to determine the region of interest of the face. Optionally, the highest point, lowest point, leftmost point, and rightmost point in the coordinates of the feature points of the face can be obtained, and the circumscribed matrix of the face can be determined, and a screenshot of the circumscribed matrix area can be taken to obtain the area of interest of the face image.
在一些实施例中,可选的,上述步骤25中所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:将所述人脸感兴趣区域图像缩放为指定尺寸。即对人脸感兴趣区域图像进行降采样,使得人脸感兴趣区域图像为固定大小,从而减少图像分辨率、相机与人脸的距离不固定等因素对人脸性别识别的影响,提高人脸性别分类器的鲁棒性。In some embodiments, optionally, performing feature extraction on the facial region of interest image in step 25 above to obtain a feature image also includes: scaling the facial region of interest image to a specified size. . That is, the image of the region of interest of the face is down-sampled to make the image of the region of interest of the face a fixed size, thereby reducing the impact of factors such as image resolution and the distance between the camera and the face on the face gender recognition, and improving the face Robustness of gender classifiers.
在一些实施例中,可选的,上述步骤25中所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用CoLBP特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像。例如,得到8个特征图像。本公开中获得的特征图像数目可以为其他数目,在此不做限定。In some embodiments, optionally, performing feature extraction on the face region of interest image in step 25 to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the face region of interest image Perform feature extraction to obtain multiple feature images. For example, 8 feature images are obtained. The number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
此时,上述步骤27中的所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。At this time, in the above step 27, obtaining the gender characteristics of the target face according to the grayscale histogram includes: connecting the grayscale histograms of the multiple feature images to obtain the gender characteristics of the target face .
CoLBP特征提取算法与现有的CNN特征提取算法相比,计算复杂度极大的降低,因而可以有效提高识别的速度,适用于无GPU的嵌入式设备等对识别速度要求较高的设备。Compared with the existing CNN feature extraction algorithm, the CoLBP feature extraction algorithm has a greatly reduced computational complexity, which can effectively improve the recognition speed. It is suitable for devices that require high recognition speed such as embedded devices without GPU.
CoLBP特征提取算法具体可以为:首先使用多个方向滤波器提取人脸感兴趣区域图像在多个方向上的边缘响应特征图像;然后分别对该多个方向上的边缘响应特征图像求取LBP特征,得到多个特征图像。The CoLBP feature extraction algorithm can be specifically as follows: first use multiple directional filters to extract the edge response feature images of the face region of interest image in multiple directions; and then obtain the LBP features of the edge response feature images in the multiple directions. , Get multiple feature images.
在一些实施例中,可选的,请参考图4,上述步骤26中的对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:In some embodiments, optionally, referring to FIG. 4, performing gray-scale compression processing on the feature image in step 26 and obtaining a gray-scale histogram of the image after gray-scale compression includes:
步骤261:将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;例如,n为7,m的值可以与n相同,也可以不同。Step 261: Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2; for example, n is 7, the value of m It can be the same as n or different.
步骤262:针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;Step 262: For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image level;
所述特征图像的灰度级例如为256,第一数值例如为16。The gray level of the characteristic image is, for example, 256, and the first value is, for example, 16.
步骤263:获取灰度级压缩后的图像的灰度直方图;Step 263: Obtain a grayscale histogram of the image after grayscale compression;
可选的,所述灰度直方图为归一化直方图。Optionally, the grayscale histogram is a normalized histogram.
步骤264:连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Step 264: Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
可选的,可以按照从左到右,从上到下的顺序将一个特征图像的各个图像分块的灰度直方图进行连接,得到该特征图像的灰度直方图。Optionally, the grayscale histograms of each image block of a feature image can be connected in the order from left to right and top to bottom to obtain the grayscale histogram of the feature image.
若特征图像的个数为多个,例如,8个,则将8个特征图像的灰度直方图进行连接,得到目标人脸的性别特征。If the number of feature images is multiple, for example, eight, then the gray histograms of the eight feature images are connected to obtain the gender feature of the target face.
在一些实施例中,可选的,上述步骤28中可以采用SVM(支持向量机)对所有人脸图像样本中的目标人脸的性别特征进行训练,得到已训练的人脸性别分类器。可选的,SVM的核函数采用线性核函数。In some embodiments, optionally, SVM (Support Vector Machine) may be used in step 28 to train the gender characteristics of the target face in all face image samples to obtain a trained face gender classifier. Optionally, the kernel function of the SVM adopts a linear kernel function.
请参考图5,图5为本公开的人脸性别识别装置的一结构示意图,该人脸性别识别装置30包括:Please refer to FIG. 5. FIG. 5 is a schematic structural diagram of the face gender recognition device of the present disclosure. The face gender recognition device 30 includes:
人脸检测器31,用于对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;The face detector 31 is configured to perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
人脸特征点提取器32,用于对所述目标人脸进行人脸特征点提取;The face feature point extractor 32 is configured to perform face feature point extraction on the target face;
人脸感兴趣区域获得器33,用于根据所述人脸特征点,获得人脸感兴趣区域图像;The face interest area obtainer 33 is configured to obtain an image of the face interest area according to the face feature points;
图像特征提取器34,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;The image feature extractor 34 is configured to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
灰度级压缩处理器35,用于对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;The gray level compression processor 35 is configured to perform gray level compression processing on the characteristic image, and obtain a gray level histogram of the image after the gray level compression;
性别特征获得器36,用于根据所述灰度直方图得到所述目标人脸的性别特征;The gender feature obtainer 36 is configured to obtain the gender feature of the target face according to the gray histogram;
性别识别器37,用于将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender recognizer 37 is configured to input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
可选的,本公开的人脸性别识别装置还包括:Optionally, the face gender recognition device of the present disclosure further includes:
校正器,用于根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。The corrector is used to perform geometric correction on the target face according to the face feature points to obtain a corrected image. In the corrected image, the connection between the two eyes of the target face The line is a horizontal line.
可选的,本公开的人脸性别识别装置还包括:Optionally, the face gender recognition device of the present disclosure further includes:
缩放器,用于将所述人脸感兴趣区域图像缩放为指定尺寸。The scaler is used to scale the image of the region of interest of the face to a specified size.
可选的,所述图像特征提取器34,用于采用CoLBP特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;例如,得到8个特征图像。本公开中获得的特征图像数目可以为其他数目,在此不做限定。Optionally, the image feature extractor 34 is configured to use the CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images; for example, to obtain 8 feature images. The number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
所述性别特征获得器36,用于连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The gender feature obtainer 36 is used to connect the gray histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,请参考图6,所述灰度级压缩处理器35包括:Optionally, referring to FIG. 6, the gray scale compression processor 35 includes:
划分单元351,用于将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;The dividing unit 351 is configured to divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
压缩单元352,用于针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;The compression unit 352 is configured to compress the gray scale of the image block to a first value for at least one of the image blocks to obtain a gray scale compressed image, where the first value is smaller than the characteristic image The gray level;
获取单元353,用于获取灰度级压缩后的图像的灰度直方图;The obtaining unit 353 is configured to obtain the grayscale histogram of the grayscale compressed image;
连接单元354,用于连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。The connecting unit 354 is configured to connect the grayscale histograms of the n×m image blocks to obtain the grayscale histogram of the characteristic image.
上述实施例中的人脸性别识别装置中的各个器件,以及各个器件包含的单元模块,均可以通过硬件方式实现,例如通过硬件电路实现。Each device in the face gender recognition device in the foregoing embodiment and the unit modules included in each device can be implemented by hardware, for example, by a hardware circuit.
请参考图7,图7为本公开的人脸性别分类器的训练装置的一结构示意图,该人脸性别分类器的训练装置40包括:Please refer to FIG. 7. FIG. 7 is a schematic structural diagram of a training device for a face gender classifier of the present disclosure. The training device 40 for a face gender classifier includes:
人脸图像样本获取器41,用于获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;The face image sample acquirer 41 is configured to acquire multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
人脸检测器42,用于对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;The face detector 42 is configured to perform face detection on the face image sample, and determine the position of the target face in the face image sample;
人脸特征点提取器43,用于对所述目标人脸进行人脸特征点提取;The face feature point extractor 43 is configured to perform face feature point extraction on the target face;
人脸感兴趣区域获得器44,用于根据所述人脸特征点,获得人脸感兴趣区域图像;The face region of interest obtainer 44 is configured to obtain an image of the face region of interest according to the facial feature points;
图像特征提取器45,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;The image feature extractor 45 is configured to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
灰度级压缩处理器46,用于对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;The gray level compression processor 46 is configured to perform gray level compression processing on the characteristic image, and obtain a gray level histogram of the image after the gray level compression;
性别特征获得器47,用于根据所述灰度直方图得到所述目标人脸的性别特征;The gender feature obtainer 47 is configured to obtain the gender feature of the target face according to the grayscale histogram;
训练器48,用于采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,,得到已训练的人脸性别分类器。The trainer 48 is configured to train the face gender classifier by using the gender characteristics of the target face in all the face image samples to obtain the trained face gender classifier.
可选的,本公开的人脸性别分类器的训练装置还包括:Optionally, the training device for the face gender classifier of the present disclosure further includes:
校正器,用于根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。The corrector is used to perform geometric correction on the target face according to the face feature points to obtain a corrected image. In the corrected image, the connection between the two eyes of the target face The line is a horizontal line.
可选的,本公开的人脸性别分类器的训练装置还包括:Optionally, the training device for the face gender classifier of the present disclosure further includes:
缩放器,用于将所述人脸感兴趣区域图像缩放为指定尺寸。The scaler is used to scale the image of the region of interest of the face to a specified size.
可选的,所述图像特征提取器43,用于采用CoLBP特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;例如,得到8个特征图像。本公开中获得的特征图像数目可以为其他数目,在此不做限定。Optionally, the image feature extractor 43 is configured to use the CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images; for example, to obtain 8 feature images. The number of feature images obtained in the present disclosure may be other numbers, which is not limited here.
所述性别特征获得器45,用于连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The gender feature obtainer 45 is used to connect the gray histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,请参考图8,所述灰度级压缩处理器44包括:Optionally, referring to FIG. 8, the gray-scale compression processor 44 includes:
划分单元441,用于将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;The dividing unit 441 is configured to divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
压缩单元442,用于针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;The compression unit 442 is configured to compress the gray scale of the image block to a first value for at least one of the image blocks to obtain a gray scale compressed image, where the first value is smaller than the characteristic image The gray level;
获取单元443,用于获取灰度级压缩后的图像的灰度直方图;The obtaining unit 443 is configured to obtain the grayscale histogram of the grayscale compressed image;
连接单元444,用于连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。The connecting unit 444 is configured to connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
上述实施例中的人脸性别分类器的训练装置中的各个器件,以及各个器件包含的单元模块,均可以通过硬件方式实现,例如通过硬件电路实现。The various components of the training device for the face gender classifier in the foregoing embodiment and the unit modules included in each component can be implemented in a hardware manner, for example, through a hardware circuit.
请参考图9,图9为本公开的人脸性别识别装置的另一结构示意图,该人脸性别识别装置50包括:处理器51,存储器52,以及,存储在存储器112上并可在处理器51上运行的计算机程序,计算机程序被处理器51执行时实现如下步骤:Please refer to FIG. 9, which is another structural diagram of the facial gender recognition device of the present disclosure. The facial gender recognition device 50 includes a processor 51, a memory 52, and is stored in the memory 112 and can be stored in the processor. The computer program running on 51 implements the following steps when the computer program is executed by the processor 51:
对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;Performing face detection on the image to be recognized, and acquiring the target face in the image to be recognized;
对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender feature of the target face is input into the trained face gender classifier to obtain the gender recognition result of the target face.
可选的,计算机程序被处理器51执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 51:
所述对所述目标人脸进行人脸特征点提取之后,根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:After the face feature point extraction is performed on the target face, before obtaining the face region of interest image according to the face feature points, the method further includes:
根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。According to the facial feature points, geometrically correct the target face to obtain a corrected image. In the corrected image, the line between the two eyes of the target face is a horizontal line.
可选的,计算机程序被处理器51执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 51:
所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:The feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
将所述人脸感兴趣区域图像缩放为指定尺寸。The image of the region of interest of the face is scaled to a specified size.
可选的,计算机程序被处理器51执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 51:
所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用共生局部二值模式特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;The performing feature extraction on the image of the region of interest of the face to obtain a feature image includes: using a symbiotic local binary pattern feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images;
所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,计算机程序被处理器51执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 51:
所述对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:The performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the image after the gray-scale compression includes:
将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image;
获取灰度级压缩后的图像的灰度直方图;Obtain a grayscale histogram of the image after grayscale compression;
连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
请参考图10,图10为本公开的人脸性别分类器的训练装置的另一结构示意图,该人脸性别识别装置60包括:处理器61,存储器62,以及,存储在存储器112上并可在处理器61上运行的计算机程序,计算机程序被处理器 61执行时实现如下步骤:Please refer to FIG. 10, which is another structural diagram of the training device for the face gender classifier of the present disclosure. The face gender recognition device 60 includes a processor 61, a memory 62, and is stored on the memory 112 and can be The computer program running on the processor 61 implements the following steps when the computer program is executed by the processor 61:
获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;Acquiring multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;Performing face detection on the face image sample, and determining the position of the target face in the face image sample;
对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。The face gender classifier is trained by using the gender features of the target face in all the face image samples to obtain a trained face gender classifier.
可选的,计算机程序被处理器61执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 61:
所述对所述目标人脸进行人脸特征点提取之后,根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:After the face feature point extraction is performed on the target face, before obtaining the face region of interest image according to the face feature points, the method further includes:
根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。According to the facial feature points, geometrically correct the target face to obtain a corrected image. In the corrected image, the line between the two eyes of the target face is a horizontal line.
可选的,计算机程序被处理器61执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 61:
所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:The feature extraction on the image of the region of interest of the face to obtain a feature image also includes:
将所述人脸感兴趣区域图像缩放为指定尺寸。The image of the region of interest of the face is scaled to a specified size.
可选的,计算机程序被处理器61执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 61:
所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用CoLBP特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;The performing feature extraction on the image of the region of interest of the human face to obtain a feature image includes: using a CoLBP feature extraction algorithm to perform feature extraction on the image of the region of interest of the human face to obtain multiple feature images;
所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
可选的,计算机程序被处理器61执行时还可实现如下步骤:Optionally, the following steps may also be implemented when the computer program is executed by the processor 61:
所述对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:The performing gray-scale compression processing on the characteristic image and obtaining the gray-scale histogram of the image after the gray-scale compression includes:
将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image;
获取灰度级压缩后的图像的灰度直方图;Obtain a grayscale histogram of the image after grayscale compression;
连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
本公开还提供一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述人脸性别识别方法方实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned face gender recognition method embodiment is realized, and can achieve The same technical effect, in order to avoid repetition, will not be repeated here.
本公开还提供一种计算机可读存储介质,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现上述人脸性别分类器的训练方法方实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The present disclosure also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned method for training a face gender classifier is realized, And can achieve the same technical effect, in order to avoid repetition, I will not repeat them here.
其中,所述的计算机可读存储介质,如只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the computer-readable storage medium, such as read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk, or optical disk, etc.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that in this article, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, It also includes other elements not explicitly listed, or elements inherent to the process, method, article, or device. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or device that includes the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光 盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本公开各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of the present disclosure essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to make a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of the present disclosure.
上面结合附图对本公开的实施例进行了描述,但是本公开并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本公开的启示下,在不脱离本公开宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本公开的保护之内。The embodiments of the present disclosure are described above with reference to the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific embodiments. The above-mentioned specific embodiments are only illustrative and not restrictive. Those of ordinary skill in the art are Under the enlightenment of the present disclosure, without departing from the purpose of the present disclosure and the scope of protection of the claims, many forms can be made, all of which fall within the protection of the present disclosure.

Claims (10)

  1. 一种人脸性别识别方法,包括:A face gender recognition method, including:
    对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;Performing face detection on the image to be recognized, and acquiring the target face in the image to be recognized;
    对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
    根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
    对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
    对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
    根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
    将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender feature of the target face is input into the trained face gender classifier to obtain the gender recognition result of the target face.
  2. 如权利要求1所述的方法,其中,所述对所述目标人脸进行人脸特征点提取之后,根据所述人脸特征点,获得人脸感兴趣区域图像之前,还包括:The method according to claim 1, wherein, after extracting the facial feature points of the target face, before obtaining the image of the region of interest of the face according to the facial feature points, the method further comprises:
    根据所述人脸特征点,对所述目标人脸进行几何校正,得到校正后的图像,所述校正后的图像中,所述目标人脸的两个眼睛之间的连线为水平线。According to the facial feature points, geometrically correct the target face to obtain a corrected image. In the corrected image, the line between the two eyes of the target face is a horizontal line.
  3. 如权利要求1所述的方法,其中,所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,之前还包括:The method according to claim 1, wherein said performing feature extraction on the image of the region of interest of the face to obtain a feature image further comprises:
    将所述人脸感兴趣区域图像缩放为指定尺寸。The image of the region of interest of the face is scaled to a specified size.
  4. 如权利要求1所述的方法,其中,The method of claim 1, wherein:
    所述对所述人脸感兴趣区域图像进行特征提取,得到特征图像,包括:采用共生局部二值模式特征提取算法,对所述人脸感兴趣区域图像进行特征提取,得到多个特征图像;The performing feature extraction on the image of the region of interest of the face to obtain a feature image includes: using a symbiotic local binary pattern feature extraction algorithm to perform feature extraction on the image of the region of interest of the face to obtain multiple feature images;
    所述根据所述灰度直方图得到所述目标人脸的性别特征包括:连接所述多个特征图像的灰度直方图,得到所述目标人脸的性别特征。The obtaining the gender feature of the target face according to the gray-scale histogram includes: connecting the gray-scale histograms of the multiple feature images to obtain the gender feature of the target face.
  5. 如权利要求1所述的方法,其中,所述对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图,包括:The method according to claim 1, wherein the performing gray-scale compression processing on the characteristic image and obtaining a gray-scale histogram of the image after the gray-scale compression includes:
    将所述特征图像划分为n×m个尺寸相同的图像分块,n为大于或等于2的正整数,m为大于或等于2的正整数;Divide the characteristic image into n×m image blocks of the same size, where n is a positive integer greater than or equal to 2, and m is a positive integer greater than or equal to 2;
    针对至少一个所述图像分块,将所述图像分块的灰度级压缩到第一数值,得到灰度级压缩后的图像,所述第一数值小于所述特征图像的灰度级;For at least one of the image blocks, compress the gray level of the image block to a first value to obtain a gray level compressed image, where the first value is less than the gray level of the characteristic image;
    获取灰度级压缩后的图像的灰度直方图;Obtain a grayscale histogram of the image after grayscale compression;
    连接n×m块图像分块的灰度直方图,得到所述特征图像的灰度直方图。Connect the gray histograms of the n×m image blocks to obtain the gray histogram of the characteristic image.
  6. 一种人脸性别分类器的训练方法,其中,包括:A method for training a face gender classifier, which includes:
    获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;Acquiring multiple face image samples, where the multiple face image samples include multiple images with male faces and multiple images with female faces;
    对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;Performing face detection on the face image sample, and determining the position of the target face in the face image sample;
    对所述目标人脸进行人脸特征点提取;Performing face feature point extraction on the target face;
    根据所述人脸特征点,获得人脸感兴趣区域图像;Obtaining an image of a region of interest of a human face according to the facial feature points;
    对所述人脸感兴趣区域图像进行特征提取,得到特征图像;Performing feature extraction on the image of the region of interest of the face to obtain a feature image;
    对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;Performing gray-scale compression processing on the characteristic image, and obtaining a gray-scale histogram of the image after the gray-scale compression;
    根据所述灰度直方图得到所述目标人脸的性别特征;Obtaining the gender feature of the target face according to the grayscale histogram;
    采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。The face gender classifier is trained by using the gender features of the target face in all the face image samples to obtain a trained face gender classifier.
  7. 一种人脸性别识别装置,其中,包括:A face gender recognition device, which includes:
    人脸检测器,用于对待识别图像进行人脸检测,获取所述待识别图像中的目标人脸;A face detector, configured to perform face detection on the image to be recognized, and obtain the target face in the image to be recognized;
    人脸特征点提取器,用于对所述目标人脸进行人脸特征点提取;A face feature point extractor for extracting face feature points on the target face;
    人脸感兴趣区域获得器,用于根据所述人脸特征点,获得人脸感兴趣区域图像;A face region of interest obtainer, configured to obtain an image of a face region of interest according to the facial feature points;
    图像特征提取器,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;An image feature extractor, which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
    灰度级压缩处理器,用于对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;A gray-scale compression processor, configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
    性别特征获得器,用于根据所述灰度直方图得到所述目标人脸的性别特征;A gender feature obtainer, configured to obtain the gender feature of the target face according to the grayscale histogram;
    性别识别器,用于将所述目标人脸的性别特征输入至已训练的人脸性别分类器中,得到所述目标人脸的性别识别结果。The gender recognizer is used to input the gender characteristics of the target face into the trained face gender classifier to obtain the gender recognition result of the target face.
  8. 一种人脸性别分类器的训练装置,其中,包括:A training device for a face gender classifier, which includes:
    人脸图像样本获取器,用于获取多张人脸图像样本,所述多张人脸图像样本中包括多张具有男性人脸的图像以及多张具有女性人脸的图像;A face image sample acquirer, configured to acquire multiple face image samples, the multiple face image samples including multiple images with male faces and multiple images with female faces;
    人脸检测器,用于对所述人脸图像样本进行人脸检测,确定所述人脸图像样本中目标人脸的位置;A face detector, configured to perform face detection on the face image sample, and determine the position of the target face in the face image sample;
    人脸特征点提取器,用于对所述目标人脸进行人脸特征点提取;A face feature point extractor for extracting face feature points on the target face;
    人脸感兴趣区域获得器,用于根据所述人脸特征点,获得人脸感兴趣区域图像;A face region of interest obtainer, configured to obtain an image of a face region of interest according to the facial feature points;
    图像特征提取器,用于对所述人脸感兴趣区域图像进行特征提取,得到特征图像;An image feature extractor, which is used to perform feature extraction on the image of the region of interest of the face to obtain a feature image;
    灰度级压缩处理器,用于对所述特征图像进行灰度级压缩处理,并获取灰度级压缩后的图像的灰度直方图;A gray-scale compression processor, configured to perform gray-scale compression processing on the characteristic image, and obtain a gray-scale histogram of the image after the gray-scale compression;
    性别特征获得器,用于根据所述灰度直方图得到所述目标人脸的性别特征;A gender feature obtainer, configured to obtain the gender feature of the target face according to the grayscale histogram;
    训练器,用于采用所有所述人脸图像样本中的目标人脸的性别特征对人脸性别分类器进行训练,得到已训练的人脸性别分类器。The trainer is used to train the face gender classifier by using the gender characteristics of the target face in all the face image samples to obtain the trained face gender classifier.
  9. 一种人脸性别识别装置,其中,包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1至5中任一项所述的人脸性别识别方法的步骤。A face gender recognition device, which includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, the implementation is as claimed in the claims. Steps of the face gender recognition method described in any one of 1 to 5.
  10. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储计算机程序,所述计算机程序被处理器执行时实现如权利要求1至5中任一项所述的人脸性别识别方法的步骤;或者,所述计算机程序被处理器执行时实现如权利要求6所述的人脸性别分类器的训练方法的步骤。A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the face gender recognition method according to any one of claims 1 to 5 is realized Or, when the computer program is executed by a processor, the steps of the method for training a face gender classifier according to claim 6 are realized.
PCT/CN2019/109014 2019-09-29 2019-09-29 Face gender recognition method, face gender classifier training method and device WO2021056531A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/109014 WO2021056531A1 (en) 2019-09-29 2019-09-29 Face gender recognition method, face gender classifier training method and device
CN201980001859.5A CN110785769A (en) 2019-09-29 2019-09-29 Face gender identification method, and training method and device of face gender classifier

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/109014 WO2021056531A1 (en) 2019-09-29 2019-09-29 Face gender recognition method, face gender classifier training method and device

Publications (1)

Publication Number Publication Date
WO2021056531A1 true WO2021056531A1 (en) 2021-04-01

Family

ID=69394840

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/109014 WO2021056531A1 (en) 2019-09-29 2019-09-29 Face gender recognition method, face gender classifier training method and device

Country Status (2)

Country Link
CN (1) CN110785769A (en)
WO (1) WO2021056531A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114418957A (en) * 2021-12-24 2022-04-29 广州大学 Global and local binary pattern image crack segmentation method based on robot vision

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120114198A1 (en) * 2010-11-08 2012-05-10 Yang Ting-Ting Facial image gender identification system and method thereof
CN103914683A (en) * 2013-12-31 2014-07-09 闻泰通讯股份有限公司 Gender identification method and system based on face image
CN104598888A (en) * 2015-01-28 2015-05-06 广州远信网络科技发展有限公司 Human face gender recognition method
CN104778481A (en) * 2014-12-19 2015-07-15 五邑大学 Method and device for creating sample library for large-scale face mode analysis

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103593648B (en) * 2013-10-22 2017-01-18 上海交通大学 Face recognition method for open environment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120114198A1 (en) * 2010-11-08 2012-05-10 Yang Ting-Ting Facial image gender identification system and method thereof
CN103914683A (en) * 2013-12-31 2014-07-09 闻泰通讯股份有限公司 Gender identification method and system based on face image
CN104778481A (en) * 2014-12-19 2015-07-15 五邑大学 Method and device for creating sample library for large-scale face mode analysis
CN104598888A (en) * 2015-01-28 2015-05-06 广州远信网络科技发展有限公司 Human face gender recognition method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LI KUN-LUN,WANG MING-YAN: "Gender Classification Based on PCA and LBP", COMPUTER KNOWLEDGE AND TECHNOLOGY, vol. 5, no. 28, 5 October 2009 (2009-10-05), pages 8023 - 8025, XP055794293, ISSN: 1009-3044 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114418957A (en) * 2021-12-24 2022-04-29 广州大学 Global and local binary pattern image crack segmentation method based on robot vision

Also Published As

Publication number Publication date
CN110785769A (en) 2020-02-11

Similar Documents

Publication Publication Date Title
US11908244B2 (en) Human posture detection utilizing posture reference maps
US11830230B2 (en) Living body detection method based on facial recognition, and electronic device and storage medium
CN111401257B (en) Face recognition method based on cosine loss under non-constraint condition
US11151363B2 (en) Expression recognition method, apparatus, electronic device, and storage medium
CN108334848B (en) Tiny face recognition method based on generation countermeasure network
KR102641115B1 (en) A method and apparatus of image processing for object detection
WO2020103700A1 (en) Image recognition method based on micro facial expressions, apparatus and related device
WO2016149944A1 (en) Face recognition method and system, and computer program product
WO2016138838A1 (en) Method and device for recognizing lip-reading based on projection extreme learning machine
CN112381061B (en) Facial expression recognition method and system
CN105335725A (en) Gait identification identity authentication method based on feature fusion
CN108416291B (en) Face detection and recognition method, device and system
CN110472625B (en) Chinese chess piece visual identification method based on Fourier descriptor
CN104123543A (en) Eyeball movement identification method based on face identification
WO2018100668A1 (en) Image processing device, image processing method, and image processing program
CN112784712B (en) Missing child early warning implementation method and device based on real-time monitoring
CN113011253B (en) Facial expression recognition method, device, equipment and storage medium based on ResNeXt network
CN111860046A (en) Facial expression recognition method for improving MobileNet model
CN108229432A (en) Face calibration method and device
Mali et al. Indian sign language recognition using SVM classifier
Devadethan et al. Face detection and facial feature extraction based on a fusion of knowledge based method and morphological image processing
CN110598647A (en) Head posture recognition method based on image recognition
CN111881732B (en) SVM (support vector machine) -based face quality evaluation method
CN116523916B (en) Product surface defect detection method and device, electronic equipment and storage medium
WO2021056531A1 (en) Face gender recognition method, face gender classifier training method and device

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: 19946793

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: 19946793

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19946793

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 14.02.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 19946793

Country of ref document: EP

Kind code of ref document: A1