mnikitin / Learn-Convolutional-Neural-Network-for-Face-Anti-Spoofing

Implementation of "Learn Convolutional Neural Network for Face Anti-Spoofing" paper
115 stars 30 forks source link

Question about the code: start_test.py #7 #9

Closed prince6show closed 5 years ago

prince6show commented 5 years ago

ValueError: Cannot find output that matches name "pooling2_output" net_output = 'pooling2_output' in line 20 Where the pooling2_output exists in?

mnikitin commented 5 years ago

Hi @prince6show ! 'pooling2_output' exists in saved (trained) model. load_net() is in start_test.py script, which assumes you already trained CNNs for real/fake classification. This repo doesn't contain pretrained models, so before using start_test, you firstly need to train some model(s).

mnikitin commented 5 years ago

@prince6show did you use alexnet architecture from utils/net_generator.py for your CNN? If so, 'pooling2_output' should exist in your sym, and it corresponds to the output of the 3rd pooling, right before the fully connected layers: https://github.com/mnikitin/Learn-Convolutional-Neural-Network-for-Face-Anti-Spoofing/blob/master/utils/net_generator.py#L25 . In case you used your own architecture, or changed layer names, you need accordingly change the value of net_output.

If it doesn't help, could you please provide the list of all symbol names you have in sym.get_internals() ?

prince6show commented 5 years ago

Scale: 1.0; Fold: 1. Preparing CNN features ... [12:04:41] c:\jenkins\workspace\mxnet\mxnet\src\operator\nn\cudnn./cudnn_algoreg-inl.h:97: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable) Scale: 1.0; Fold: 1. Training and estimation SVM with C=0.000977 ... Traceback (most recent call last): File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 143, in test_net_casia('data/casia/CA_scales', 'experiments/casia/CA_scales', 5, svm_c) File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 131, in test_net_casia cur_eer_dev, thr = estimate_eer(data_dev, labels_dev, model) File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 71, in estimate_eer eer, thr = get_eer_stats(scores, labels) File "F:\DeepLearning\FaceAntiSpoofing\LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing\utils\statistics.py", line 37, in get_eer_stats eer = (min_dist_stats[0] + min_dist_stats[1]) / 2.0 IndexError: list index out of range

Process finished with exit code 1

mnikitin commented 5 years ago

Scale: 1.0; Fold: 1. Preparing CNN features ... [12:04:41] c:\jenkins\workspace\mxnet\mxnet\src\operator\nn\cudnn./cudnn_algoreg-inl.h:97: Running performance tests to find the best convolution algorithm, this can take a while... (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable) Scale: 1.0; Fold: 1. Training and estimation SVM with C=0.000977 ... Traceback (most recent call last): File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 143, in test_net_casia('data/casia/CA_scales', 'experiments/casia/CA_scales', 5, svm_c) File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 131, in test_net_casia cur_eer_dev, thr = estimate_eer(data_dev, labels_dev, model) File "F:/DeepLearning/FaceAntiSpoofing/LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing/start_test.py", line 71, in estimate_eer eer, thr = get_eer_stats(scores, labels) File "F:\DeepLearning\FaceAntiSpoofing\LearnConvolutionalNeuralNetworkforFaceAnti-Spoofing\utils\statistics.py", line 37, in get_eer_stats eer = (min_dist_stats[0] + min_dist_stats[1]) / 2.0 IndexError: list index out of range

Process finished with exit code 1

Such error could arise only in case your 'scores' list is empty, which means there are still some problems with scores computation.

prince6show commented 5 years ago

@mnikitin Sometimes there are all identical value in the 'scores' list .

ifcoxs commented 5 years ago

@prince6show How did you convert the video into the corresponding frame picture? After I converted, there were always uncaligned pictures clipped.

prince6show commented 5 years ago

@ifcoxs https://blog.csdn.net/u010167269/article/details/53268686

prince6show commented 5 years ago

net_output = 'pooling2_output' Why ???why not fc2

mnikitin commented 5 years ago

@prince6show hello! I've already answered this question here: https://github.com/mnikitin/Learn-Convolutional-Neural-Network-for-Face-Anti-Spoofing/issues/10#issuecomment-474015526