This Application claims priority of Taiwan Application No. 99138294, filed on Nov. 8, 2010, the entirety of which is incorporated by reference herein.
1. Field of the Invention
The invention relates to a computer image identification system and method, and in particular relates to a gender identification system for facial images and method thereof.
2. Description of the Related Art
Recently, an important field of computer vision has been facial image gender identification. Facial image gender identification systems are used in security systems, and for gender-oriented information dissemination, smart photography and analyzing the outcome of gender-oriented marketing. For example, when a gender identification system detects the gender of a person that is not permitted around a restroom or a dormitory, it can inform security guards or users with an alarm to prevent from crimes from occurring.
Conventional gender identification techniques usually identify a gender by human faces. It is a challenging problem to identify the gender on the ground of facial image gender identification because even humans are not able to identify gender 100 percent of the time. Due to variety of facial expressions or emotions of human faces, light changes, or incomplete visibility of human faces, the accuracy of prior works on gender identification is not good enough. Nevertheless, two key techniques have been disclosed which improve upon gender identification by capturing the characteristics of human faces and then comparing the captured characteristics with pre-built facial characteristics data.
Conventional algorithms for facial image gender identification perform face detection after capturing a facial image as the input image for a gender identification system. There are input image requirements for accuracy, such as having the direction of the face being toward the camera, no hat being worn, no facial expressions, a simple background, high image resolution, and uniform lighting etc. Nonetheless, commonly, input images may be blurry with low resolution, even with facial expressions and captured from various angles. Thus, it is not easy to compare the input images with the pre-built facial characteristics data to get a correct gender identification result. Accordingly, facial image gender identification algorithms which mitigate the above deficiencies are desired to increase identification accuracy and increase the speed of gender identification.
In view of this, a facial image gender identification method is provided in present invention. An exemplary embodiment of the facial image gender identification method comprises: receiving a facial image; calculating global feature values and local feature values of the facial image; and determining a gender identification result of the facial image according to the global feature values, the local feature values, and gender characteristic values and gender data corresponding to each of a plurality of training facial images respectively in a face database.
In another exemplary embodiment, the invention further provides a facial image gender identification system, comprising: a face database, for storing gender characteristic values and gender data corresponding to each of a plurality of training facial images respectively; an image capturing unit, for capturing at least one facial image; a gender identification data generating unit, coupled to the image capturing unit and the face database, for receiving the facial image from the image capturing unit and calculating global feature values and local feature values of the facial image; and a gender identification unit, coupled to the gender identification data generating unit and the face database, for determining a gender identification result from the facial image according to the global feature values and the local feature values from the gender identification data generating unit, and the gender characteristic values and gender data stored in the face database.
In yet another exemplary embodiment, the invention further provides a computer program product loaded into a machine to execute the facial image gender identification method of the invention, comprising: a first program code for receiving at least one facial image; a second program code for calculating global feature values and local feature values of the facial image; and a third program code for determining a gender identification result of the facial image according to the global feature values, the local feature values, and gender characteristic values and gender data corresponding to each of a plurality of training facial images stored in a face database respectively.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The present invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the best-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
In one embodiment of the invention, a facial image gender identification system is provided for determining the gender of facial images according to facial gender characteristic values and gender data corresponding to each of a plurality of training facial images stored in a face database. In some embodiments, the face database is built with a plurality of typical facial images with gender information as training data. First, basic adjustments are performed on a facial image. Further, face detection is performed to get a facial patch on the facial image and transform the facial image to a grayscale facial image. Accordingly, the facial patch among the grayscale facial image is divided into a global image and sub-images in order to calculate the global feature values and the local feature values of the facial image. Furthermore, the global feature values and the local feature values are normalized to obtain gender characteristic values. As a result, a gender model, which is built by analyzing the gender characteristic values, is stored in a face database. In some embodiments, training data in the face database can be enhanced by learning, training, or other real applications.
According to an embodiment in present invention,
The gender identification data generating unit 120, coupled to the image capturing unit 110 and the face database 140, is used for receiving the facial image from the image capturing unit 110, detecting the facial patches in the facial image and calculating the global feature values and local feature values of the facial patches. In other embodiments of present invention, the gender identification data generating unit 120 further normalizes the global feature values and the local feature values, and stores the normalized global feature values and local feature values and gender data into the face database 140.
In another embodiment, the gender identification data generating unit 120 further includes a face detection unit 121. For the face detection unit 121, the corresponding algorithms for detecting and retrieving the facial patches in video sequences or images are prior art, and thus implemented with a general algorithm. Meanwhile in another embodiment, Intel's OpenCV (open source computer vision) library is adapted to perform face detection and retrieve facial patches. The OpenCV library calculates the facial characteristics and retrieves the facial patches among the facial images by using Harr algorithm and Real Adaboost Cascade algorithm, which uses 20×20 pixels as the minimum range for detecting faces. However, the facial image detection method is not limited thereto. In one embodiment, the face detection unit 121 can further transform color images into grayscale images to reduce the effect of white balance.
In another embodiment, the gender identification data generating unit 120 further comprises a classifier 123 which is built according to the gender characteristic values and gender data corresponding to each of a plurality of training facial images stored in a face database. The gender identification unit 130 can determine the gender identification result from the facial image by the classifier 123, which can be a formula for gender classification, such as a support vector machine (SVM), but is not limited thereto. The classifier 123 can classify the normalized global feature values and local feature values into a gender model, and store the normalized global feature values and local feature values and the gender data into the face database 140.
In also another embodiment, the gender identification data generating unit 120 further includes a characteristics calculating unit 122 for calculating the characteristic values of the facial images. The face detection 121 transforms facial images into grayscale facial images and the transformation process can reduce the effect of white balance for calculating the characteristic values. Following is an equation for grayscale transformation:
I=0.212671*R+0.715160*G+0.072169*B
where I is the luminance value of a grayscale pixel; R is the brightness value of a red color; G is the brightness value of a green color; and B is the brightness value of blue color.
In another embodiment, the characteristics calculating unit 122 equally divides the detected facial patch in the grayscale facial image into one global image and 2×2, 3×3, 4×4 sub-images separately. In one embodiment, the solution of dividing image can be regarded as spatial pyramid. Then, six characteristic values of each image block are calculated, such as mean value, maximum value, minimum value, standard deviation value, x-gradient ratio and y-gradient ratio. The six characteristic values are calculated with the luminance pixels in the grayscale facial patch.
Following is an equation for calculating the mean value:
where
Following is an equation for calculating the standard deviation value:
where σ is the standard deviation value of luminance pixels; and N is the number of total pixels in the global image or the sub-images.
Following is an equation for calculating the x-gradient ratio:
where Rxi is the x-gradient ratio; Gxi is the horizontal gradient; N is the number of total pixels in the image block; Ai is a 3×3 matrix with a center located in the calculated pixel in the global image. 2D plane convolution is performed by using a horizontal Sobel mask with the corresponding 3×3 matrix Ai of each pixel in the global image to obtain the horizontal gradient for each pixel in the global image. The x-gradient ratio can be derived by dividing the total number of pixels in the global image with a horizontal gradient greater than zero, with the total number of pixels in the global image. The x-gradient ratio of each sub-image can be obtained in the same way as the global image.
Following is an equation for calculating the y-gradient ratio:
where Ryi is the y-gradient ratio; Gyi is the horizontal gradient; N is the number of total pixels in the global image; Ai is a 3×3 matrix with a center located in the calculated pixel of the global image. 2D convolution is performed using a vertical Sobel mask with the corresponding 3×3 matrix Ai of each pixel in the global image to obtain the vertical gradient for each pixel in the global image. The y-gradient ratio can be derived by dividing the total number of pixels in the global image with vertical gradient greater than zero, with the total number of pixels in the global image. The y-gradient ratio of each sub-image can be obtained in the same way as the global image.
For example, each image block has its own six characteristic values which can be expressed as:
v
k-i
=[
When the six characteristic values of each image block in the facial patch is calculated, a characteristics vector fi of (12+22+32+42)*6=180 dimensions can be obtained by expanding all the characteristic values of each image block. The characteristics vectorfi can be expressed as:
f
i
=[v
1-1
,v
2-1
,v
2-2
,v
2-3
,v
2-4
,v
3-1
,v
3-2
, . . . , v
4-16]
Assigning numbers for each vector in the characteristics vector fi can be expressed as:
f
i
=[a
1
,a
2
,a
3
, . . . , a
180]
If three thousand facial images are adapted as training data during a training phase, a characteristics matrix F with 180*3000 dimensions can be obtained which is expressed as:
Then, the maximum value and minimum value of each column in characteristics matrix F can be calculated and the values of each column with the range of 0˜1 are normalized. For example, if the maximum value and minimum value of column 1 are M1 and m1, respectively, the normalized a1-1 can be expressed as:
In the same way, each value of each column in the characteristics matrix F can be calculated to obtain an adjusted characteristics matrix Fs:
The adjusted characteristics matrix Fs and gender data is trained and classified by the classifier 123. The classifier 123 further stores the adjusted characteristics matrix Fs and gender data into the face database 140. In one embodiment, the adjusted characteristics matrix Fs includes normalized global feature values and local feature values, which are also regarded as gender characteristic values, corresponding to the global image and sub-images of the training facial images with a known gender respectively. The adjusted characteristics matrix Fs further determines a relationship formula for gender classification by using the classifier 123, which is a gender model stored in the face database 140.
In another embodiment of the present invention, the facial image gender identification system 100 further comprises a display unit (not shown) to display gender identification results of the facial images in the gender identification unit 130. For example, if the gender identification result of a facial image is male, the gender identification unit 130 will mark the male face with a blue label. If the gender identification result of a facial image is female, the gender identification unit 130 will mark the female face with a red label.
First, in step S210, the image capturing unit 110 retrieves training facial images of a known gender and basic adjustments. In step S220, the face detection unit 121 performs face detection on the training facial images to obtain facial patches. In step S230, the face detection unit 121 further transforms the facial patches into grayscale facial patches and the characteristics calculating unit 122 divides the grayscale facial patches into a global image and sub-images, respectively. In step S240, the characteristics calculating unit 122 calculates the global feature values and local feature values of the global image and sub-images, respectively. In step S250, the characteristics calculating unit 122 further normalizes the global feature values and local feature values of image blocks. In step S260, the classifier 123 stores the normalized global feature values and local feature values into the face database 140.
First, in step S310, the image capturing unit 110 retrieves a facial image and the face detection unit transforms the facial image into a grayscale facial image. Further in step S320, the face detection unit performs face detection on the grayscale facial image to obtain grayscale facial patches. In step S330, the characteristics calculating unit 122 divides each grayscale facial patch into a global image and sub-images. In step S340, the characteristics calculating unit calculates the global feature values and local feature values of the global image and sub-images, respectively. In step S350, the characteristics calculating unit 122 further normalizes the global feature values and local feature values. In step S360, the gender identification unit 130 identifies gender by matching the normalized global feature values and local feature values with gender characteristic values and gender data stored in the face database 140. In step S370, the gender identification result is outputted.
In the aforementioned embodiments, the division of the sub-images is described a 2×2, 3×3 and 4×4 equally divided blocks; however, the present invention is not limited thereto. The division of the sub-images can be performed in other alternative ways. Also, the global feature values and local feature values are described with the six characteristic values of global images and sub-images, such as mean value, maximum value, minimum value, standard deviation value, x-gradient ratio, and y-gradient ratio; however, present invention is not limited thereto. Other characteristic values or some appropriate characteristic values chosen from the six characteristic values can be adapted.
The facial image gender identification system and method, or certain aspects or portions thereof, may take the form of program code embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable (e.g., computer-readable) storage medium, or computer program products without limitation in external shape or form thereof, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine thereby becomes an apparatus for practicing the methods. The present invention also provides a computer program product for being loaded into a machine to execute a method for a facial image gender identification method, comprising: a first program code for receiving at least one facial image; a second program code for calculating global feature values and local feature values of the facial image; and a third program code for determining a gender identification result from the facial image according to the calculated global feature values, local feature values, and gender characteristic values and gender data corresponding to each of a plurality of training facial images stored in a face database.
The methods may also be embodied in the form of program code transmitted over some transmission medium, such as an electrical wire or a cable, or through fiber optics, or via any other form of transmission, wherein, when the program code is received and loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the disclosed methods. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates analogously to application specific logic circuits.
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. To the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
Number | Date | Country | Kind |
---|---|---|---|
99138294 | Nov 2010 | TW | national |