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
Merge requests
!114
Resolve "MultiFace crop issue"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "MultiFace crop issue"
fix-multicrop
into
master
Overview
1
Commits
1
Pipelines
2
Changes
1
Merged
Laurent COLBOIS
requested to merge
fix-multicrop
into
master
4 years ago
Overview
1
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#45 (closed)
Edited
4 years ago
by
Tiago de Freitas Pereira
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
f7576d9f
1 commit,
4 years ago
1 file
+
22
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
bob/bio/face/preprocessor/FaceCrop.py
+
22
−
9
Options
@@ -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
,
)
Loading