sajjjadayobi/FaceLib

Error in insightface

Rukhmini opened this issue · 6 comments

I have created a dataset as data/facebank and kept the images inside individual person name. I am facing an error for the below mentioned block of code:

if update_facebank_for_add_new_person:
targets,names = update_facebank(conf, face_rec.model, detector)
else:
targets, names = load_facebank(conf)

NameError Traceback (most recent call last)
in ()
----> 1 if update_facebank_for_add_new_person:
2 targets,names = update_facebank(conf, face_rec.model, detector)
3 else:
4 targets, names = load_facebank(conf)

NameError: name 'update_facebank_for_add_new_person' is not defined

ooh man, it's an optional bool variable that I forgot to set, thank you for your reporting
I'll correct the readme file, and you can try the code here:

set it when you add someone new

update_facebank_for_add_new_person = True

or check the new readme file example

Hey Sajjjad,
Thanks for your prompt response.

After correcting that, I am getting an error like this:
How to get the facebank.pth file?
FileNotFoundError Traceback (most recent call last)
in ()
3 targets,names = update_facebank(conf, face_rec.model, detector)
4 else:
----> 5 targets, names = load_facebank(conf)

3 frames
/usr/local/lib/python3.6/dist-packages/torch/serialization.py in init(self, name, mode)
209 class _open_file(_opener):
210 def init(self, name, mode):
--> 211 super(_open_file, self).init(open(name, mode))
212
213 def exit(self, *args):

FileNotFoundError: [Errno 2] No such file or directory: 'models/data/facebank/facebank.pth'

I fixed it, you have to run it from scratch, please

  1. clone or pip again
  2. add weights files
  3. go to the add_face_from_camera.py in InsghtFace
  4. change the default name to anything that you want
  5. and then run the camera_verify.py for test

Hey sajjad,
One quick question, is it possible to test on a single image without using the camera like face detection and face alignment are performed?

yes, but you need some persons to compare it to them
you can add some persons with add_face_from_camera.py and then use a face image instead of using the face detector
just for test time not when you don't have this person in your facebank