TreB1eN / InsightFace_Pytorch

Pytorch0.4.1 codes for InsightFace
MIT License
1.73k stars 423 forks source link

No such file or directory: 'work_space/save/model_final.pth' #26

Closed while-true-work closed 5 years ago

while-true-work commented 5 years ago

Hi there,

When I issue "python face_verify.py" there will be the following error message:

$ python face_verify.py
mtcnn loaded
{'batch_size': 100, 'emore_folder': PosixPath('data/faces_emore'), 'test_transform': Compose(
    ToTensor()
    Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
), 'embedding_size': 512, 'face_limit': 10, 'data_mode': 'emore', 'ms1m_folder': PosixPath('data/faces_ms1m_112x112'), 'work_path': PosixPath('work_space'), 'log_path': PosixPath('work_space/log'), 'net_depth': 50, 'facebank_path': PosixPath('data/facebank'), 'net_mode': 'ir_se', 'drop_ratio': 0.6, 'vgg_folder': PosixPath('data/faces_vgg_112x112'), 'device': device(type='cuda', index=0), 'save_path': PosixPath('work_space/save'), 'min_face_size': 30, 'threshold': 1.5, 'model_path': PosixPath('work_space/models'), 'use_mobilfacenet': False, 'input_size': [112, 112], 'data_path': PosixPath('data')}
ir_se_50 model generated
Traceback (most recent call last):
  File "face_verify.py", line 31, in <module>
    learner.load_state(conf, 'final.pth', True, True)
  File "/home/robert/workingbox/InsightFace_Pytorch/Learner.py", line 82, in load_state
    self.model.load_state_dict(torch.load(save_path/'model_{}'.format(fixed_str)))
  File "/home/robert/inf1/lib/python3.5/site-packages/torch/serialization.py", line 356, in load
    f = open(str(f), 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'work_space/save/model_final.pth'

My system info as follows:

OS: Ubuntu 16.04.5 LTS x86-64
CUDA: release 9.0, V9.0.176
Python: 3.5.2
torch: 0.4.1
torchvision: 0.2.1
mxnet: 1.3.1
mxnet_cu90: 1.3.1
tensorboardX: 1.4
opencv-python: 3.4.4.19

How can I generate or get the file "model_final.pth" ?

Thanks

while-true-work commented 5 years ago

I resolved this issue... 1st, copy the file 'model_mobilefacenet.pth' into 'work_space/save/' 2nd, edit 'config.py', find the line conf.use_mobilfacenet = False change to conf.use_mobilfacenet = True

That's all

DecentMakeover commented 5 years ago

Hi Did you change the filename from model_mobilefacenet.pth to model_final.pth?

yehengchen commented 5 years ago

Hi Did you change the filename from model_mobilefacenet.pth to model_final.pth?

The same issue... Did you resolved this issue? Thanks

Ndron commented 4 years ago

Change the filename from model_mobilefacenet.pth to model_final.pth next error FileNotFoundError: [Errno 2] No such file or directory: 'data\facebank\facebank.pth'

Then python face_verify.py --update

WW2401 commented 3 years ago

@Ndron Hi, when I met the error No such file or directory: 'data/facebank/facebank.pth', I ran python face_verify.py --update, but I met another problem as follows. Do you know the reason? ir_se_50 model generated learner loaded Traceback (most recent call last): File "face_verify.py", line 36, in targets, names = prepare_facebank(conf, learner.model, mtcnn, tta = args.tta) File "/home/InsightFace_Pytorch/utils.py", line 49, in prepare_facebank img = mtcnn.align(img) File "/home/InsightFacePytorch/mtcnn.py", line 23, in align , landmarks = self.detect_faces(img) File "/home/InsightFace_Pytorch/mtcnn.py", line 85, in detect_faces boxes = run_first_stage(image, self.pnet, scale=s, threshold=thresholds[0]) File "/home/InsightFace_Pytorch/mtcnn_pytorch/src/first_stage.py", line 35, in run_first_stage output = net(img) File "/home/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/home/InsightFace_Pytorch/mtcnn_pytorch/src/get_nets.py", line 67, in forward x = self.features(x) File "/home/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/home/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/home/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(input, kwargs) File "/home/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 301, in forward self.padding, self.dilation, self.groups) RuntimeError: CUDNN_STATUS_MAPPING_ERROR

Logible commented 4 months ago

Change the filename from model_mobilefacenet.pth to model_final.pth next error FileNotFoundError: [Errno 2] No such file or directory: 'data\facebank\facebank.pth'

Then python face_verify.py --update

change the face_bank folder to facebank. that would work