ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.36k stars 13.48k forks source link

How can I use this module to recognize cat faces? #1429

Closed PacCol closed 2 years ago

PacCol commented 2 years ago

Description

I am trying to make this example work with cat faces https://github.com/ageitgey/face_recognition/blob/master/examples/facerec_from_webcam_faster.py

What I Did

I tried to replace the two pictures with two different cats, but I get this output: Traceback (most recent call last): File "reco.py", line 19, in <module> cat1_face_encoding = face_recognition.face_encodings(cat1_image)[0] IndexError: list index out of range I think that the module doesn't recognize cats. Is there a way to make it works?

Thanks!

alessandrolamberti commented 2 years ago

Models have been trained to detect human faces, not cats. You get the Index error because you're trying to index an empty list, because it didn't detect any (human) face.

harshareddy832 commented 2 years ago

Models have been trained to detect human faces, not cats. You get the Index error because you're trying to index an empty list, because it didn't detect any (human) face.

Exactly

harshareddy832 commented 2 years ago
  • face_recognition version: 1.3.0
  • Python version: 3.8.10
  • Operating System: Ubuntu

Description

I am trying to make this example work with cat faces https://github.com/ageitgey/face_recognition/blob/master/examples/facerec_from_webcam_faster.py

What I Did

I tried to replace the two pictures with two different cats, but I get this output: Traceback (most recent call last): File "reco.py", line 19, in <module> cat1_face_encoding = face_recognition.face_encodings(cat1_image)[0] IndexError: list index out of range I think that the module doesn't recognize cats. Is there a way to make it works?

Thanks!

If you want the model to recognise cats, you have to train the model with cat pictures, since the model is not aware of cats existence, you have that error.

PacCol commented 2 years ago

Thanks for helping me. I will try to train my own model, as you suggested.

aloveric commented 10 months ago

Thanks for helping me. I will try to train my own model, as you suggested.

Hello, have you solve this new model training?

PacCol commented 10 months ago

Thanks for helping me. I will try to train my own model, as you suggested.

Hello, have you solve this new model training?

No but you can use opencv for cats detection and tensor flow for recognition.

aloveric commented 10 months ago

Thanks for helping me. I will try to train my own model, as you suggested.

Hello, have you solve this new model training?

No but you can use opencv for cats detection and tensor flow for recognition.

Thanks. After finding hard to train new model for this solution, I'm trying to use tensorflow instead.