Repository navigation
Follow small faces from the mask on them - #190
Merged
Merged
Conversation
The face detector sees the whole frame at 128 px, so faces a few dozen pixels wide, as in street footage, weren't found. When the mask is on such a face, it also looks at overlapping squares of the full frame. The squares find other people too, so a lost face no longer jumps to the nearest one: it must be near and about as big as where it was last seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #182: Follow face. Reframe's Face mode is left as it is (see below), so the issue stays open for it.
Follow face found no face in 4K street footage: the detector sees the whole frame at 128 × 128, where a face a few dozen pixels of a 720p proxy is a few pixels.
What changed
FaceDetector.detecttakes a region of the picture, and gives its boxes in fractions of the whole picture.When the mask is on a face too small for the whole frame,
FaceTracksalso looks at overlapping squares of the full frame, then merges the boxes as before.FaceTracking.tilessizes the squares so the face is about 20 px of the detector's 128: 12 squares for a face 1/20 of a 720p frame wide, at most 15 in 16:9. With a bigger face nothing changes.The squares also find other people, and things like faces (a sign, a car's rear, a dog) scoring as high as real faces (0.53 to 0.80 for both on the footage). So
FaceTracking.followno longer takes the nearest face whatever the distance. The same face must be:Beyond that the sample has no face, and
trackfills it as before.Checked
FaceDetectorTest.findsASmallFaceInARegion(ml:vision): the test portrait at 70 px in a 1280 × 720 frame is found in a region (0.93) and not in the whole frame.FaceTracksTest.aSmallFaceIsFollowedFromTheMaskOnIt(core:engine): the portrait moving across a 9:16 frame at 0.3 scale is followed within 0.02 of the frame. It took 4.7 s for 30 samples, against 2.6 s for the close face.FaceTrackingTest:smallFacesAreLookedForInTilesOfThePictureandaLostFaceDoesNotJumpToSomeoneElse.FaceTracksTestandReframerTest(all four) pass on the emulator.Not done: Reframe's Face mode. It has no mask to start from and follows the surest face. With the squares, a sign or a car scores as high as a person, so it could frame those. It keeps to the whole frame. Options for it: BlazeFace full range (made for faces up to 5 m), or requiring a face to be seen in several samples in a row before following it.
🤖 Generated with Claude Code