Commit ffbe30af authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch 'vuln-csv' into 'master'

Vulnerability framework - CSV datasets

See merge request !106
parents bf618295 e9fbd67a
Pipeline #51429 failed with stage
in 239 minutes and 27 seconds
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Yannick Dayer <yannick.dayer@idiap.ch>
"""Replay-mobile CSV database interface configuration
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 (defined as resource: ``replaymobile-img``) to ``bob bio pipelines`` as
configuration:
$ bob bio pipelines vanilla-biometrics -v --write-metadata-scores 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
default_protocol = "grandtest"
if "protocol" not in locals():
protocol = default_protocol
database = ReplayMobileBioDatabase(
protocol=protocol,
)
#!/usr/bin/env python
from bob.bio.face.database import ReplayMobileBioDatabase
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
from bob.extension import rc
replay_mobile_directory = rc["bob.db.replay_mobile.directory"]
database = DatabaseConnector(
ReplayMobileBioDatabase(
original_directory=replay_mobile_directory,
original_extension=".mov",
protocol="grandtest-licit",
),
annotation_type="bounding-box",
fixed_positions=None,
)
#!/usr/bin/env python
from bob.bio.face.database import ReplayMobileBioDatabase
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
from bob.extension import rc
replay_mobile_directory = rc["bob.db.replay_mobile.directory"]
database = DatabaseConnector(
ReplayMobileBioDatabase(
original_directory=replay_mobile_directory,
original_extension=".mov",
protocol="grandtest-spoof",
),
annotation_type="bounding-box",
fixed_positions=None,
# Only compare with spoofs from the same target identity
allow_scoring_with_all_biometric_references=False,
)
This diff is collapsed.
......@@ -26,6 +26,7 @@ from bob.bio.base.test.utils import db_available
from bob.bio.base.test.test_database_implementations import check_database
import bob.core
from bob.extension.download import get_file
from nose.plugins.skip import SkipTest
logger = bob.core.log.setup("bob.bio.face")
......@@ -271,46 +272,36 @@ def test_replay_spoof():
)
@db_available("replaymobile")
def test_replaymobile_licit():
def test_replaymobile():
database = bob.bio.base.load_resource(
"replaymobile-img-licit", "database", preferred_package="bob.bio.face"
"replaymobile-img", "database", preferred_package="bob.bio.face"
)
samples = database.all_samples(groups=("dev", "eval"))
assert len(samples) == 8300, len(samples)
sample = samples[0]
assert hasattr(sample, "annotations")
assert "reye" in sample.annotations
assert "leye" in sample.annotations
assert hasattr(sample, "path")
assert hasattr(sample, "frame")
assert len(database.references()) == 16
assert len(database.references(group="eval")) == 12
assert len(database.probes()) == 4160
assert len(database.probes(group="eval")) == 3020
try:
check_database(database, groups=("dev", "eval"))
except IOError as e:
pytest.skip(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
% e
)
try:
_check_annotations(database, topleft=True, limit_files=20)
except IOError as e:
pytest.skip(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'"
% e
)
@db_available("replaymobile")
def test_replaymobile_spoof():
database = bob.bio.base.load_resource(
"replaymobile-img-spoof", "database", preferred_package="bob.bio.face"
)
try:
check_database(database, groups=("dev", "eval"))
except IOError as e:
pytest.skip(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'"
% e
)
try:
_check_annotations(database, topleft=True, limit_files=20)
except IOError as e:
pytest.skip(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'"
% e
)
assert sample.annotations == {
"bottomright": [785, 395],
"topleft": [475, 167],
"leye": [587, 336],
"reye": [588, 238],
"mouthleft": [705, 252],
"mouthright": [706, 326],
"nose": [643, 295],
}
assert sample.data.shape == (3, 1280, 720)
assert sample.data[0, 0, 0] == 87
except RuntimeError as e:
raise SkipTest(e)
def test_ijbc():
......
......@@ -26,6 +26,7 @@ requirements:
- bob.core
- bob.io.base
- bob.io.image
- bob.io.video
- bob.math
- bob.sp
- bob.ip.base
......
......@@ -105,10 +105,7 @@ setup(
"mobio-all = bob.bio.face.config.database.mobio_all:database",
"multipie = bob.bio.face.config.database.multipie:database",
"multipie-pose = bob.bio.face.config.database.multipie_pose:database",
"replay-img-licit = bob.bio.face.config.database.replay:replay_licit",
"replay-img-spoof = bob.bio.face.config.database.replay:replay_spoof",
"replaymobile-img-licit = bob.bio.face.config.database.replaymobile:replaymobile_licit",
"replaymobile-img-spoof = bob.bio.face.config.database.replaymobile:replaymobile_spoof",
"replaymobile-img = bob.bio.face.config.database.replaymobile:database",
"fargo = bob.bio.face.config.database.fargo:database",
"meds = bob.bio.face.config.database.meds:database",
"morph = bob.bio.face.config.database.morph:database",
......@@ -173,10 +170,7 @@ setup(
"mobio-all = bob.bio.face.config.database.mobio_all",
"multipie = bob.bio.face.config.database.multipie",
"multipie-pose = bob.bio.face.config.database.multipie_pose",
"replay-img-licit = bob.bio.face.config.database.replay_licit",
"replay-img-spoof = bob.bio.face.config.database.replay_spoof",
"replaymobile-img-licit = bob.bio.face.config.database.replaymobile_licit",
"replaymobile-img-spoof = bob.bio.face.config.database.replaymobile_spoof",
"replaymobile-img = bob.bio.face.config.database.replaymobile",
"fargo = bob.bio.face.config.database.fargo",
"meds = bob.bio.face.config.database.meds",
"morph = bob.bio.face.config.database.morph",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment