Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/added detect_remote_faces to face_recognition domain #605

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

pierluigizagaria
Copy link

Adds detect_remote_faces to face_recognition domain.
The purpose of the config is to enable the face_recognition components to detect faces that are trained in other ways as I mentioned in #604

For example in my case I would like to continue train Compreface using the native UI.
I wanted to make this config available only for Compreface but was difficult for me on how the logic is currently implemented. Then I thought that this behavior could be useful even on other face recognition components.

This PR also fixes the error occured in #603 by checking the existence of the train dir.

@netlify
Copy link

netlify bot commented May 15, 2023

Deploy Preview for viseron ready!

Name Link
🔨 Latest commit 1467d4a
🔍 Latest deploy log https://app.netlify.com/sites/viseron/deploys/6462330abfe0600008a6bbe9
😎 Deploy Preview https://deploy-preview-605--viseron.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@sonarcloud
Copy link

sonarcloud bot commented May 15, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
6.6% 6.6% Duplication

@roflcoopter
Copy link
Owner

Awesome, thanks! Will have a look at the code in the coming days

@roflcoopter
Copy link
Owner

I think you have to do some changes in order for this to work correctly.
Calling vis.add_entity each time a face is recognized wont work well, as it will add a new entity each time a persons face is recognized.

I think the best way is to call an API endpoint here: https://github.com/roflcoopter/viseron/blob/dev/viseron/domains/face_recognition/__init__.py#L90 which lists each face and you can then create entities the same way as it works for the file system.
You can create an abstract method in that class that the subclass in the compreface component can override which should return a list of names to track.
This will also allow components which cant support this feature (dlib for instance) to simply not implement this method and instead log an error saying it is unsupported.

It is also a good idea to move the detect_remote_faces option into the BASE_CONFIG_SCHEMA here: https://github.com/roflcoopter/viseron/blob/dev/viseron/domains/face_recognition/__init__.py#L36
Then you dont have to duplicate it on all components.

Let me know if i need to explain further!

@pierluigizagaria
Copy link
Author

I added a comment. When timer expires face is not removed from the _faces dict. This prevent the registration of the entity on every detection. I thought about calling the api but the problem was that new faces trained would require a restart of Viseron to re-register the component and download the new faces

@roflcoopter
Copy link
Owner

Ahh i see now. I still think it would be better to fetch them during startup so it behaves like locally trained faces. We could add a way to refresh the faces using the GUI/API in the future. Maybe even refresh automatically on an interval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants