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

Face testing #566

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Face testing #566

wants to merge 12 commits into from

Conversation

PJ-Watson
Copy link
Contributor

This closes #551, along with #255. Definitely a work in progress - no tests yet, and not all functionality added.

#255 - clusters unrecognised faces, then attempt to match them. Although this is a significant departure from the current setup of scanning for matches on a face-by-face basis, it avoids incorrect matches accumulating as part of recognised faces.

Will explain the changes once I've finished ironing out all the bugs!

@codecov
Copy link

codecov bot commented Oct 10, 2021

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 39.44%. Comparing base (a0e73aa) to head (2f0b0d3).
Report is 154 commits behind head on master.

Files Patch % Lines
api/utils/environment_variables.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #566      +/-   ##
==========================================
- Coverage   39.46%   39.44%   -0.03%     
==========================================
  Files         138      138              
  Lines        4487     4490       +3     
  Branches      567      567              
==========================================
  Hits         1771     1771              
- Misses       2541     2545       +4     
+ Partials      175      174       -1     
Flag Coverage Δ
api 36.68% <0.00%> (-0.06%) ⬇️
ui 41.80% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@viktorstrate
Copy link
Member

Awesome looks great after a quick skim of the changes. I really like the idea of using DBScan to cluster the faces first.

I noticed that you have forked two Go projects (goface and clusters) and used your version.
Are you planning to have your changes merged into the original projects, or is this just for the testing/development phase?

Do you think you'll be changing the the way face groups are managed (move, merge, detach, etc.). Because I am working on adding faces to the sidebar, and if you want to make changes, I'd rather wait until this is merged to implement that.

@PJ-Watson
Copy link
Contributor Author

Awesome looks great after a quick skim of the changes. I really like the idea of using DBScan to cluster the faces first.

Thank you! I'm not sure how easy it would be to implement a similar system for when faces are first scanned in (e.g. per album), but I think that's something to consider at a later date.

I noticed that you have forked two Go projects (goface and clusters) and used your version. Are you planning to have your changes merged into the original projects, or is this just for the testing/development phase?

For go-face, I'll see if the change can be merged into the main repository - otherwise it'll be a fairly simple solution without the change.

clusters doesn't appear to be in active development, so I think I'll stick with my fork - there's at least one bug in the main branch which I hope I've fixed!

Do you think you'll be changing the the way face groups are managed (move, merge, detach, etc.). Because I am working on adding faces to the sidebar, and if you want to make changes, I'd rather wait until this is merged to implement that.

Generally no - although I might like to change the way this currently works, I don't think I'll have time to get round to it at the moment. The main thing I'm trying to add (inspired by favourites in photos) is the ability to hide faces - although it would be good to see those faces directly in the sidebar anyway, so I don't think there will be any conflicts!

@viktorstrate
Copy link
Member

Sounds good!

I'm not sure how easy it would be to implement a similar system for when faces are first scanned in (e.g. per album), but I think that's something to consider at a later date.

I think it makes very good sense to cluster faces on a per album basis when an album is scanned the first time, as often the same people appear multiple times in the same album and it would still mean that the scanner doesn't have to scan the entire library before it can start doing face recognition.

And we would simply have to move the recogniser out of the for-loop and pass the albumMedia array instead of each media individually.

if processing_was_needed && media.Type == models.MediaTypePhoto {
go func(media *models.Media) {
if face_detection.GlobalFaceDetector == nil {
return
}
if err := face_detection.GlobalFaceDetector.DetectFaces(db, media); err != nil {
scanner_utils.ScannerError("Error detecting faces in image (%s): %s", media.Path, err)
}
}(media)
}

But as you say, it's fine to do that in another pull request, as this is already a big patch.

clusters doesn't appear to be in active development, so I think I'll stick with my fork - there's at least one bug in the main branch which I hope I've fixed!

That's fine, I'd appreciate if you sent a pull-request to see if they would accept it upstream. If not let's go with your fork.

@PJ-Watson
Copy link
Contributor Author

Just popping back in to say I haven't completely abandoned this - unfortunately work and other commitments have put this on the back seat for now (and most likely until the end of the month unfortunately :( ). I'll see if I can tidy up the code I have already, a smaller commit to solve the two linked issues might be more manageable than trying to fix everything in one go!

@viktorstrate
Copy link
Member

Thank you for letting me know. That's completeley fine, take the time you need.
I agree, let's keep this PR as short and managable as possible.

As the face recognition part of the API has barely any testing, I'd really like some more tests on that moving forward. I think that it will be very natural to add simultaneously with fixing #255 - to verify that the fix(es) do indeed work.

@kkovaletp kkovaletp added help wanted Extra attention is needed discussion Raises questions that are up for discussion feature A new idea or feature face recognition Related to face recognition labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Raises questions that are up for discussion face recognition Related to face recognition feature A new idea or feature help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS Error on action "Move image faces" Server Error: internal system error at (recognizeUnlabeledFaces)
3 participants