Closed linkksng closed 1 year ago
@linkksng For compatibility reasons, in case someone prefers the old behavior probably its best to preserve the old model and logic too and simply mark it as deprecated.
Depending on how much the code changed, if its possible you can perhaps add the new model too in net_blazeface.py
under a different code name while minimizing/avoiding the code repetition. Then, in face_alignment/detection/blazefaceback/blazeface_detector.py
add a new flag to control which model to select.
Let me know if you are interested in making a pull request.
The current blazeface model uses the front camera model from hollance/BlazeFace-PyTorch. According to their readme, this model is suitable only for selfie using front camera, and is not very suitable for other types of portrait photos.
For the frontal camera model, only faces that occupy more than 20% of the image area were considered due to the intended use case (the threshold for the rear-facing camera model was 5%).
A while ago they have added another model for the rear camera, which is claimed to capture smaller faces in non-selfie photos. This issue is a feature request to add support for this back camera model.
I have tried implementing it myself successfully. My approach is as follows. Perhaps someone can come up with a more elegant way.
- Clone
face_alignment/detection/blazeface
. Say the new directory name isblazefaceback
. This will be the name for the new model- Update
face_alignment/detection/blazefaceback/net_blazeface.py
with latest code ofblazeface.py
from upstream.- Update model_urls in
face_alignment/detection/blazefaceback/blazeface_detector.py
- In
face_alignment/detection/blazefaceback/detect.py
, change the input image size from 128 to 256.After some testing, for my dataset
blazefaceback
can identify small faces thatblazeface
cannot.
In step 3 where did you get new model_urls for the blazeface rear-facing camera models? I would love to implement this but I can't find the models anywhere.
Blaze back camera model added (see readme for how to use it).
The current blazeface model uses the front camera model from hollance/BlazeFace-PyTorch. According to their readme, this model is suitable only for selfie using front camera, and is not very suitable for other types of portrait photos.
A while ago they have added another model for the rear camera, which is claimed to capture smaller faces in non-selfie photos. This issue is a feature request to add support for this back camera model.
I have tried implementing it myself successfully. My approach is as follows. Perhaps someone can come up with a more elegant way.
face_alignment/detection/blazeface
. Say the new directory name isblazefaceback
. This will be the name for the new modelface_alignment/detection/blazefaceback/net_blazeface.py
with latest code ofblazeface.py
from upstream.face_alignment/detection/blazefaceback/blazeface_detector.py
face_alignment/detection/blazefaceback/detect.py
, change the input image size from 128 to 256.After some testing, for my dataset
blazefaceback
can identify small faces thatblazeface
cannot.