matlab-deep-learning / mtcnn-face-detection

Face detection and alignment using deep learning
Other
26 stars 18 forks source link

Run face detection on grayscale image #14

Closed msprog closed 4 years ago

msprog commented 4 years ago

Can mtcnn implements gray images and how?

justinpinkney commented 4 years ago

If you have a grayscale image it is probably has only 1 colour channel. If you pad this to make it 3 channels it should be the compatible with the current detection (but I don't know what the effect on detection performance will be)

Something like:

im = repmat(grayIm, [1, 1, 3]);
justinpinkney commented 4 years ago

For anyone interested in this the above line of code will be sufficient to make your greyscale image three channel, which can then be passed to the detector. But be aware that this will have a slight detrimental impact on the detection performance, see the image below (when running on the RGB version all the faces are detected).

image