Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.bio.face
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.bio.face
Commits
5a260a1e
Commit
5a260a1e
authored
Dec 21, 2020
by
Laurent COLBOIS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting
parent
bb5b1b70
Pipeline
#46758
passed with stage
in 37 minutes and 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
63 deletions
+60
-63
bob/bio/face/config/baseline/helpers.py
bob/bio/face/config/baseline/helpers.py
+60
-63
No files found.
bob/bio/face/config/baseline/helpers.py
View file @
5a260a1e
...
...
@@ -30,58 +30,56 @@ def embedding_transformer_default_cropping(cropped_image_size, annotation_type):
"""
if
isinstance
(
annotation_type
,
list
):
return
[
embedding_transformer_default_cropping
(
cropped_image_size
,
item
)
for
item
in
annotation_type
]
else
:
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
=
cropped_image_size
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
=
cropped_image_size
if
annotation_type
==
"bounding-box"
:
if
annotation_type
==
"bounding-box"
:
TOP_LEFT_POS
=
(
0
,
0
)
BOTTOM_RIGHT_POS
=
(
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
)
cropped_positions
=
{
"topleft"
:
TOP_LEFT_POS
,
"bottomright"
:
BOTTOM_RIGHT_POS
}
TOP_LEFT_POS
=
(
0
,
0
)
BOTTOM_RIGHT_POS
=
(
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
)
cropped_positions
=
{
"topleft"
:
TOP_LEFT_POS
,
"bottomright"
:
BOTTOM_RIGHT_POS
}
elif
annotation_type
==
"eyes-center"
:
elif
annotation_type
==
"eyes-center"
:
RIGHT_EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
1
/
3
*
CROPPED_IMAGE_WIDTH
),
)
LEFT_EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
2
/
3
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"leye"
:
LEFT_EYE_POS
,
"reye"
:
RIGHT_EYE_POS
}
RIGHT_EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
1
/
3
*
CROPPED_IMAGE_WIDTH
),
)
LEFT_EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
2
/
3
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"leye"
:
LEFT_EYE_POS
,
"reye"
:
RIGHT_EYE_POS
}
elif
annotation_type
==
"left-profile"
:
elif
annotation_type
==
"left-profile"
:
EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
3
/
8
*
CROPPED_IMAGE_WIDTH
),
)
MOUTH_POS
=
(
round
(
5
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
3
/
8
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"leye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
3
/
8
*
CROPPED_IMAGE_WIDTH
),
)
MOUTH_POS
=
(
round
(
5
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
3
/
8
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"leye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
elif
annotation_type
==
"right-profile"
:
elif
annotation_type
==
"right-profile"
:
EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
5
/
8
*
CROPPED_IMAGE_WIDTH
),
)
MOUTH_POS
=
(
round
(
5
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
5
/
8
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"reye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
EYE_POS
=
(
round
(
2
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
5
/
8
*
CROPPED_IMAGE_WIDTH
),
)
MOUTH_POS
=
(
round
(
5
/
7
*
CROPPED_IMAGE_HEIGHT
),
round
(
5
/
8
*
CROPPED_IMAGE_WIDTH
),
)
cropped_positions
=
{
"reye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
else
:
else
:
cropped_positions
=
None
cropped_positions
=
None
return
cropped_positions
return
cropped_positions
def
legacy_default_cropping
(
cropped_image_size
,
annotation_type
):
...
...
@@ -108,39 +106,38 @@ def legacy_default_cropping(cropped_image_size, annotation_type):
"""
if
isinstance
(
annotation_type
,
list
):
return
[
legacy_default_cropping
(
cropped_image_size
,
item
)
for
item
in
annotation_type
]
else
:
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
=
cropped_image_size
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
=
cropped_image_size
if
annotation_type
==
"bounding-box"
:
if
annotation_type
==
"bounding-box"
:
TOP_LEFT_POS
=
(
0
,
0
)
BOTTOM_RIGHT_POS
=
(
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
)
cropped_positions
=
{
"topleft"
:
TOP_LEFT_POS
,
"bottomright"
:
BOTTOM_RIGHT_POS
}
TOP_LEFT_POS
=
(
0
,
0
)
BOTTOM_RIGHT_POS
=
(
CROPPED_IMAGE_HEIGHT
,
CROPPED_IMAGE_WIDTH
)
cropped_positions
=
{
"topleft"
:
TOP_LEFT_POS
,
"bottomright"
:
BOTTOM_RIGHT_POS
}
elif
annotation_type
==
"eyes-center"
:
elif
annotation_type
==
"eyes-center"
:
RIGHT_EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
4
-
1
)
LEFT_EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
4
*
3
)
cropped_positions
=
{
"leye"
:
LEFT_EYE_POS
,
"reye"
:
RIGHT_EYE_POS
}
RIGHT_EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
4
-
1
)
LEFT_EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
4
*
3
)
cropped_positions
=
{
"leye"
:
LEFT_EYE_POS
,
"reye"
:
RIGHT_EYE_POS
}
elif
annotation_type
==
"left-profile"
:
# Main reference https://gitlab.idiap.ch/bob/bob.chapter.FRICE/-/blob/master/bob/chapter/FRICE/script/pose.py
EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
7
*
3
-
2
)
MOUTH_POS
=
(
CROPPED_IMAGE_HEIGHT
//
3
*
2
,
CROPPED_IMAGE_WIDTH
//
7
*
3
-
2
)
cropped_positions
=
{
"leye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
elif
annotation_type
==
"left-profile"
:
# Main reference https://gitlab.idiap.ch/bob/bob.chapter.FRICE/-/blob/master/bob/chapter/FRICE/script/pose.py
EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
7
*
3
-
2
)
MOUTH_POS
=
(
CROPPED_IMAGE_HEIGHT
//
3
*
2
,
CROPPED_IMAGE_WIDTH
//
7
*
3
-
2
)
cropped_positions
=
{
"leye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
elif
annotation_type
==
"right-profile"
:
# Main reference https://gitlab.idiap.ch/bob/bob.chapter.FRICE/-/blob/master/bob/chapter/FRICE/script/pose.py
EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
7
*
4
+
2
)
MOUTH_POS
=
(
CROPPED_IMAGE_HEIGHT
//
3
*
2
,
CROPPED_IMAGE_WIDTH
//
7
*
4
+
2
)
cropped_positions
=
{
"reye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
elif
annotation_type
==
"right-profile"
:
# Main reference https://gitlab.idiap.ch/bob/bob.chapter.FRICE/-/blob/master/bob/chapter/FRICE/script/pose.py
EYE_POS
=
(
CROPPED_IMAGE_HEIGHT
//
5
,
CROPPED_IMAGE_WIDTH
//
7
*
4
+
2
)
MOUTH_POS
=
(
CROPPED_IMAGE_HEIGHT
//
3
*
2
,
CROPPED_IMAGE_WIDTH
//
7
*
4
+
2
)
cropped_positions
=
{
"reye"
:
EYE_POS
,
"mouth"
:
MOUTH_POS
}
else
:
else
:
cropped_positions
=
None
cropped_positions
=
None
return
cropped_positions
return
cropped_positions
def
embedding_transformer
(
...
...
Write
Preview
Markdown
is supported
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