HamadYA / GhostFaceNets

This repository contains the official implementation of GhostFaceNets, State-Of-The-Art lightweight face recognition models.
https://ieeexplore.ieee.org/document/10098610
MIT License
194 stars 38 forks source link

Im trying to use the video_test.py but got error AttributeError: 'YoloV5FaceDetector' object has no attribute 'detect' #24

Closed icang1694 closed 1 year ago

icang1694 commented 1 year ago

so i tried the video_test.py trying to do prediction using laptop's webcam i tried running it like this: python3 video_test.py -m checkpoints/GhostFaceNet_W1.3_S1_ArcFace.h5 -k datasets/faces/ then i got error AttributeError: 'YoloV5FaceDetector' object has no attribute 'detect'

when i check there are no method 'detect' in YoloV5FaceDetector' are those supposed to be like that? thank you

HamadYA commented 1 year ago

so i tried the video_test.py trying to do prediction using laptop's webcam i tried running it like this: python3 video_test.py -m checkpoints/GhostFaceNet_W1.3_S1_ArcFace.h5 -k datasets/faces/ then i got error AttributeError: 'YoloV5FaceDetector' object has no attribute 'detect'

when i check there are no method 'detect' in YoloV5FaceDetector' are those supposed to be like that? thank you

Hi, Thanks for your feedback.

Try to change it to: bboxes, pps, , = det.detect_in_image(imm_BGR, (640, 640))

icang1694 commented 1 year ago

hi, thank you for your reply. now i got this error: Traceback (most recent call last): File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 180, in imageclasses, embeddings, = embedding_images(det, face_model, known_user, args.embedding_batch_size, force_reload) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 72, in embedding_images nimg = do_detect_in_image(img, det, image_format="RGB")[-1] File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 47, in do_detect_inimage bboxes, pps, , _ = det.detect_in_image(imm_BGR, (640, 640)) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 54, in detect_in_image bbs, pps, ccs = self.call(image, max_output_size, iou_threshold, score_threshold, image_format) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 176, in call return self.yolo_nms(post_outputs, max_output_size, iou_threshold, score_threshold) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 166, in yolo_nms rr = tf.image.non_max_suppression(bbt, cct, max_output_size=max_output_size, iou_threshold=iou_threshold, score_threshold=0.0) File "/Users/buttercup/miniforge3/envs/ghostfacenets/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "/Users/buttercup/miniforge3/envs/ghostfacenets/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node wrappedNonMaxSuppressionV3device/job:localhost/replica:0/task:0/device:CPU:0}

aidansmyth95 commented 1 year ago

I have the same issue

HamadYA commented 1 year ago

Hi Sorry for the delay, I just checked the issue. It is solved now,

Comment the below bboxes, pps = det.detect(imm_BGR, (640, 640))

Replace it with (double underscore before and after the word call bboxes, pps, ccs = det._call_(imm_BGR)

OR bboxes, pps, ccs, _ = det.detect_in_image(imm_BGR)

hi, thank you for your reply. now i got this error: Traceback (most recent call last): File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 180, in imageclasses, embeddings, = embedding_images(det, face_model, known_user, args.embedding_batch_size, force_reload) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 72, in embedding_images nimg = do_detect_in_image(img, det, image_format="RGB")[-1] File "/Users/buttercup/Documents/GitHub/GhostFaceNets/video_test.py", line 47, in do_detect_inimage bboxes, pps, , _ = det.detect_in_image(imm_BGR, (640, 640)) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 54, in detect_in_image bbs, pps, ccs = self.call(image, max_output_size, iou_threshold, score_threshold, image_format) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 176, in call return self.yolo_nms(post_outputs, max_output_size, iou_threshold, score_threshold) File "/Users/buttercup/Documents/GitHub/GhostFaceNets/face_detector.py", line 166, in yolo_nms rr = tf.image.non_max_suppression(bbt, cct, max_output_size=max_output_size, iou_threshold=iou_threshold, score_threshold=0.0) File "/Users/buttercup/miniforge3/envs/ghostfacenets/lib/python3.10/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "/Users/buttercup/miniforge3/envs/ghostfacenets/lib/python3.10/site-packages/tensorflow/python/eager/execute.py", line 53, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: {{function_node wrappedNonMaxSuppressionV3device/job:localhost/replica:0/task:0/device:CPU:0}

HamadYA commented 1 year ago

I have the same issue

https://github.com/HamadYA/GhostFaceNets/issues/24#issuecomment-1736659659