CosFace_pytorch
CosFace_pytorch copied to clipboard
TypeError: slice indices must be integers or None or have an __index__ method
After I run lfw_eval.py
, there occurred this error:
Traceback (most recent call last):
File "lfw_eval.py", line 122, in <module>
_, result = eval(net.sphere().to('cuda'), model_path='checkpoint/CosFace_24_checkpoint.pth')
File "lfw_eval.py", line 109, in eval
folds = KFold(n=6000, n_folds=10)
File "lfw_eval.py", line 38, in KFold
test = base[i * n / n_folds:(i + 1) * n / n_folds]
TypeError: slice indices must be integers or None or have an __index__ method
I found that if I run the KFold()
solely, there still occurs this error.
This error may due to the difference of python 2 and 3.
Please modify
test = base[i * n / n_folds:(i + 1) * n / n_folds]
to
test = base[int(i * n / n_folds) : int((i + 1) * n / n_folds)]
In addition, you might come accross the 'best_thresh = find_best_threshold(thresholds, predicts[train]) IndexError: too many indices for array' error. In this situation, please refer predicts[train] Error .
test = base[int(i * n / n_folds):int((i + 1) * n / n_folds)]改成这样可以
After I run
lfw_eval.py
, there occurred this error:Traceback (most recent call last): File "lfw_eval.py", line 122, in <module> _, result = eval(net.sphere().to('cuda'), model_path='checkpoint/CosFace_24_checkpoint.pth') File "lfw_eval.py", line 109, in eval folds = KFold(n=6000, n_folds=10) File "lfw_eval.py", line 38, in KFold test = base[i * n / n_folds:(i + 1) * n / n_folds] TypeError: slice indices must be integers or None or have an __index__ method
I found that if I run the
KFold()
solely, there still occurs this error.
Hi, I just found the ACC99.2.pth for pretrained model, but got bad performance. Can you share the download link of the CosFace_24_checkpoint.pth?