Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.pad.face
Commits
81659bf9
Commit
81659bf9
authored
May 24, 2018
by
Olegs NIKISINS
Browse files
Added an option to exclude specific types of attacks from train set in BATL DB
parent
92c95a47
Pipeline
#20465
passed with stage
in 27 minutes and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/pad/face/database/batl.py
View file @
81659bf9
...
...
@@ -150,6 +150,7 @@ class BatlPadDatabase(PadDatabase):
original_extension
=
'.h5'
,
annotations_temp_dir
=
""
,
landmark_detect_method
=
"mtcnn"
,
exlude_attacks_list
=
None
,
**
kwargs
):
"""
**Parameters:**
...
...
@@ -186,6 +187,12 @@ class BatlPadDatabase(PadDatabase):
landmarks. Possible options: "dlib" or "mtcnn".
Default: ``"mtcnn"``.
``exlude_attacks_list`` : [str]
A list of strings defining which attacks should be excluded from
the training set. This shoould be handled in ``objects()`` method.
Currently handled attacks: "makeup".
Default: ``None``.
``kwargs`` : dict
The arguments of the :py:class:`bob.bio.base.database.BioDatabase`
base class constructor.
...
...
@@ -217,6 +224,7 @@ class BatlPadDatabase(PadDatabase):
self
.
original_extension
=
original_extension
self
.
annotations_temp_dir
=
annotations_temp_dir
self
.
landmark_detect_method
=
landmark_detect_method
self
.
exlude_attacks_list
=
exlude_attacks_list
@
property
def
original_directory
(
self
):
...
...
@@ -378,6 +386,11 @@ class BatlPadDatabase(PadDatabase):
The protocol is dependent on your database.
If you do not have protocols defined, just ignore this field.
``groups`` : :py:class:`str`
OR a list of strings.
The groups of which the clients should be returned.
Usually, groups are one or more elements of ('train', 'dev', 'eval')
``purposes`` : :obj:`str` or [:obj:`str`]
The purposes for which File objects should be retrieved.
Usually it is either 'real' or 'attack'.
...
...
@@ -433,7 +446,14 @@ class BatlPadDatabase(PadDatabase):
groups
=
groups
,
purposes
=
purposes
,
**
kwargs
)
if
groups
==
'train'
or
'train'
in
groups
and
len
(
groups
)
==
1
:
# exclude "makeup" case
if
self
.
exlude_attacks_list
is
not
None
and
"makeup"
in
self
.
exlude_attacks_list
:
files
=
[
f
for
f
in
files
if
os
.
path
.
split
(
f
.
path
)[
-
1
].
split
(
"_"
)[
-
2
:
-
1
][
0
]
!=
"5"
]
files
=
[
BatlPadFile
(
f
,
stream_type
,
max_frames
)
for
f
in
files
]
return
files
def
annotations
(
self
,
f
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment