-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
added new functionality to use compreface subjects for facial recognition #845
added new functionality to use compreface subjects for facial recognition #845
Conversation
…tion Added new compreface face_recognition config option "use_subjects" which defaults to false. When set to true the binary face recognition entities will instead be defined by the subjects compreface. Added a new endpoint /compreface/update_subjects which when called will add to face recognition entities any subject from compreface which is not currently added. This endpoint works regardless of the "use_subjects" config setting. If a user adds a new subject to compreface they will be able to call this endpoint and start receiving face recognition state messages without restarting viseron
✅ Deploy Preview for viseron canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall but found a few things that needs to change a little!
vis.add_entity( | ||
component, FaceDetectionBinarySensor(vis, self._camera, face_dir) | ||
) | ||
if not config[CONFIG_USE_SUBJECTS]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to find a way to move this to the compreface
code instead of the base class.
Let me know if you need help with that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this and the part below is because the base class is where entities get created based on the file structure in the face_recognition path This feature stops this from occurring, so the only alternative would be to remove it completely from the base class and implement it in each implementation of it. This was not only less modifications, but seemed more elegant. With the below part, any none-compreface plugin will default to false and implement as usual. The only downside is that a user could turn this option to true for other plugins, and have no entities created.
What do you suggest in order to prevent adding entities at the base class level in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought of a way to possibly do this while trying to go to bed, but haven't referenced the code to confirm if it's a good way of doing this.
What if I put an optional boolean parameter that defaults to true in this init method which prevents the entity initialization when false. Then in the compreface implementation pass the value of use_subjects?
You'll end up seeing this before I get a chance to implement this tomorrow, so let me know if this makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good solution to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3rd commit addresses this.
@@ -70,6 +73,11 @@ | |||
default=DEFAULT_SAVE_FACES, | |||
description=DESC_SAVE_FACES, | |||
): bool, | |||
vol.Optional( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the use_subjects
is specific to the compreface
integration it should only be included there and not here in the base class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3rd commit addresses this.
…e"]["face_recognition"]
The I have pinned the working version of |
And regarding the failure of You need to run |
…se class. Updated the docs for compreface
Looks good, thank you! |
Added new compreface face_recognition config option "use_subjects" which defaults to false. When set to true the binary face recognition entities will instead be defined by the subjects compreface. Added a new endpoint /compreface/update_subjects which when called will add to face recognition entities any subject from compreface which is not currently added. This endpoint works regardless of the "use_subjects" config setting. If a user adds a new subject to compreface they will be able to call this endpoint and start receiving face recognition state messages without restarting viseron