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
34e6ee96
Commit
34e6ee96
authored
Apr 07, 2021
by
Tiago de Freitas Pereira
Browse files
Created interface for CASIA-Africa database
Created interface for CASIA-Africa database
parent
4dc57ca0
Changes
6
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/config/database/casia_africa.py
0 → 100644
View file @
34e6ee96
from
bob.bio.face.database
import
CasiaAfricaDatabase
# In case protocol is comming from chain loading
# https://www.idiap.ch/software/bob/docs/bob/bob.extension/stable/py_api.html#bob.extension.config.load
if
"protocol"
not
in
locals
():
protocol
=
"ID-V-All-Ep1"
database
=
CasiaAfricaDatabase
(
protocol
=
protocol
)
bob/bio/face/database/__init__.py
View file @
34e6ee96
...
...
@@ -14,6 +14,7 @@ from .replaymobile import ReplayMobileBioDatabase
from
.fargo
import
FargoBioDatabase
from
.meds
import
MEDSDatabase
from
.morph
import
MorphDatabase
from
.casia_africa
import
CasiaAfricaDatabase
# gets sphinx autodoc done right - don't remove it
...
...
@@ -47,5 +48,6 @@ __appropriate__(
FargoBioDatabase
,
MEDSDatabase
,
MorphDatabase
,
CasiaAfricaDatabase
,
)
__all__
=
[
_
for
_
in
dir
()
if
not
_
.
startswith
(
"_"
)]
bob/bio/face/database/casia_africa.py
0 → 100644
View file @
34e6ee96
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
"""
CASIA-Face-Africa: database implementation
"""
from
bob.bio.base.database
import
CSVDataset
from
bob.bio.base.database
import
CSVToSampleLoaderBiometrics
from
bob.bio.face.database.sample_loaders
import
EyesAnnotations
from
bob.extension
import
rc
from
bob.extension.download
import
get_file
import
bob.io.base
from
sklearn.pipeline
import
make_pipeline
class
CasiaAfricaDatabase
(
CSVDataset
):
"""
The Casia-Face-Africa dataset is composed of 1133 identities from different ethical groups in Nigeria.
The capturing locations are:
- Dabai city in Katsina state
- Hotoro in Kano state
- Birget in Kano state
- Gandun Albasa in Kano state
- Sabon Gari inKano state
- Kano State School of Technology
These locations were strategically selected as they are known to have diverse population of local ethnicities.
.. warning::
Only 17 subjects had their images capture in two sessions.
Images were captured during daytime and night using three different cameras:
- C1: Visual Light Camera
- C2: Visual Light Camera
- C3: NIR camera
This dataset interface implemented the three verificatio protocols: "ID-V-All-Ep1", "ID-V-All-Ep2", and "ID-V-All-Ep3"
and they are organized as the following:
+------------------------------------------------------------------------------------+
| Dev. Set |
+------------------+----------------------------+------------+----------+------------+
| protocol name | Cameras (gallery/probe) | Identities | Gallery | Probes |
+==================+============================+============+==========+============+
| ID-V-All-Ep1 | C1/C2 | 1133 | 2455 | 2426 |
+------------------+----------------------------+------------+----------+------------+
| ID-V-All-Ep2 | C1/C3 | 1133 | 2455 | 1171 |
+------------------+----------------------------+------------+----------+------------+
| ID-V-All-Ep3 | C2/C3 | 1133 | 2466 | 1193 |
+------------------+----------------------------+------------+----------+------------+
.. warning::
Use the command below to set the path of the real data::
$ bob config set bob.db.casia-africa.directory [PATH-TO-MEDS-DATA]
.. code-block:: latex
@article{jawad2020,
author = {Jawad, Muhammad and Yunlong, Wang andCaiyong, Wang and Kunbo, Zhang and Zhenan, Sun},
title = {CASIA-Face-Africa: A Large-scale African Face Image Database},
journal = {IEEE Transactions on Information Forensics and Security},
pages = {},
ISSN = {},
year = {},
type = {Journal Article}
}
Example
-------
Fetching biometric references::
>>> from bob.bio.face.database import CasiaAfricaDatabase
>>> database = CasiaAfricaDatabase(protocol="ID-V-All-Ep1")
>>> database.references()
Fetching probes::
>>> from bob.bio.face.database import CasiaAfricaDatabase
>>> database = CasiaAfricaDatabase(protocol="ID-V-All-Ep1")
>>> database.probes()
Parameters
----------
protocol: str
One of the database protocols. Options are "ID-V-All-Ep1", "ID-V-All-Ep2" and "ID-V-All-Ep3"
"""
def
__init__
(
self
,
protocol
):
# Downloading model if not exists
urls
=
CasiaAfricaDatabase
.
urls
()
filename
=
get_file
(
"casia_face_africa.tar.gz"
,
urls
,
file_hash
=
"324bd69b581477d30606417be8e30d2a"
,
)
self
.
annotation_type
=
"eyes-center"
self
.
fixed_positions
=
None
directory
=
(
rc
[
"bob.db.casia-africa.directory"
]
if
rc
[
"bob.db.casia-africa.directory "
]
else
""
)
super
().
__init__
(
filename
,
protocol
,
csv_to_sample_loader
=
make_pipeline
(
CSVToSampleLoaderBiometrics
(
data_loader
=
bob
.
io
.
base
.
load
,
dataset_original_directory
=
directory
,
extension
=
".jpg"
,
reference_id_equal_subject_id
=
False
,
),
EyesAnnotations
(),
),
)
@
staticmethod
def
protocols
():
# TODO: Until we have (if we have) a function that dumps the protocols, let's use this one.
return
[
"ID-V-All-Ep1"
,
"ID-V-All-Ep2"
,
"ID-V-All-Ep3"
,
]
@
staticmethod
def
urls
():
return
[
"https://www.idiap.ch/software/bob/databases/latest/casia_face_africa.tar.gz"
,
"http://www.idiap.ch/software/bob/databases/latest/casia_face_africa.tar.gz"
,
]
bob/bio/face/test/test_databases.py
View file @
34e6ee96
...
...
@@ -23,9 +23,7 @@ import pytest
import
os
import
bob.bio.base
from
bob.bio.base.test.utils
import
db_available
from
bob.bio.base.test.test_database_implementations
import
(
check_database
,
)
from
bob.bio.base.test.test_database_implementations
import
check_database
import
bob.core
from
bob.extension.download
import
get_file
...
...
@@ -72,9 +70,9 @@ def test_arface():
try
:
check_database
(
database
,
groups
=
(
"dev"
,
"eval"
))
except
IOError
as
e
:
pytest
.
skip
(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'"
pytest
.
skip
(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'"
%
e
)
try
:
_check_annotations
(
database
)
...
...
@@ -396,3 +394,13 @@ def test_morph():
assert
len
(
database
.
references
(
group
=
"eval"
))
==
6742
assert
len
(
database
.
probes
(
group
=
"eval"
))
==
6553
def
test_casia_africa
():
from
bob.bio.face.database
import
CasiaAfricaDatabase
database
=
CasiaAfricaDatabase
(
"ID-V-All-Ep1"
)
assert
len
(
database
.
references
())
==
2455
assert
len
(
database
.
probes
())
==
2426
doc/implemented.rst
View file @
34e6ee96
...
...
@@ -13,6 +13,7 @@ Databases
.. autosummary::
bob.bio.face.database.ARFaceBioDatabase
bob.bio.face.database.AtntBioDatabase
bob.bio.face.database.CasiaAfricaDatabase
bob.bio.face.database.MobioDatabase
bob.bio.face.database.ReplayBioDatabase
bob.bio.face.database.ReplayMobileBioDatabase
...
...
setup.py
View file @
34e6ee96
...
...
@@ -112,6 +112,7 @@ setup(
"fargo = bob.bio.face.config.database.fargo:database"
,
"meds = bob.bio.face.config.database.meds:database"
,
"morph = bob.bio.face.config.database.morph:database"
,
"casia-africa = bob.bio.face.config.database.casia_africa:database"
,
],
"bob.bio.annotator"
:
[
"facedetect = bob.bio.face.config.annotator.facedetect:annotator"
,
...
...
@@ -177,6 +178,7 @@ setup(
"fargo = bob.bio.face.config.database.fargo"
,
"meds = bob.bio.face.config.database.meds"
,
"morph = bob.bio.face.config.database.morph"
,
"casia-africa = bob.bio.face.config.database.casia_africa"
,
"resnet50-msceleb-arcface-2021 = bob.bio.face.config.baseline.resnet50_msceleb_arcface_2021"
,
"resnet50-vgg2-arcface-2021 = bob.bio.face.config.baseline.resnet50_vgg2_arcface_2021"
,
"mobilenetv2-msceleb-arcface-2021 = bob.bio.face.config.baseline.mobilenetv2_msceleb_arcface_2021"
,
...
...
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