【The content of the invention】
In order to solve the problems of the prior art, the invention provides a kind of fast accurate face based on cascade structure is examined
Survey method, cannot keep higher computational efficiency in solving prior art simultaneously, ensure the recall rate and accuracy of face again
Problem.
The present invention is achieved by the following technical solutions:Design, manufactured a kind of fast accurate based on cascade structure
Method for detecting human face, comprises the steps:(A) fast human-face model detection;(B) screen face frame;(C) precisely faceform's inspection
Survey;(D) merge face frame and export.
As a further improvement on the present invention:In the step (A), accelerated model is using more special based on gradation of image
Levy, the Face datection algorithm of decision tree and soft cascade structures carries out model foundation.
As a further improvement on the present invention:The step (A) is specially:(A1) obtain original RGB color image;(A2)
Coloured image is changed into into single pass gray level image;(A3) Filtering Processing;(A4) size and location of frame is specified search for, is not required to
Pyramid sampling is done to image, only search box is amplified and diminution is processed;(A5) by the image of search inframe, send into instruction
Score value in each decision tree in the Face datection model perfected and to obtaining is processed.
As a further improvement on the present invention:In the step (C), accurate faceform is depth convolutional neural networks,
Using the 3 passage RGB images of 40X40 as input, the neutral net includes 2 convolutional layers, 2 sample levels and 2 to the neutral net
Individual full articulamentum.
As a further improvement on the present invention:In the step (C), in the training process of model, with last training
Complete model, detects to negative sample picture, and the picture frame that mistake is divided into face is cut to build negative sample sectional drawing, with last instruction
The negative sample sectional drawing practiced merges, for the training of this network.
As a further improvement on the present invention:In the step (D), merge face frame, in accurate faceform detection
It is judged as that the face window of face is merged, exports final face frame.
As a further improvement on the present invention:In the step (A3), with Graded Density come the noise level of phenogram picture,
Average gradient with image constructs bianry image as threshold value, if the Grad of pixel is more than threshold value, puts 1, otherwise sets to 0;By two
The corresponding Grad of pixel in value image for 1 is sued for peace;In binary map, it is scanned with the window of fixed size, step-length
For the length of side of window, it is ensured that each pixel will not be repetitively scanned;In scanning window, if there is pixel value to be 1, own in window
Pixel value be all entered as 1, after the completion of scanning, in statistical picture, pixel value is the number of 1 pixel;With Grad and remove
With the pixel number for counting on, Graded Density is obtained.
As a further improvement on the present invention:In the step (A5), if the image of search inframe is after one tree
Cumulative score, less than threshold value, then abandon the search box, proceed to step (A3) and processed;If being higher than threshold value, continue under
Judged on one tree;When an image for searching for inframe, pass through all of decision tree, then the frame has been exported, constitute one
Individual face frame to be selected, then screens face frame to be selected.
As a further improvement on the present invention:In the step (B), put by face frame score and the synthesis for overlapping number
Believe evaluation index to screen face frame.
The invention has the beneficial effects as follows:The speed and accuracy of detection have been taken into account simultaneously;Using the pixel on gray level image
Comparative feature and soft cascade cascade the high speed detector of decision tree, quickly select face frame to be selected, further using adopting
With the accurate detector of self study feature, face frame to be selected is screened, if there is face, it is ensured that the accuracy of face frame.
【Specific embodiment】
The present invention is further described for explanation and specific embodiment below in conjunction with the accompanying drawings.
A kind of fast accurate method for detecting human face based on cascade structure, comprises the steps:(A) fast human-face model detection;
(B) screen face frame;(C) precisely faceform's detection;(D) merge face frame and export.
In the step (A), accelerated model is using based on gradation of image comparative feature, decision tree and soft cascade knot
The Face datection algorithm of structure carries out model foundation.
The step (A) is specially:(A1) obtain original RGB color image;(A2) coloured image is changed into into single channel
Gray level image;(A3) Filtering Processing;(A4) specify search for the size and location of frame, it is not necessary to pyramid sampling is done to image,
Only search box is amplified and diminution is processed;(A5) by the image of search inframe, send in the Face datection model for training
Each decision tree in and score value to obtaining process.
In the step (C), accurate faceform is depth convolutional neural networks, and the neutral net is with 3 passages of 40X40
Used as input, the neutral net includes 2 convolutional layers, 2 sample levels and 2 full articulamentums to RGB image.
In the step (C), in the training process of model, the model trained with the last time enters to negative sample picture
Row detection, the picture frame that mistake is divided into face is cut to build negative sample sectional drawing, is merged with the negative sample sectional drawing of last training, is used
In the training of this network.
In the step (D), merge face frame, to being judged as that the face window of face is carried out in accurate faceform detection
Merge, export final face frame.
In the step (A3), with Graded Density come the noise level of phenogram picture, the average gradient with image as threshold value,
Construction bianry image, if the Grad of pixel is more than threshold value, puts 1, otherwise sets to 0;By the pixel correspondence in bianry image for 1
Grad summation;In binary map, it is scanned with the window of fixed size, the length of side of the step-length for window, it is ensured that each picture
Element will not be repetitively scanned.In scanning window, if there is pixel value to be 1, in window, all of pixel value is all entered as 1, scanning
After the completion of, in statistical picture, pixel value is the number of 1 pixel, with Grad and divided by the pixel number for counting on,
Obtain Graded Density.
In the step (A5), if the image of search inframe, less than threshold value is then lost in the cumulative score after one tree
The search box is abandoned, step (A3) is proceeded to and is processed;If being higher than threshold value, continue to be judged on lower one tree;When one
The image of search inframe, has passed through all of decision tree, then export the frame, constitutes a face frame to be selected, and then screening is treated
Choose face frame.
The face frame to be selected includes confidence score, upper left angular coordinate (x, y), the height height of frame and width
Degree width;Face frame is screened by the comprehensive confidence evaluation index of face frame score and overlap number.
To judging whether image is strong noise image, the evaluation methodology that may be carried out using other usual means;Height is made an uproar
The filtering mode of acoustic image, might have other usual ways.
In one embodiment, overall procedure such as Fig. 1 institutes of a kind of fast accurate method for detecting human face based on cascade structure
Show:Original image, through the human-face detector of accelerated model, quickly obtains face frame to be selected (size and location of frame), then
Using the human-face detector of accurate model, further confirm that whether the image of face inframe to be selected is face, be then to export corresponding
Face frame.Overall human-face detector adopts cascade structure, by classification capacity weaker but fireballing naive model Face datection
Device is strong with classification capacity but slow-footed accurate model human-face detector is used in combination, and is got rid of by the former most of non-face
Image-region, accurately filters out the image-region containing face by the latter, finally merges the figure containing face using NMS algorithms
As region, final face frame is exported.
Detected by fast human-face model, as shown in Fig. 2 accelerated model using based on gradation of image comparative feature,
Decision tree and the Face datection algorithm of soft cascade structures.Specially:
The 2.1 original rgb coloured images for obtaining 3 passages;
Coloured image is changed into single pass gray level image by 2.2;
Using Graded Density method, 2.3 judge whether the image is strong noise image, be that image is filtered, abating noises
Impact to image.When light is weaker, the performance of the noise of image capture device itself is obvious, to based on pixel comparative feature
Human-face detector affect it is larger.The present invention is with Graded Density come the noise level of phenogram picture.Average gradient with image is
Threshold value, constructs bianry image, if the Grad of pixel is more than threshold value, puts 1, otherwise sets to 0.By the pixel in bianry image for 1
The corresponding Grad summation of point.In binary map, the window (such as 2X2 pixel) with fixed size is scanned, and step-length is window
The length of side of mouth, it is ensured that each pixel will not be repetitively scanned.In scanning window, if there is pixel value to be 1, all of picture in window
Plain value is all entered as 1, after the completion of scanning, and in statistical picture, pixel value is the number of 1 pixel.Graded Density is shown in formula (1)
. wherein Sx,yIt is more than the Grad of average gradient in referring to image, N refers to the number of the pixel counted on scanning window.When
When image is larger, Graded Density value need to be sought to image local area only.Sx,yCalculating formula such as formula (2) shown in,
Sx,y=(| f (x+1, y)-f (x, y) |+| f (x, y+1)-f (x, y) |)/f (x, y) formula (2)
Wherein, f (x, y) represents image x, the pixel value at y-coordinate.By ρsThe size of value can determine whether the noise level of image.
If being judged as strong noise image, image is filtered, the present invention uses medium filtering, also has certainly other filtering modes,
Such as gaussian filtering etc..
2.4 size and locations for specifying search for frame, the method are different from general Face datection algorithm, it is not necessary to do gold to image
Word tower is sampled, and only needs all search boxes to be amplified and reduce.Reason is that the algorithm is adopted and is characterized in that grey scale pixel value ratio
Compared with feature;
2.5 by the image of search inframe, sends in each decision tree in the Face datection model for training, such that it is able to
To a score value, the score value characterizes the similarity of the image with face of decision tree assessment.The depth of decision tree is m, certainly
The number of plan tree is n.In certain limit, m values are bigger, and the classification capacity of single tree is stronger, and n is bigger, the classification capacity of detector
It is stronger, but speed is also slower.In the present invention, m takes 6, n and takes 500.Score of the image on single tree, needs are obtained with front one tree
Divide and added up;
If the image of 2.6 search inframes less than threshold value, then abandons the search box, turns in the cumulative score after one tree
2.3;If being higher than threshold value, continue to be judged on lower one tree;
2.7, when the image of a search inframe, have passed through all of decision tree, then export the frame, constitute a face to be selected
Frame.
2.8 screenings face frame to be selected.Face frame to be selected, comprising confidence (score), upper left angular coordinate (x, y), frame
Highly (height) and width (width), 5 information.Around face, multiple face frames to be selected, degree of overlapping typically occurs
It is very high, and around non-face, if there is face frame to be selected, the negligible amounts of frame, and degree of overlapping is than relatively low.Set up comprehensive
Confidence evaluation index V, such as formula (3) are detected judging whether face frame to be selected sends into the accurate faceform of next step.
V=α s+ β n formula (3), wherein α, β are constant, and s is the highest score of multiple high superposed frames, and n is high superposed
The number of frame, only when the degree of overlapping of two frames reaches certain threshold value such as 0.65, the two frames are just judged as high superposed frame.Two frame weights
Formula (4) Ov=s is shown in the calculating of folded degree Ovo/(s1+s2) formula (4)
soFor the overlapping area of two frames, s1、s2For the respective area of two frames.
After the comprehensive evaluation index V of face frame to be selected reaches requirement, then the accurate human-face detector of output feeding is further
Confirm.
Detected by accurate faceform, as shown in figure 3, precisely faceform, is depth convolutional neural networks.Should
Neutral net is using the 3 passage RGB images of 40X40 as input.Including 2 convolutional layers, 2 sample levels and 2 full articulamentums.Its
In, first convolutional layer, using the convolution kernel of 16 12X12, convolution kernel of second convolutional layer using 16 5X5.Each
There is a sample level after convolutional layer, using the mode of max-pooling, the region of 2X2 is processed with 2 as step-length.
In the training process of model, the mode for employing bootstrap is trained, i.e., the model trained with the last time, to bearing sample
This picture is detected, the picture frame that mistake is divided into face is cut to build negative sample sectional drawing, cut with the negative sample of last training
Figure merges, for the training of this network.During model training, network weight is updated using the mode of back propagation.
When merging face frame, using NMS methods (non-maximum compression), it is judged as the face window of face to exact classification device
Mouth is merged, and exports final face frame.
The present invention has cascaded the accurate human-face detector of the fast face detector based on manual feature and self study feature.
Wherein, manual features detector be based on pixel ratio compared with, self study is characterized in that what neural network learning was arrived.For pixel ratio compared with
Feature is easily affected by noise, the situation for causing Face datection effect to decline, and proposes to judge whether image is high using Graded Density
Noise image, then decide whether to carry out image filtering to eliminate effect of noise;The method, to normal picture and strong noise image
Be handled differently, it is to avoid process is all filtered to all images, improve detection efficiency, it also avoid because caused by filtering just
The problem that often recall rate of image declines;By the Filtering Processing to strong noise picture, fast face detector here is improve
Face recall rate in class image.
Using the highest score and number of high superposed frame, the face window for being input into accurate human-face detector is screened,
While ensureing recall rate, Face datection efficiency is improve.
Above content is with reference to specific preferred implementation further description made for the present invention, it is impossible to assert
The present invention be embodied as be confined to these explanations.For general technical staff of the technical field of the invention,
On the premise of without departing from present inventive concept, some simple deduction or replace can also be made, should all be considered as belonging to the present invention's
Protection domain.