Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.fusion.base
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Code
Merge requests
0
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.fusion.base
Commits
49c978b9
Commit
49c978b9
authored
6 years ago
by
Pavel KORSHUNOV
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up and reused
parent
6c7fa915
Branches
bio-pad
No related tags found
1 merge request
!1
WIP: Support for cascade fusion of PAD and Bio
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/fusion/base/script/bob_fuse.py
+23
-40
23 additions, 40 deletions
bob/fusion/base/script/bob_fuse.py
bob/fusion/base/script/bob_fuse_several_systems.py
+0
-0
0 additions, 0 deletions
bob/fusion/base/script/bob_fuse_several_systems.py
with
23 additions
and
40 deletions
bob/fusion/base/script/bob_fuse.py
+
23
−
40
View file @
49c978b9
...
...
@@ -17,6 +17,23 @@ import bob.core
logger
=
bob
.
core
.
log
.
setup
(
"
bob.fusion.base
"
)
def
fuse_and_dump_for_group
(
algorithm
,
group_file_name
,
preprocess_only
,
group_files
,
score_lines_list
,
idx1
,
nans
,
scores
,
gen
,
zei
):
score_lines
=
score_lines_list
[
idx1
][
~
nans
]
if
preprocess_only
and
len
(
group_files
)
==
1
:
score_lines
[
'
score
'
]
=
np
.
reshape
(
scores
,
scores
.
shape
[
0
])
else
:
fused_scores_train
=
algorithm
.
fuse
(
scores
)
score_lines
[
'
score
'
]
=
fused_scores_train
create_directories_safe
(
os
.
path
.
dirname
(
group_file_name
))
dump_score
(
group_file_name
,
score_lines
)
# to separate scores for licit and spoof scenarios
start_zei
=
len
(
gen
[
0
])
start_atk
=
start_zei
+
len
(
zei
[
0
])
dump_score
(
group_file_name
+
'
-licit
'
,
score_lines
[
0
:
start_atk
])
dump_score
(
group_file_name
+
'
-spoof
'
,
np
.
append
(
score_lines
[
0
:
start_zei
],
score_lines
[
start_atk
:
-
1
]))
def
fuse
(
args
,
command_line_parameters
):
"""
Do the actual fusion.
"""
algorithm
=
args
.
algorithm
...
...
@@ -118,38 +135,15 @@ def fuse(args, command_line_parameters):
logger
.
info
(
"
- Fusion: scores
'
%s
'
already exists.
"
,
args
.
fused_train_file
)
elif
args
.
train_files
:
score_lines
=
score_lines_list_train
[
idx1
][
~
nan_train
]
if
args
.
preprocess_only
and
len
(
args
.
train_files
)
==
1
:
score_lines
[
'
score
'
]
=
np
.
reshape
(
scores_train
,
scores_train
.
shape
[
0
])
else
:
fused_scores_train
=
algorithm
.
fuse
(
scores_train
)
score_lines
[
'
score
'
]
=
fused_scores_train
create_directories_safe
(
os
.
path
.
dirname
(
args
.
fused_train_file
))
dump_score
(
args
.
fused_train_file
,
score_lines
)
# to separate scores for licit and spoof scenarios
start_zei
=
len
(
gen_lt
[
0
])
start_atk
=
start_zei
+
len
(
zei_lt
[
0
])
dump_score
(
args
.
fused_train_file
+
'
-licit
'
,
score_lines
[
0
:
start_atk
])
dump_score
(
args
.
fused_train_file
+
'
-spoof
'
,
np
.
append
(
score_lines
[
0
:
start_zei
],
score_lines
[
start_atk
:
-
1
]))
fuse_and_dump_for_group
(
algorithm
,
args
.
fused_train_file
,
args
.
preprocess_only
,
args
.
train_files
,
score_lines_list_train
,
idx1
,
nan_train
,
scores_train
,
gen_lt
,
zei_lt
)
# fuse the scores (dev)
if
utils
.
check_file
(
args
.
fused_dev_file
,
args
.
force
,
1000
):
logger
.
info
(
"
- Fusion: scores
'
%s
'
already exists.
"
,
args
.
fused_dev_file
)
elif
args
.
dev_files
:
score_lines
=
score_lines_list_dev
[
idx1
][
~
nan_dev
]
if
args
.
preprocess_only
and
len
(
args
.
dev_files
)
==
1
:
score_lines
[
'
score
'
]
=
np
.
reshape
(
scores_dev
,
scores_dev
.
shape
[
0
])
else
:
fused_scores_dev
=
algorithm
.
fuse
(
scores_dev
)
score_lines
[
'
score
'
]
=
fused_scores_dev
create_directories_safe
(
os
.
path
.
dirname
(
args
.
fused_dev_file
))
dump_score
(
args
.
fused_dev_file
,
score_lines
)
# to separate scores for licit and spoof scenarios
start_zei
=
len
(
gen_ld
[
0
])
start_atk
=
start_zei
+
len
(
zei_ld
[
0
])
dump_score
(
args
.
fused_dev_file
+
'
-licit
'
,
score_lines
[
0
:
start_atk
])
dump_score
(
args
.
fused_dev_file
+
'
-spoof
'
,
np
.
append
(
score_lines
[
0
:
start_zei
],
score_lines
[
start_atk
:
-
1
]))
fuse_and_dump_for_group
(
algorithm
,
args
.
fused_dev_file
,
args
.
preprocess_only
,
args
.
dev_files
,
score_lines_list_dev
,
idx1
,
nan_dev
,
scores_dev
,
gen_ld
,
zei_ld
)
# fuse the scores (eval)
if
args
.
eval_files
:
...
...
@@ -157,19 +151,8 @@ def fuse(args, command_line_parameters):
logger
.
info
(
"
- Fusion: scores
'
%s
'
already exists.
"
,
args
.
fused_eval_file
)
else
:
score_lines
=
score_lines_list_eval
[
idx1
][
~
nan_eval
]
if
args
.
preprocess_only
and
len
(
args
.
eval_files
)
==
1
:
score_lines
[
'
score
'
]
=
np
.
reshape
(
scores_eval
,
scores_eval
.
shape
[
0
])
else
:
fused_scores_eval
=
algorithm
.
fuse
(
scores_eval
)
score_lines
[
'
score
'
]
=
fused_scores_eval
create_directories_safe
(
os
.
path
.
dirname
(
args
.
fused_eval_file
))
dump_score
(
args
.
fused_eval_file
,
score_lines
)
# to separate scores for licit and spoof scenarios
start_zei
=
len
(
gen_le
[
0
])
start_atk
=
start_zei
+
len
(
zei_le
[
0
])
dump_score
(
args
.
fused_eval_file
+
'
-licit
'
,
score_lines
[
0
:
start_atk
])
dump_score
(
args
.
fused_eval_file
+
'
-spoof
'
,
np
.
append
(
score_lines
[
0
:
start_zei
],
score_lines
[
start_atk
:
-
1
]))
fuse_and_dump_for_group
(
algorithm
,
args
.
fused_eval_file
,
args
.
preprocess_only
,
args
.
eval_files
,
score_lines_list_eval
,
idx1
,
nan_eval
,
scores_eval
,
gen_le
,
zei_le
)
def
main
(
command_line_parameters
=
None
):
...
...
This diff is collapsed.
Click to expand it.
bob/fusion/base/script/fuse_several_systems.py
→
bob/fusion/base/script/
bob_
fuse_several_systems.py
+
0
−
0
View file @
49c978b9
File moved
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