shicaiwei123 / patch_based_cnn

the implement of Face Anti-Spoofing Using Patch and Depth-Based CNNs
30 stars 12 forks source link

Depth Based CNN #4

Closed malik-anhar closed 3 years ago

malik-anhar commented 3 years ago

The description of this repo is patch-based and depth-based Face Anti Spoofing, but I found that there's only patch-based CNN for Face Anti Spoofing, so where can I find the implementation for depth-based CNN for Face Anti Spoofing and the fusion? Is this repo implement the paper of https://ieeexplore.ieee.org/document/8272713 right?

shicaiwei123 commented 3 years ago

Hi. There are two parts in this paper: depth-based CNN and patch_based CNN. Considering the complexity of depth estimation, this repo just implements the depth-based CNN now.

malik-anhar commented 3 years ago

did you mean this repo just implements the patch-based CNN now? And I have another question, the input size for the network is 96x96 of a single image patch, so the training process is only feed single patch image of spoof / real face, right? For the inference you feed the network 8 times of random crop face image, and it will calculate which one (real / spoof) is the most predicted, right? I can see the code at line

if true_count >= false_count:
    return 1
else:
    return 0
shicaiwei123 commented 3 years ago

Yeah, this repo just implements the patch-based CNN now. For the second question, this implementation extracts 8 patches from one single image and feeds it into the network, not one, which is realized before training instead of the in transform to improve the training speed. For the last question, yes, it's just as you think. It's worth noting that the paper extract 64 patches from living faces, however, this may lead to the imbalance in training data, so I don't implement as small as the paper. If you want, you can simply change the 'date_len' parameter in the data_generate.py.

malik-anhar commented 3 years ago

One more question, the crop procedure is a random crop or grid crop? I mean, if a random crop is used then it will be an intersection across patch images

shicaiwei123 commented 3 years ago

Yeah, just as described in the " Experimental Parameters and Setup " part of this paper, this implementation extracts random patches per frame for training. And to Keep consistency, the random seed is the same in training and testing processing.

malik-anhar commented 3 years ago

Thank you for replying.. I'm trying to reproduce it with tensorflow