analogdevicesinc / ai8x-training

Model Training for ADI's MAX78000 and MAX78002 Edge AI Devices
Apache License 2.0
86 stars 76 forks source link

RetinaFace Model No Longer Available from Hawk-Eyes Package #315

Closed Jake-Carter closed 3 weeks ago

Jake-Carter commented 1 month ago

Attempting to run db_gen.py from one of our facial_recognition demos throws the following error from the hawk-eyes package.

unning on device: cuda:0
Configuring device: MAX78002, simulate=True.
Traceback (most recent call last):
  File "/home/jhcarter/repos/ai8x-training/venv/lib/python3.8/site-packages/gdown/download.py", line 267, in download
    url = get_url_from_gdrive_confirmation(res.text)
  File "/home/jhcarter/repos/ai8x-training/venv/lib/python3.8/site-packages/gdown/download.py", line 55, in get_url_from_gdrive_confirmation
    raise FileURLRetrievalError(
gdown.exceptions.FileURLRetrievalError: Cannot retrieve the public link of the file. You may need to change the permission to 'Anyone with the link', or have had many accesses. Check FAQ in https://github.com/wkentaro/gdown?tab=readme-ov-file#faq.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./db_gen/generate_face_db.py", line 84, in <module>
    main()
  File "./db_gen/generate_face_db.py", line 80, in main
    create_db_from_folder(args)
  File "./db_gen/generate_face_db.py", line 44, in create_db_from_folder
    face_detector = RetinaFace(model_name='retina_l', conf=0.1)
  File "/home/jhcarter/repos/ai8x-training/venv/lib/python3.8/site-packages/hawk_eyes/face/src/face_detection.py", line 32, in __init__
    gdown.download('https://drive.google.com/u/0/uc?id=1-WuPlFkL3ald1niehULXmOuyWOyu1iVh&export=download', model_dir + '/l_det_10g.onnx', quiet=False)
  File "/home/jhcarter/repos/ai8x-training/venv/lib/python3.8/site-packages/gdown/download.py", line 278, in download
    raise FileURLRetrievalError(message)
gdown.exceptions.FileURLRetrievalError: Failed to retrieve file url:

    Cannot retrieve the public link of the file. You may need to change
    the permission to 'Anyone with the link', or have had many accesses.
    Check FAQ in https://github.com/wkentaro/gdown?tab=readme-ov-file#faq.

You may still be able to access the file from the browser:

    https://drive.google.com/u/0/uc?id=1-WuPlFkL3ald1niehULXmOuyWOyu1iVh&export=download

but Gdown can't. Please check connections and permissions.

It seems that the package is minimally maintained, and the Google Drive link the module uses to download the ONNX model files has been removed. (https://drive.usercontent.google.com/download?id=1-WuPlFkL3ald1niehULXmOuyWOyu1iVh&export=download&authuser=0)

The error itself is an issue with hawk-eyes, but as the repo hasn't seen any activity in 2 years I'm opening this here to open an investigation into alternative methods for running the RetinaFace model.

The official RetinaFace repo/package seems like a better choice.

oguzhanbsolak commented 1 month ago

Hi @Jake-Carter,

Thanks for letting us know. We have already replaced Hawk-Eyes with the Face_Detection package in the training repository, but it appears we missed it in the MSDK examples. I'll update those with a PR. Thank you for your package suggestion, but it is another re-implementation of RetinaFace rather than the official one. For context, the official implementation is InsightFace/RetinaFace, which is MXNet-based.

Jake-Carter commented 1 month ago

Thanks for the clarification @oguzhanbsolak!

oguzhanbsolak commented 3 weeks ago

Hi @Jake-Carter,

After this discussion, I noticed that Face_Detection package checkpoint links were also dead. I replaced the Face_Detection with batch-face library as it provides the same speed and performance aspects. The PR's for MSDK, RefDes, and training repo are now open, and I think they will be merged in soon.

320

321

Jake-Carter commented 3 weeks ago

https://github.com/analogdevicesinc/msdk/pull/1056