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
3161603c
Commit
3161603c
authored
3 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-multicrop' into 'master'
Resolve "MultiFace crop issue" Closes
#45
See merge request
!114
parents
272fdae8
f7576d9f
No related branches found
No related tags found
1 merge request
!114
Resolve "MultiFace crop issue"
Pipeline
#49864
passed
3 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/face/preprocessor/FaceCrop.py
+22
-9
22 additions, 9 deletions
bob/bio/face/preprocessor/FaceCrop.py
with
22 additions
and
9 deletions
bob/bio/face/preprocessor/FaceCrop.py
+
22
−
9
View file @
3161603c
...
...
@@ -374,7 +374,7 @@ class FaceCrop(Base):
class
MultiFaceCrop
(
Base
):
"""
Wraps around FaceCrop to enable a dynamical cropper that can handle several annotation types.
"""
Wraps around FaceCrop to enable a dynamical cropper that can handle several annotation types.
Initialization and usage is similar to the FaceCrop, but the main difference here is that one specifies
a *list* of cropped_positions, and optionally a *list* of associated fixed positions.
...
...
@@ -400,26 +400,39 @@ class MultiFaceCrop(Base):
allow_upside_down_normalized_faces
=
False
,
**
kwargs
,
):
# Check parameters
assert
isinstance
(
cropped_positions_list
,
list
)
if
fixed_positions_list
is
None
:
fixed_positions_list
=
[
None
]
*
len
(
cropped_positions_list
)
assert
isinstance
(
fixed_positions_list
,
list
)
# copy parameters (sklearn convention : each explicit __init__ argument *has* to become an attribute of the estimator)
self
.
cropped_image_size
=
cropped_image_size
self
.
cropped_positions_list
=
cropped_positions_list
self
.
fixed_positions_list
=
fixed_positions_list
self
.
mask_sigma
=
mask_sigma
self
.
mask_neighbors
=
mask_neighbors
self
.
mask_seed
=
mask_seed
if
isinstance
(
annotator
,
str
):
annotator
=
load_resource
(
annotator
,
"
annotator
"
)
self
.
annotator
=
annotator
self
.
allow_upside_down_normalized_faces
=
allow_upside_down_normalized_faces
# Instantiate individual croppers
self
.
croppers
=
{}
for
cropped_positions
,
fixed_positions
in
zip
(
cropped_positions_list
,
fixed_positions_list
self
.
cropped_positions_list
,
self
.
fixed_positions_list
):
assert
len
(
cropped_positions
)
==
2
self
.
croppers
[
tuple
(
cropped_positions
)]
=
FaceCrop
(
cropped_image_size
,
self
.
cropped_image_size
,
cropped_positions
,
fixed_positions
,
mask_sigma
,
mask_neighbors
,
mask_seed
,
annotator
,
allow_upside_down_normalized_faces
,
self
.
mask_sigma
,
self
.
mask_neighbors
,
self
.
mask_seed
,
self
.
annotator
,
self
.
allow_upside_down_normalized_faces
,
**
kwargs
,
)
...
...
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