Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.face
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pad.face
Commits
608e03dd
Commit
608e03dd
authored
6 years ago
by
Anjith GEORGE
Browse files
Options
Downloads
Patches
Plain Diff
Added LOO protocols in BATL DB
parent
3e3b04a9
No related branches found
No related tags found
1 merge request
!86
Batl loo protocols
Pipeline
#26454
passed
6 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/pad/face/database/batl.py
+106
-1
106 additions, 1 deletion
bob/pad/face/database/batl.py
bob/pad/face/lists/batl/idiap_converter_v2.json
+1
-0
1 addition, 0 deletions
bob/pad/face/lists/batl/idiap_converter_v2.json
with
107 additions
and
1 deletion
bob/pad/face/database/batl.py
+
106
−
1
View file @
608e03dd
...
@@ -286,6 +286,16 @@ class BatlPadDatabase(PadDatabase):
...
@@ -286,6 +286,16 @@ class BatlPadDatabase(PadDatabase):
self
.
append_color_face_roi_annot
=
append_color_face_roi_annot
self
.
append_color_face_roi_annot
=
append_color_face_roi_annot
#map file to identify attack grouping
map_file
=
pkg_resources
.
resource_filename
(
'
bob.pad.face
'
,
'
lists/batl/idiap_converter_v2.json
'
)
with
open
(
map_file
,
'
r
'
)
as
fp
:
map_dict
=
json
.
load
(
fp
)
self
.
map_dict
=
map_dict
@property
@property
def
original_directory
(
self
):
def
original_directory
(
self
):
return
self
.
db
.
original_directory
return
self
.
db
.
original_directory
...
@@ -295,6 +305,59 @@ class BatlPadDatabase(PadDatabase):
...
@@ -295,6 +305,59 @@ class BatlPadDatabase(PadDatabase):
def
original_directory
(
self
,
value
):
def
original_directory
(
self
,
value
):
self
.
db
.
original_directory
=
value
self
.
db
.
original_directory
=
value
def
unseen_attack_list_maker
(
self
,
files
,
unknown_attack
,
train
=
True
):
"""
Selects and returns a list of files for Leave One Out (LOO) protocols.
This utilizes the original partitioning in the `grandtest` protocol and subselects
the file list such that the specified `unknown_attack` is removed from both `train` and `dev` sets.
The `test` set will consist of only the selected `unknown_attack` and `bonafide` files.
**Parameters:**
``files`` : pyclass::list
A list of files, db.objects()
``unknown_attack`` : str
The unknown attack protocol name example:
'
rigidmask
'
.
``train`` : bool
Denotes whether files are from training or development partition
**Returns:**
``mod_files`` : pyclass::list
A list of files selected for the protocol
"""
mod_files
=
[]
for
file
in
files
:
attack_category
=
self
.
map_dict
[
"
_
"
+
"
_
"
.
join
(
os
.
path
.
split
(
file
.
path
)[
-
1
].
split
(
"
_
"
)[
-
2
:])].
split
(
"
_
"
)[
-
1
]
if
train
:
if
attack_category
==
unknown_attack
:
pass
else
:
mod_files
.
append
(
file
)
# everything except the attack specified is there
if
not
train
:
if
attack_category
==
unknown_attack
or
attack_category
==
'
bonafide
'
:
mod_files
.
append
(
file
)
# only the attack mentioned and bonafides in testing
else
:
pass
return
mod_files
def
parse_protocol
(
self
,
protocol
):
def
parse_protocol
(
self
,
protocol
):
"""
"""
...
@@ -329,7 +392,7 @@ class BatlPadDatabase(PadDatabase):
...
@@ -329,7 +392,7 @@ class BatlPadDatabase(PadDatabase):
forming a single training set.
forming a single training set.
"""
"""
possible_extras
=
[
'
join_train_dev
'
]
possible_extras
=
[
'
join_train_dev
'
,
'
LOO_fakehead
'
,
'
LOO_flexiblemask
'
,
'
LOO_glasses
'
,
'
LOO_papermask
'
,
'
LOO_prints
'
,
'
LOO_replay
'
,
'
LOO_rigidmask
'
,
'
LOO_makeup
'
]
components
=
protocol
.
split
(
"
-
"
)
components
=
protocol
.
split
(
"
-
"
)
...
@@ -515,6 +578,48 @@ class BatlPadDatabase(PadDatabase):
...
@@ -515,6 +578,48 @@ class BatlPadDatabase(PadDatabase):
groups
=
[
'
test
'
],
groups
=
[
'
test
'
],
purposes
=
purposes
,
**
kwargs
)
purposes
=
purposes
,
**
kwargs
)
# for the LOO protocols
elif
extra
is
not
None
and
"
LOO_
"
in
extra
:
batl_files
=
[]
unknown_attack
=
extra
.
split
(
"
_
"
)[
-
1
]
if
'
train
'
in
groups
:
tbatl_files
=
self
.
db
.
objects
(
protocol
=
protocol
,
groups
=
[
'
train
'
],
purposes
=
purposes
,
**
kwargs
)
tbatl_files
=
self
.
unseen_attack_list_maker
(
tbatl_files
,
unknown_attack
,
train
=
True
)
batl_files
=
batl_files
+
tbatl_files
if
'
validation
'
in
groups
:
tbatl_files
=
self
.
db
.
objects
(
protocol
=
protocol
,
groups
=
[
'
validation
'
],
purposes
=
purposes
,
**
kwargs
)
tbatl_files
=
self
.
unseen_attack_list_maker
(
tbatl_files
,
unknown_attack
,
train
=
True
)
batl_files
=
batl_files
+
tbatl_files
if
'
test
'
in
groups
:
tbatl_files
=
self
.
db
.
objects
(
protocol
=
protocol
,
groups
=
[
'
test
'
],
purposes
=
purposes
,
**
kwargs
)
tbatl_files
=
self
.
unseen_attack_list_maker
(
tbatl_files
,
unknown_attack
,
train
=
False
)
batl_files
=
batl_files
+
tbatl_files
files
=
batl_files
else
:
else
:
# files = self._fix_funny_eyes_in_objects(protocol=protocol,
# files = self._fix_funny_eyes_in_objects(protocol=protocol,
# groups=groups,
# groups=groups,
...
...
This diff is collapsed.
Click to expand it.
bob/pad/face/lists/batl/idiap_converter_v2.json
0 → 100644
+
1
−
0
View file @
608e03dd
{
"_0_00"
:
"Unknown_bonafide"
,
"_0_01"
:
"Clientownmedicalglasse_bonafide"
,
"_0_02"
:
"UnisexglassesG01_bonafide"
,
"_1_01"
:
"FunnyeyesglassesG02_glasses"
,
"_1_02"
:
"PlastichalloweenmaskB082200_rigidmask"
,
"_1_03"
:
"unassigne_glasses"
,
"_1_04"
:
"FunnyeyesglassesG03_glasses"
,
"_1_05"
:
"FunnyeyesglassesG04_glasses"
,
"_1_06"
:
"FunnyeyesglassesG05_glasses"
,
"_1_07"
:
"FunnyeyesglassesG06_glasses"
,
"_1_13"
:
"ExoticfemailtransparentmaskB0853200_rigidmask"
,
"_1_14"
:
"ExoticfemailtransparentmaskwithmakeupB082301_rigidmask"
,
"_1_15"
:
"PaperglassesG10_glasses"
,
"_1_16"
:
"PaperglassesG11_glasses"
,
"_2_01"
:
"MannequinMq07_fakehead"
,
"_2_02"
:
"MannequinMq01_fakehead"
,
"_2_03"
:
"MannequinMq02_fakehead"
,
"_2_04"
:
"MannequinMq03_fakehead"
,
"_2_05"
:
"MannequinMq04_fakehead"
,
"_2_06"
:
"MannequinMq05_fakehead"
,
"_2_07"
:
"MannequinMq06_fakehead"
,
"_2_08"
:
"PapercraftmaskB030100_papermask"
,
"_2_09"
:
"PapercraftmaskB030300_papermask"
,
"_2_10"
:
"PapercraftmaskB031100_papermask"
,
"_2_11"
:
"PapercraftmaskB031200_papermask"
,
"_2_12"
:
"CustomwearablemaskB050100_rigidmask"
,
"_2_13"
:
"CustomwearablemaskB050200_rigidmask"
,
"_2_14"
:
"CustomwearablemaskB051200_rigidmask"
,
"_2_15"
:
"CustomwearablemaskB051600_rigidmask"
,
"_2_16"
:
"CustomwearablemaskB051800_rigidmask"
,
"_2_17"
:
"CustomwearablemaskB051900_rigidmask"
,
"_2_18"
:
"FlexiblesiliconmaskB072100_flexiblemask"
,
"_2_75"
:
"FlexiblesiliconmaskB063000_flexiblemask"
,
"_2_76"
:
"FlexiblesiliconmaskB063100_flexiblemask"
,
"_2_77"
:
"FlexiblesiliconmaskB073200_flexiblemask"
,
"_2_78"
:
"FlexiblesiliconmaskB073300_flexiblemask"
,
"_2_79"
:
"FlexiblesiliconmaskB073400_flexiblemask"
,
"_2_80"
:
"FlexiblesiliconmaskB060100_flexiblemask"
,
"_2_81"
:
"FlexiblesiliconmaskB060200_flexiblemask"
,
"_2_82"
:
"FlexiblesiliconmaskB060202_flexiblemask"
,
"_2_83"
:
"FlexiblesiliconmaskB061200_flexiblemask"
,
"_2_84"
:
"FlexiblesiliconmaskB062400_flexiblemask"
,
"_2_85"
:
"FlexiblesiliconmaskB061600_flexiblemask"
,
"_2_86"
:
"FlexiblesiliconmaskB061800_flexiblemask"
,
"_2_87"
:
"FlexiblesiliconmaskB061900_flexiblemask"
,
"_2_88"
:
"FlexiblesiliconmaskB070100_flexiblemask"
,
"_2_89"
:
"FlexiblesiliconmaskB071200_flexiblemask"
,
"_2_90"
:
"FlexiblesiliconmaskB071900_flexiblemask"
,
"_2_91"
:
"FlexiblesiliconmaskB062500_flexiblemask"
,
"_2_92"
:
"FlexiblesiliconmaskB062601_flexiblemask"
,
"_2_93"
:
"FlexiblesiliconmaskB072701_flexiblemask"
,
"_2_94"
:
"FlexiblesiliconmaskB072801_flexiblemask"
,
"_2_95"
:
"FlexiblesiliconmaskB072901_flexiblemask"
,
"_2_96"
:
"FlexiblesiliconmaskB062600_flexiblemask"
,
"_2_97"
:
"FlexiblesiliconmaskB072700_flexiblemask"
,
"_2_98"
:
"FlexiblesiliconmaskB072800_flexiblemask"
,
"_2_99"
:
"FlexiblesiliconmaskB072900_flexiblemask"
,
"_3_01"
:
"PrintedP0000100_prints"
,
"_3_02"
:
"PrintedP0000101_prints"
,
"_3_03"
:
"PrintedP0000102_prints"
,
"_3_04"
:
"PrintedP0000103_prints"
,
"_3_05"
:
"ElectronicP0100100_replay"
,
"_3_06"
:
"PrintedP0001800_prints"
,
"_3_07"
:
"PrintedP0001801_prints"
,
"_3_08"
:
"PrintedP0001802_prints"
,
"_3_09"
:
"PrintedP0001803_prints"
,
"_3_10"
:
"ElectronicP0101800_replay"
,
"_3_11"
:
"PrintedP0009800_prints"
,
"_3_12"
:
"PrintedP0009801_prints"
,
"_3_13"
:
"PrintedP0009802_prints"
,
"_3_14"
:
"PrintedP0009803_prints"
,
"_3_15"
:
"ElectronicP0109800_replay"
,
"_4_01"
:
"VideoplayV0001900_replay"
,
"_4_02"
:
"VideopauseV0101900_replay"
,
"_4_03"
:
"VideoplayV0001200_replay"
,
"_4_04"
:
"VideopauseV0101200_replay"
,
"_4_05"
:
"VideoplayV0009800_replay"
,
"_4_06"
:
"VideopauseV0109800_replay"
,
"_4_07"
:
"VideoplayV0001901_replay"
,
"_4_08"
:
"VideopauseV0101901_replay"
,
"_4_09"
:
"VideoplayV0000501_replay"
,
"_4_10"
:
"VideopauseV0100501_replay"
,
"_4_11"
:
"VideoplayV0009801_replay"
,
"_4_12"
:
"VideopauseV0109801_replay"
,
"_4_13"
:
"VideoplayV0101902_replay"
,
"_4_14"
:
"VideopauseV0101902_replay"
,
"_4_15"
:
"VideoplayV0101202_replay"
,
"_4_16"
:
"VideopauseV0101202_replay"
,
"_4_17"
:
"VideoplayV0109802_replay"
,
"_4_18"
:
"VideopauseV0109802_replay"
,
"_5_01"
:
"Makeup_makeup"
,
"_5_02"
:
"Makeup_makeup"
,
"_5_03"
:
"Makeup_makeup"
,
"_5_04"
:
"Makeup_makeup"
,
"_5_05"
:
"Makeup_makeup"
,
"_5_06"
:
"Makeup_makeup"
,
"_5_07"
:
"Makeup_makeup"
,
"_5_08"
:
"Makeup_makeup"
,
"_5_09"
:
"Makeup_makeup"
,
"_5_10"
:
"Makeup_makeup"
,
"_5_100"
:
"Makeup_makeup"
,
"_5_101"
:
"Makeup_makeup"
,
"_5_102"
:
"Makeup_makeup"
,
"_5_103"
:
"Makeup_makeup"
,
"_5_104"
:
"Makeup_makeup"
,
"_5_105"
:
"Makeup_makeup"
,
"_5_106"
:
"Makeup_makeup"
,
"_5_107"
:
"Makeup_makeup"
,
"_5_108"
:
"Makeup_makeup"
,
"_5_109"
:
"Makeup_makeup"
,
"_5_11"
:
"Makeup_makeup"
,
"_5_110"
:
"Makeup_makeup"
,
"_5_111"
:
"Makeup_makeup"
,
"_5_112"
:
"Makeup_makeup"
,
"_5_113"
:
"Makeup_makeup"
,
"_5_114"
:
"Makeup_makeup"
,
"_5_115"
:
"Makeup_makeup"
,
"_5_116"
:
"Makeup_makeup"
,
"_5_117"
:
"Makeup_makeup"
,
"_5_118"
:
"Makeup_makeup"
,
"_5_119"
:
"Makeup_makeup"
,
"_5_12"
:
"Makeup_makeup"
,
"_5_120"
:
"Makeup_makeup"
,
"_5_121"
:
"Makeup_makeup"
,
"_5_122"
:
"Makeup_makeup"
,
"_5_123"
:
"Makeup_makeup"
,
"_5_124"
:
"Makeup_makeup"
,
"_5_125"
:
"Makeup_makeup"
,
"_5_126"
:
"Makeup_makeup"
,
"_5_127"
:
"Makeup_makeup"
,
"_5_128"
:
"Makeup_makeup"
,
"_5_129"
:
"Makeup_makeup"
,
"_5_13"
:
"Makeup_makeup"
,
"_5_130"
:
"Makeup_makeup"
,
"_5_131"
:
"Makeup_makeup"
,
"_5_132"
:
"Makeup_makeup"
,
"_5_133"
:
"Makeup_makeup"
,
"_5_134"
:
"Makeup_makeup"
,
"_5_135"
:
"Makeup_makeup"
,
"_5_136"
:
"Makeup_makeup"
,
"_5_137"
:
"Makeup_makeup"
,
"_5_138"
:
"Makeup_makeup"
,
"_5_139"
:
"Makeup_makeup"
,
"_5_14"
:
"Makeup_makeup"
,
"_5_15"
:
"Makeup_makeup"
,
"_5_16"
:
"Makeup_makeup"
,
"_5_17"
:
"Makeup_makeup"
,
"_5_18"
:
"Makeup_makeup"
,
"_5_19"
:
"Makeup_makeup"
,
"_5_20"
:
"Makeup_makeup"
,
"_5_21"
:
"Makeup_makeup"
,
"_5_22"
:
"Makeup_makeup"
,
"_5_23"
:
"Makeup_makeup"
,
"_5_24"
:
"Makeup_makeup"
,
"_5_25"
:
"Makeup_makeup"
,
"_5_26"
:
"Makeup_makeup"
,
"_5_27"
:
"Makeup_makeup"
,
"_5_28"
:
"Makeup_makeup"
,
"_5_29"
:
"Makeup_makeup"
,
"_5_30"
:
"Makeup_makeup"
,
"_5_31"
:
"Makeup_makeup"
,
"_5_32"
:
"Makeup_makeup"
,
"_5_33"
:
"Makeup_makeup"
,
"_5_34"
:
"Makeup_makeup"
,
"_5_35"
:
"Makeup_makeup"
,
"_5_36"
:
"Makeup_makeup"
,
"_5_37"
:
"Makeup_makeup"
,
"_5_38"
:
"Makeup_makeup"
,
"_5_39"
:
"Makeup_makeup"
,
"_5_40"
:
"Makeup_makeup"
,
"_5_41"
:
"Makeup_makeup"
,
"_5_42"
:
"Makeup_makeup"
,
"_5_43"
:
"Makeup_makeup"
,
"_5_44"
:
"Makeup_makeup"
,
"_5_45"
:
"Makeup_makeup"
,
"_5_46"
:
"Makeup_makeup"
,
"_5_47"
:
"Makeup_makeup"
,
"_5_48"
:
"Makeup_makeup"
,
"_5_49"
:
"Makeup_makeup"
,
"_5_50"
:
"Makeup_makeup"
,
"_5_51"
:
"Makeup_makeup"
,
"_5_52"
:
"Makeup_makeup"
,
"_5_53"
:
"Makeup_makeup"
,
"_5_54"
:
"Makeup_makeup"
,
"_5_55"
:
"Makeup_makeup"
,
"_5_56"
:
"Makeup_makeup"
,
"_5_57"
:
"Makeup_makeup"
,
"_5_58"
:
"Makeup_makeup"
,
"_5_59"
:
"Makeup_makeup"
,
"_5_60"
:
"Makeup_makeup"
,
"_5_61"
:
"Makeup_makeup"
,
"_5_62"
:
"Makeup_makeup"
,
"_5_63"
:
"Makeup_makeup"
,
"_5_64"
:
"Makeup_makeup"
,
"_5_65"
:
"Makeup_makeup"
,
"_5_66"
:
"Makeup_makeup"
,
"_5_67"
:
"Makeup_makeup"
,
"_5_68"
:
"Makeup_makeup"
,
"_5_69"
:
"Makeup_makeup"
,
"_5_70"
:
"Makeup_makeup"
,
"_5_71"
:
"Makeup_makeup"
,
"_5_72"
:
"Makeup_makeup"
,
"_5_73"
:
"Makeup_makeup"
,
"_5_74"
:
"Makeup_makeup"
,
"_5_75"
:
"Makeup_makeup"
,
"_5_76"
:
"Makeup_makeup"
,
"_5_77"
:
"Makeup_makeup"
,
"_5_78"
:
"Makeup_makeup"
,
"_5_79"
:
"Makeup_makeup"
,
"_5_80"
:
"Makeup_makeup"
,
"_5_81"
:
"Makeup_makeup"
,
"_5_82"
:
"Makeup_makeup"
,
"_5_83"
:
"Makeup_makeup"
,
"_5_84"
:
"Makeup_makeup"
,
"_5_85"
:
"Makeup_makeup"
,
"_5_86"
:
"Makeup_makeup"
,
"_5_87"
:
"Makeup_makeup"
,
"_5_88"
:
"Makeup_makeup"
,
"_5_89"
:
"Makeup_makeup"
,
"_5_90"
:
"Makeup_makeup"
,
"_5_91"
:
"Makeup_makeup"
,
"_5_92"
:
"Makeup_makeup"
,
"_5_93"
:
"Makeup_makeup"
,
"_5_94"
:
"Makeup_makeup"
,
"_5_95"
:
"Makeup_makeup"
,
"_5_96"
:
"Makeup_makeup"
,
"_5_97"
:
"Makeup_makeup"
,
"_5_98"
:
"Makeup_makeup"
,
"_5_99"
:
"Makeup_makeup"
,
"_1_08"
:
"Wig"
,
"_1_09"
:
"Wig"
,
"_1_10"
:
"Wig"
,
"_1_11"
:
"Wig"
,
"_1_12"
:
"Wig"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment