davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.73k stars 4.8k forks source link

error in validate #80

Closed tphyhFighting closed 7 years ago

tphyhFighting commented 7 years ago

Hi,when i use my dataset to run validate_on_lfw.py .There is an error Traceback (most recent call last): File "validate_on_lfw.py", line 89, in main(parse_arguments(sys.argv[1:])) File "validate_on_lfw.py", line 65, in main images_placeholder, phase_train_placeholder, embeddings, nrof_folds=args.lfw_nrof_folds) File "/root/facenet_old/src/lfw.py", line 58, in validate np.asarray(actual_issame), seed, nrof_folds=nrof_folds) File "/root/facenet_old/src/facenet.py", line 504, in calculate_roc folds = KFold(n=nrof_pairs, n_folds=nrof_folds, shuffle=True, random_state=seed) File "/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.py", line 326, in init super(KFold, self).init(n, n_folds, shuffle, random_state) File "/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.py", line 257, in init " than the number of samples: {1}.").format(n_folds, n)) ValueError: Cannot have number of folds n_folds=10 greater than the number of samples: 0. How to do with the error?

davidsandberg commented 7 years ago

validate_on_lfw.py only works for LFW. The image pairs to test are specifiedin the text file data/pairs.txt. In principle it's possible to define your own pairs but I dont think that's very common.

tphyhFighting commented 7 years ago

Hi,do you know how to generate pairs.txt according to dataset?I generate my own pairs.txt but it can not work.There is the error: Traceback (most recent call last): File "validate_on_lfw.py", line 89, in main(parse_arguments(sys.argv[1:])) File "validate_on_lfw.py", line 65, in main images_placeholder, phase_train_placeholder, embeddings, nrof_folds=args.lfw_nrof_folds) File "/root/facenet_old/src/lfw.py", line 61, in validate np.asarray(actual_issame), 1e-3, seed, nrof_folds=nrof_folds) File "/root/facenet_old/src/facenet.py", line 575, in calculate_val val[fold_idx], far[fold_idx] = calculate_val_far(threshold, dist[test_set], actual_issame[test_set]) File "/root/facenet_old/src/facenet.py", line 592, in calculate_val_far val = float(true_accept) / float(n_same) ZeroDivisionError: float division by zero Thank you very much

davidsandberg commented 7 years ago

Closing due to inactivity. Open if needed.

astorfi commented 7 years ago

I am getting the same error and I am doing on the LFW!! Anything's wrong?

tphyhFighting commented 7 years ago

When I did on the LFW,it is fine.The error happened when I used my own dataset and my pairs.txt. But after I made the Intra-pair and the Extra-pair same,for example if the number of Intra-pair is 3,the Extra-pair is also 3,the error disappears.

Roysky commented 7 years ago

hi, how do you extract the pairs of your own datasets?