Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
f0c4dc7e
Commit
f0c4dc7e
authored
Jun 09, 2021
by
Yannick DAYER
Browse files
Simplify replay-mobile config, add urls in dataset
parent
9b1b0303
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/config/database/replaymobile.py
View file @
f0c4dc7e
...
...
@@ -4,49 +4,27 @@
"""Replay-mobile CSV database interface configuration
The Replay-Mobile Database for face spoofing consists of 1030 video clips of
photo and video attack attempts to 40 clients, under different lighting
conditions.
The Replay-Mobile Database for face spoofing consists of video clips of
photo and video attack attempts under different lighting conditions.
The vulnerability analysis pipeline uses single frames extracted from the
videos to be accepted by most face recognition systems.
Feed this file to ``bob bio pipelines`` as configuration:
Feed this file (defined as resource: ``replaymobile-img``) to ``bob bio pipelines`` as
configuration:
$ bob bio pipelines
-v -m -c
replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
vanilla-biometrics -v --write-metadata-scores
replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
-v -m -c
my_config/protocol.py replaymobile-img inception-resnetv2-msceleb
$ bob bio pipelines
vanilla-biometrics -v --write-metadata-scores
my_config/protocol.py replaymobile-img inception-resnetv2-msceleb
"""
from
bob.bio.face.database.replaymobile
import
ReplayMobileBioDatabase
from
bob.core
import
log
from
bob.extension
import
rc
logger
=
log
.
setup
(
__name__
)
default_protocol
=
"grandtest"
if
'protocol'
not
in
locals
():
logger
.
info
(
f
"protocol not specified, using default: '
{
default_protocol
}
'"
)
protocol
=
default_protocol
dataset_protocol_path
=
rc
.
get
(
"bob.db.replaymobile.dataset_protocol_path"
,
None
)
logger
.
info
(
f
"Loading protocol from '
{
dataset_protocol_path
}
'"
)
data_path
=
rc
.
get
(
"bob.db.replaymobile.directory"
,
None
)
logger
.
info
(
f
"Raw data files will be fetched from '
{
data_path
}
'"
)
data_extension
=
rc
.
get
(
"bob.db.replaymobile.extension"
,
".mov"
)
logger
.
info
(
f
"Raw data files have the '
{
data_extension
}
' extension"
)
annotations_path
=
rc
.
get
(
"bob.db.replaymobile.annotation_path"
,
None
)
logger
.
info
(
f
"Annotations files will be fetched from '
{
annotations_path
}
'"
)
logger
.
debug
(
f
"Instantiation of ReplayMobile bio database with protocol '
{
protocol
}
'"
)
database
=
ReplayMobileBioDatabase
(
protocol_definition_path
=
dataset_protocol_path
,
protocol_name
=
protocol
,
data_path
=
data_path
,
data_extension
=
data_extension
,
annotations_path
=
annotations_path
,
protocol
=
protocol
,
)
bob/bio/face/database/replaymobile.py
View file @
f0c4dc7e
...
...
@@ -204,12 +204,13 @@ class ReplayMobileBioDatabase(CSVDataset):
----------
protocol_name: str
The protocol to use
The protocol to use
. Must be a sub-folder of ``protocol_definition_path``
protocol_definition_path: str or None
Specifies a path to download the database definition to.
If None: Downloads and uses the ``bob_data_folder`` config.
Specifies a path where to fetch the database definition from.
(See :py:func:`bob.extension.download.get_file`)
If None: Downloads the file in the path from ``bob_data_folder`` config.
If None and the config does not exist: Downloads the file in ``~/bob_data``.
data_path: str or None
Overrides the config-defined data location.
...
...
@@ -217,14 +218,14 @@ class ReplayMobileBioDatabase(CSVDataset):
If None and the config does not exist, set as cwd.
annotation_path: str or None
Overrides the config-defined
annotation files locat
ion
.
If None:
uses the ``bob.db.replaymobile.annotation_directory`` config.
If None and the config does not exist, set as
``{data_path}/faceloc/rect
``.
Specifies a path where the
annotation files
are
locat
ed
.
If None:
Downloads the files to the path poited by the
``bob.db.replaymobile.annotation_directory`` config.
If None and the config does not exist: Downloads the file in ``~/bob_data
``.
"""
def
__init__
(
self
,
protocol
_name
=
"grandtest"
,
protocol
=
"grandtest"
,
protocol_definition_path
=
None
,
data_path
=
None
,
data_extension
=
".mov"
,
...
...
@@ -234,31 +235,47 @@ class ReplayMobileBioDatabase(CSVDataset):
):
if
protocol_definition_path
is
None
:
# Downloading database description files if it is not specified
name
=
"bio-face-replaymobile-img-3a584a97.tar.gz"
urls
=
[
"https://www.idiap.ch/software/bob/data
bases/latest/replay-mobile-csv.tar.gz
"
,
"http://www.idiap.ch/software/bob/data
bases/latest/replay-mobile-csv.tar.gz
"
,
f
"https://www.idiap.ch/software/bob/data
/bob/bob.bio.face/
{
name
}
"
,
f
"http://www.idiap.ch/software/bob/data
/bob/bob.bio.face/
{
name
}
"
,
]
protocol_definition_path
=
get_file
(
"replay-mobile-csv.tar.gz"
,
urls
)
protocol_definition_path
=
get_file
(
filename
=
name
,
urls
=
urls
,
cache_subdir
=
"datasets"
,
file_hash
=
"3a584a97"
)
if
data_path
is
None
:
# Defaults to cwd if config not defined
data_path
=
rc
.
get
(
"bob.db.replaymobile.directory"
,
""
)
if
data_path
==
""
:
logger
.
warning
(
"Raw data path is not configured. Please set "
"'bob.db.replaymobile.directory' with the 'bob config set' command. "
"Will now attempt with current directory."
)
if
annotations_path
is
None
:
name
=
"annotations-replaymobile-mtcnn-9cd6e452.tar.xz"
[
f
"https://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
,
f
"http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
,
]
annotations_path
=
get_file
(
name
,
[
f
"http://www.idiap.ch/software/bob/data/bob/bob.pad.face/
{
name
}
"
]
,
filename
=
name
,
urls
=
urls
,
cache_subdir
=
"annotations"
,
file_hash
=
"9cd6e452"
,
)
logger
.
info
(
f
"Database:
Loading database
definition
from
'
{
protocol_definition_path
}
'."
)
logger
.
info
(
f
"Database:
Defining
data files
path as
'
{
data_path
}
'."
)
logger
.
info
(
f
"Database:
Defining
annotation files
path as
'
{
annotations_path
}
'."
)
logger
.
info
(
f
"Database:
Will read CSV protocol
definition
s in
'
{
protocol_definition_path
}
'."
)
logger
.
info
(
f
"Database:
Will read raw
data files
in
'
{
data_path
}
'."
)
logger
.
info
(
f
"Database:
Will read
annotation files
in
'
{
annotations_path
}
'."
)
super
().
__init__
(
protocol_definition_path
,
protocol_name
,
name
=
"replaymobile-img"
,
protocol
=
protocol
,
dataset_protocol_path
=
protocol_definition_path
,
csv_to_sample_loader
=
make_pipeline
(
ReplayMobileCSVFrameSampleLoader
(
dataset_original_directory
=
data_path
,
...
...
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