Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
d9b94d07
Commit
d9b94d07
authored
May 21, 2021
by
Laurent COLBOIS
Browse files
Added face crop examples in the doc
parent
9c50df1a
Pipeline
#50958
failed with stage
in 26 minutes and 3 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/config/baseline/helpers.py
View file @
d9b94d07
...
...
@@ -252,12 +252,12 @@ def get_default_cropped_positions(mode, cropped_image_size, annotation_type):
"""
if
mode
==
"legacy"
:
return
legacy_default_cropping
(
cropped_image_size
,
annotation_type
)
elif
mode
in
[
"facenet"
,
"arcface"
]:
elif
mode
in
[
"dnn"
,
"facenet"
,
"arcface"
]:
return
dnn_default_cropping
(
cropped_image_size
,
annotation_type
)
elif
mode
==
"pad"
:
return
pad_default_cropping
(
cropped_image_size
,
annotation_type
)
else
:
raise
ValueError
(
"Unknown default cropping mode {}"
.
format
(
mode
))
raise
ValueError
(
"Unknown default cropping mode
`
{}
`
"
.
format
(
mode
))
def
make_cropper
(
...
...
doc/faq.rst
View file @
d9b94d07
...
...
@@ -11,4 +11,63 @@ The recipe below helps you to set a face cropper based on eye positions.
.. literalinclude:: faq/facecrop.py
.. figure:: ./faq/img/ada_cropped.png
\ No newline at end of file
.. figure:: ./faq/img/ada_cropped.png
How to choose the cropped positions ?
=================================
The ideal cropped positions are dependent on the specific application you are using the face cropper in.
Some face embedding extractors work well on loosely cropped faces, while others require the face to be tightly cropped.
We provide a few reasonable defaults that are used in our implemented baselines. They are accessible through an utilitary function,
:any:`bob.bio.face.config.baseline.helpers.get_default_cropped_positions`.
::
import bob.bio.face.config.baseline.helpers.get_default_cropped_positions
mode = 'legacy'
cropped_image_size=(160, 160)
annotation_type='eyes-center'
cropped_positions = get_default_cropped_positions(mode, cropped_image_size, annotation_type)
There are currently three available modes :
* :code:`legacy` Tight crop, used in non neural-net baselines such as :code:`gabor-graph`, :code:`lgbphs` or :code:`lda`.
It is typically use with a 5:4 aspect ratio for the :code:`cropped_image_size`
* :code:`dnn` Loose crop, used for neural-net baselines such as the ArcFace or FaceNet models.
* :code:`pad` Tight crop used in some PAD baselines in :ref:`bob.pad.face`
We present hereafter a visual example of those crops for the `eyes-center` annotation type.
.. figure:: img/cropping_example_source.png
:height: 250px
:align: left
:alt: Source image
:figclass: align-center
Original face image
.. figure:: img/cropping_example_legacy.png
:height: 250px
:align: right
:alt: Legacy crop
:figclass: align-center
Legacy crop (160 x 128)
.. figure:: img/cropping_example_dnn.png
:height: 250px
:align: left
:alt: DNN crop
:figclass: align-center
DNN crop (160 x 160)
.. figure:: img/cropping_example_pad.png
:height: 250px
:align: right
:alt: PAD crop
:figclass: align-center
PAD crop (160 x 160)
\ No newline at end of file
doc/img/cropping_example_dnn.png
0 → 100644
View file @
d9b94d07
44.1 KB
doc/img/cropping_example_legacy.png
0 → 100644
View file @
d9b94d07
34.4 KB
doc/img/cropping_example_pad.png
0 → 100644
View file @
d9b94d07
42.6 KB
doc/img/cropping_example_source.png
0 → 100644
View file @
d9b94d07
1.18 MB
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment