Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.bio.face
Commits
b30702b7
Commit
b30702b7
authored
4 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
[preprocessor][FaceCrop] Load annotators if they are passed as a string
parent
992e72c0
No related branches found
No related tags found
2 merge requests
!71
Face crop improvements
,
!64
Dask pipelines
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/preprocessor/FaceCrop.py
+10
-10
10 additions, 10 deletions
bob/bio/face/preprocessor/FaceCrop.py
with
10 additions
and
10 deletions
bob/bio/face/preprocessor/FaceCrop.py
+
10
−
10
View file @
b30702b7
...
@@ -10,8 +10,8 @@ import logging
...
@@ -10,8 +10,8 @@ import logging
from
.Base
import
Base
from
.Base
import
Base
logger
=
logging
.
getLogger
(
"
bob.bio.face
"
)
logger
=
logging
.
getLogger
(
"
bob.bio.face
"
)
from
sklearn.utils
import
check_array
from
bob.bio.base
import
load_resource
from
bob.pipelines.sample
import
SampleBatch
class
FaceCrop
(
Base
):
class
FaceCrop
(
Base
):
"""
Crops the face according to the given annotations.
"""
Crops the face according to the given annotations.
...
@@ -85,18 +85,18 @@ class FaceCrop(Base):
...
@@ -85,18 +85,18 @@ class FaceCrop(Base):
mask_seed : int or None
mask_seed : int or None
The random seed to apply for mask extrapolation.
The random seed to apply for mask extrapolation.
allow_upside_down_normalized_faces: bool, optional
If ``False`` (default), a ValueError is raised when normalized faces are going to be
upside down compared to input image. This allows you to catch wrong annotations in
your database easily. If you are sure about your input, you can set this flag to
``True``.
.. warning::
.. warning::
When run in parallel, the same random seed will be applied to all
When run in parallel, the same random seed will be applied to all
parallel processes. Hence, results of parallel execution will differ
parallel processes. Hence, results of parallel execution will differ
from the results in serial execution.
from the results in serial execution.
allow_upside_down_normalized_faces: bool, optional
If ``False`` (default), a ValueError is raised when normalized faces are going to be
upside down compared to input image. This allows you to catch wrong annotations in
your database easily. If you are sure about your input, you can set this flag to
``True``.
annotator : :any:`bob.bio.base.annotator.Annotator`
annotator : :any:`bob.bio.base.annotator.Annotator`
If provided, the annotator will be used if the required annotations are
If provided, the annotator will be used if the required annotations are
missing.
missing.
...
@@ -142,7 +142,7 @@ class FaceCrop(Base):
...
@@ -142,7 +142,7 @@ class FaceCrop(Base):
self
.
mask_sigma
=
mask_sigma
self
.
mask_sigma
=
mask_sigma
self
.
mask_neighbors
=
mask_neighbors
self
.
mask_neighbors
=
mask_neighbors
self
.
mask_seed
=
mask_seed
self
.
mask_seed
=
mask_seed
self
.
annotator
=
annotator
self
.
annotator
=
load_resource
(
annotator
,
"
annotator
"
)
self
.
allow_upside_down_normalized_faces
=
allow_upside_down_normalized_faces
self
.
allow_upside_down_normalized_faces
=
allow_upside_down_normalized_faces
# create objects required for face cropping
# create objects required for face cropping
...
@@ -300,7 +300,7 @@ class FaceCrop(Base):
...
@@ -300,7 +300,7 @@ class FaceCrop(Base):
The cropped face.
The cropped face.
"""
"""
def
_crop
(
image
,
annot
):
def
_crop
(
image
,
annot
):
# if annotations are missing and cannot do anything else return None.
# if annotations are missing and cannot do anything else return None.
if
(
if
(
not
self
.
is_annotations_valid
(
annot
)
not
self
.
is_annotations_valid
(
annot
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment