arsfutura / face-recognition

A framework for creating and using a Face Recognition system.
BSD 3-Clause "New" or "Revised" License
146 stars 49 forks source link

train.sh is giving errors #23

Closed rsingh2083 closed 3 years ago

rsingh2083 commented 3 years ago

Hi ,

While running sh tasks/train.sh images/ Im getting valueerror as :-

images/rah/ra.jpg /home/pi/.local/lib/python3.7/site-packages/facenet_pytorch/models/utils/detect_face.py:146: UserWarning: This overload of nonzero is deprecated: nonzero() Consider using one of the following signatures instead: nonzero(*, bool as_tuple) (Triggered internally at ../torch/csrc/utils/python_arg_parser.cpp:882.) bb = mask.nonzero().float().flip(1) Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/pi/face-recognition/training/train.py", line 99, in main() File "/home/pi/face-recognition/training/train.py", line 84, in main embeddings, labels, class_to_idx = load_data(args, features_extractor) File "/home/pi/face-recognition/training/train.py", line 61, in load_data embeddings, labels = dataset_to_embeddings(dataset, features_extractor) File "/home/pi/face-recognition/training/train.py", line 41, in dataset_toembeddings , embedding = features_extractor(transform(Image.open(img_path).convert('RGB'))) File "/home/pi/face-recognition/face_recognition/face_features_extractor.py", line 26, in call return self.extract_features(img) File "/home/pi/face-recognition/face_recognition/face_features_extractor.py", line 15, in extractfeatures bbs, = self.aligner.detect(img) File "/home/pi/.local/lib/python3.7/site-packages/facenet_pytorch/models/mtcnn.py", line 308, in detect self.device File "/home/pi/.local/lib/python3.7/site-packages/facenet_pytorch/models/utils/detect_face.py", line 66, in detect_face tmp[(dy[k] - 1):edy[k], (dx[k] - 1):edx[k], :] = img[(y[k] - 1):ey[k], (x[k] - 1):ex[k], :] ValueError: could not broadcast input array from shape (0,1364,3) into shape (0,0,3)

ldulcic commented 3 years ago

Hi @rsingh2083!

Did you install the right dependencies before running task/train.sh? (pip install -r requirements.txt)

rsingh2083 commented 3 years ago

Hi @rsingh2083!

Did you install the right dependencies before running task/train.sh? (pip install -r requirements.txt)

Most of the versions arent even available. Which python should we use ? 3.6/3.7/3.8 ? Is it because of version mismatch ?

ldulcic commented 3 years ago

Hi @rsingh2083!

Sorry for the late response. There seems to be an error fetching pytorch 1.2, I'll sort it out and push a new version ASAP and get back to you.

Tnx for reporting :)

crypt0miester commented 3 years ago

you may want to remove the versions from requirements.txt of torch and torchvision. it will work. @rsingh2083

ldulcic commented 3 years ago

This should be fixed. Closing it.