fxgsell / GG-Edge-Inference

Using AWS Greengrass with the Nvidia Jetson TX2 to run ML models prepared with Amazon SageMaker.
MIT License
17 stars 7 forks source link

Face Recognition Precision #13

Open mingcow1997 opened 5 years ago

mingcow1997 commented 5 years ago

Hi, I wonder how to improve the precision in AWS Rekognition, since I recently tested with multiple people, but sadly returned with same face id. Sometimes have to wait several minutes until the face was detected as a different one.

Is there any way to fix the code or set similarity threshold higher? By the way, I am using Raspberry Pi 3 and a logitech c310 webcam.

Thank you!

fxgsell commented 5 years ago

This could be that there is lag or that the thresold is too low, normaly faces should be detected in a couple of seconds (but this could be higher based on where you are located and which AWS region you use), one way to verify is to manualy compare faces in rekognition, based on the face images stored in S3 and from there see what confidence score is needed.

Then in AWS Rekognition in lab 3: you can edit the file lambda_function.py and in rekognition.search_faces_by_image you can add the parameter FaceMatchThreshold and set a value higher value than 70 (the default).

Keep in mind there is also a different thresold on the device itself if you followed lab 2: in face_datastore.py you can modify tolerance.

mingcow1997 commented 5 years ago

Hi, thanks for your kind reply! I am trying to change region, but in the end failed on greengrass deployment after creating group. I have changed the aws configure region, is there anything I need to modify on your code?

Thank you!

mingcow1997 commented 5 years ago

Fixed, just need to use VeriSign Endpoints instead of Amazon Root CA 1.

mingcow1997 commented 5 years ago

Hi, I modify the tolerance in face_datastore.py : 0.6 -> 1.0 Then I got this error in the cloudwatch log. "payload": "index 0 is out of bounds for axis 0 with size 0"

fxgsell commented 5 years ago

You should not use a value of 1 as it will only match exactly identical images. You're probably looking for something like 0.8 or 0.9. if you really want to use 1, you can increase best to a higher value (line 24).