How to improve real-time face recognition performance and image quality #317
-
Hi Vlad! As you already know, I have an Electron app and came from Amazon Rekognition because I needed a way to run facial recognition in real-time and in offline mode, but now I'm running into some issues - which maybe aren't issues with the code itself - which is why I came to here, to find out if I'm on the right path and also to get tips regarding photography, if possible. At first glance everything works fine testing on my local machine (even with WASM backend and an Intel Core i3) but I can't get the same satisfactory results with a specific customer (which does not have a GPU) and so I came here again to ask for help on where I can improve my code/camera setup. I use facial recognition to allow people to enter the gym or not through a turnstile and in this case (which is not so uncommon) it is located right after the entrance door which is where a lot of light comes from and the webcam is on the side (the customer enters and turns to the left or right - on the table where the reception and the computer are - to look at the camera), thus resulting in excessive lighting of the faces and leaving them in many cases with half of the face practically white. The same does not occur at night, where my client said that everything works almost perfectly and the view of the face on the camera is much clearer, that is, my biggest problem is really the natural lighting during the day. I thought about using the filters for this purpose but they are applied to the whole image and not just where I need to balance, so the result is practically the same. I also tried repositioning the camera a few times, but it didn't help. Do you think adding a light coming from the opposite direction would help with that lighting balance? And to get a better idea of the content recorded by Human when registering a new face, I started saving photos of all registered faces locally and I was able to see exactly that: registered faces during the day are extremely illuminated and registered faces at night are much more visible, but something that made me a little concerned regardless of the time of day, was that all the photos seem to be of very low quality, some even being pixelated. I believe that this bad quality affects the comparison of faces, right? If you want, I can give you some examples of captured photos, I just won't post them here for permission and privacy reasons. All photos are 192x192 pixels and I don't know how to improve that - I understand that it only returns the extracted face from the image, but it worried me anyway. The webcam used is Full HD and nowhere in my code do I restrict the width or height of the camera, so how can I improve this resolution? My code is this (in a simplified way):
The webcam I recommend for my clients is the Logitech Full HD Pro Stream C922 and that specific client's CPU is an Intel Core i5. For now I'm having to keep Amazon Rekognition in this gym, because, although the conditions are exactly the same, Rekognition manages to register and recognize faces normally. However I want to test all the possibilities to be able to use Human - I was delighted with this project. Do you believe that there would be improvements in facial recognition if in these cases of lack of GPU I stopped using Human in real time to do the same as Rekognition and require less processing? (take the photo in the highest possible quality and recognize it based on the faces already saved) I'm available to answer any questions and thank you again for the amazing project! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
yes. most cameras (even cheap webcams) have some auto-adjustment, there is also a new feature added very recently to human:
of course...
This doesn't sound it has to be a perfect real-time, so why not?
If you want to store higher resolution, you can crop original photo using face box coordinates yourself, its pretty trivial - but that would be only for visual display in app, nothing to do with recognition. if you use |
Beta Was this translation helpful? Give feedback.
-
if you're using human v3,
its ok if scene is fully lit or its a bit darker (autobrightness will take care of that), worst case is if its lit just from one side which creates large contrasts.
right now, it has quite a big impact - much bigger than i'd like and its something i'm looking to improve in the future. on a side-note, human v3 supports completely new module for face descriptors - insightface, also, descriptors captured with new module are not compatible with old one, so you'd have to retrain database. if you want to experiment, you can take a look
(no changes needed in human, you only need to download the model and enable it in human config.) |
Beta Was this translation helpful? Give feedback.
-
Improved Time-Saving Face Detection in Video |
Beta Was this translation helpful? Give feedback.
if you're using human v3,
filter.enabled
andfilter.autobrightness
are enabled by default (unless you have a bad browser which doesn't support real-time filtering, but that's another story), so need to enable it explicitly.filter.equalization
is a different algorithm and its disabled by default - you can try if it instead ofautobrightness
, but not both at the same time.its ok if scene is fully lit or its a bit darke…