matlab-deep-learning / mtcnn-face-detection

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

Allow extraction of internal activations (feature maps) of neural networks #15

Open zjjdcrn opened 4 years ago

zjjdcrn commented 4 years ago

Hi,

Very nice face detection tool! Worked very good even for skew faces! Is it possible to extract the feature values from each layer in the MTCNN for new pictures? I mean when we input a new image, could we get the CNN features using this toolbox? If not, do you have any suggestions to do this?

Thanks very much!

justinpinkney commented 4 years ago

The current code doesn't provide a simple way of doing this using the mtcnn detector, but it wouldn't be terribly difficult.

Perhaps the simplest way would be to load one of the DAG networks (saved as a .mat file), you should be able to find the location using this fullfile(mtcnnRoot(), "weights", "dagRNet.mat") then you could use the built in activations function to grab the actual feature maps that are computed by the network when given an image. One thing to be careful of is that you will have to do the image normalisation yourself, i.e. scale the image to the range -1->1 rather than 0->255.

I'm interested in what you want to do with the feature maps? If you have any issues let me know, I could even put together a short example if you need.

zjjdcrn commented 4 years ago

Thanks Justin! Yes, I finally got this done by combining some functions in your toolbox. The codes were organized in a really good way and easy to understand! Appreciate your work! I am trying to use the feature maps to modeling human neural response when fixation on face images. Since these features might related more to facial parts, we expect to investigate at the coding mechanism of this information in human's MTL, where had shown to be important for face recognization.

justinpinkney commented 4 years ago

Sounds really interesting. I'm going to rename this issue and leave it open in case anyone else is interested in doing something similar.