Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.example.faceverify
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
Model registry
Operate
Environments
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.example.faceverify
Commits
34316800
Commit
34316800
authored
10 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Improved python3 compatibility of examples.
parent
ae14764a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/example/faceverify/dct_ubm.py
+5
-5
5 additions, 5 deletions
bob/example/faceverify/dct_ubm.py
bob/example/faceverify/eigenface.py
+5
-5
5 additions, 5 deletions
bob/example/faceverify/eigenface.py
bob/example/faceverify/gabor_graph.py
+5
-5
5 additions, 5 deletions
bob/example/faceverify/gabor_graph.py
with
15 additions
and
15 deletions
bob/example/faceverify/dct_ubm.py
+
5
−
5
View file @
34316800
...
...
@@ -157,7 +157,7 @@ def main():
print
(
"
Extracting training features
"
)
training_features
=
{}
for
key
,
image
in
training_images
.
iter
items
():
for
key
,
image
in
training_images
.
items
():
training_features
[
key
]
=
extract_feature
(
image
)
print
(
"
Training UBM model
"
)
...
...
@@ -178,7 +178,7 @@ def main():
model_images
=
load_images
(
atnt_db
,
group
=
'
dev
'
,
purpose
=
'
enrol
'
,
client_id
=
model_id
,
database_directory
=
image_directory
)
models_for_current_id
=
{}
# extract model features
for
key
,
image
in
model_images
.
iter
items
():
for
key
,
image
in
model_images
.
items
():
models_for_current_id
[
key
]
=
extract_feature
(
image
)
# enroll model for the current identity from these features
model
=
enroll
(
models_for_current_id
,
ubm
,
gmm_trainer
)
...
...
@@ -190,7 +190,7 @@ def main():
print
(
"
Computing probe statistics
"
)
probe_images
=
load_images
(
atnt_db
,
group
=
'
dev
'
,
purpose
=
'
probe
'
,
database_directory
=
image_directory
)
probes
=
{}
for
key
,
image
in
probe_images
.
iter
items
():
for
key
,
image
in
probe_images
.
items
():
# extract probe features
probe_feature
=
extract_feature
(
image
)
# compute GMM statistics
...
...
@@ -205,8 +205,8 @@ def main():
distance_function
=
bob
.
learn
.
misc
.
linear_scoring
# iterate through models and probes and compute scores
for
model_id
,
model_gmm
in
models
.
iter
items
():
for
probe_key
,
probe_stats
in
probes
.
iter
items
():
for
model_id
,
model_gmm
in
models
.
items
():
for
probe_key
,
probe_stats
in
probes
.
items
():
# compute score
score
=
distance_function
([
model_gmm
],
ubm
,
[
probe_stats
])[
0
,
0
]
...
...
This diff is collapsed.
Click to expand it.
bob/example/faceverify/eigenface.py
+
5
−
5
View file @
34316800
...
...
@@ -109,21 +109,21 @@ def main():
print
(
"
Extracting models
"
)
model_features
=
{}
for
key
,
image
in
model_images
.
iter
items
():
for
key
,
image
in
model_images
.
items
():
model_features
[
key
]
=
extract_feature
(
image
,
pca_machine
)
# enroll models from 5 features by simply storing all features
model_ids
=
[
client
.
id
for
client
in
atnt_db
.
clients
(
groups
=
'
dev
'
)]
models
=
dict
((
model_id
,
[])
for
model_id
in
model_ids
)
# note: py26 compat.
# iterate over model features
for
file_id
,
image
in
model_features
.
iter
items
():
for
file_id
,
image
in
model_features
.
items
():
model_id
=
atnt_db
.
get_client_id_from_file_id
(
file_id
)
# "enroll" model by collecting all model features of this client
models
[
model_id
].
append
(
model_features
[
key
])
print
(
"
Extracting probes
"
)
probe_features
=
{}
for
key
,
image
in
probe_images
.
iter
items
():
for
key
,
image
in
probe_images
.
items
():
probe_features
[
key
]
=
extract_feature
(
image
,
pca_machine
)
...
...
@@ -135,8 +135,8 @@ def main():
print
(
"
Computing scores
"
)
# iterate through models and probes and compute scores
for
model_id
,
model
in
models
.
iter
items
():
for
probe_key
,
probe_feature
in
probe_features
.
iter
items
():
for
model_id
,
model
in
models
.
items
():
for
probe_key
,
probe_feature
in
probe_features
.
items
():
# compute scores for all model features
scores
=
[
-
DISTANCE_FUNCTION
(
model_feature
,
probe_feature
)
for
model_feature
in
model
]
# the final score is the minimum distance (i.e., the maximum negative distance)
...
...
This diff is collapsed.
Click to expand it.
bob/example/faceverify/gabor_graph.py
+
5
−
5
View file @
34316800
...
...
@@ -106,21 +106,21 @@ def main():
print
(
"
Extracting models
"
)
model_features
=
{}
for
key
,
image
in
model_images
.
iter
items
():
for
key
,
image
in
model_images
.
items
():
model_features
[
key
]
=
extract_feature
(
image
,
graph_machine
)
# enroll models from 5 features by simply storing all features
model_ids
=
[
client
.
id
for
client
in
atnt_db
.
clients
(
groups
=
'
dev
'
)]
models
=
dict
((
model_id
,
[])
for
model_id
in
model_ids
)
# note: py26 compat.
# iterate over model features
for
key
,
image
in
model_features
.
iter
items
():
for
key
,
image
in
model_features
.
items
():
model_id
=
atnt_db
.
get_client_id_from_file_id
(
key
)
# "enroll" model by collecting all model features of this client
models
[
model_id
].
append
(
model_features
[
key
])
print
(
"
Extracting probes
"
)
probe_features
=
{}
for
key
,
image
in
probe_images
.
iter
items
():
for
key
,
image
in
probe_images
.
items
():
probe_features
[
key
]
=
extract_feature
(
image
,
graph_machine
)
...
...
@@ -133,11 +133,11 @@ def main():
# iterate through models and probes and compute scores
model_count
=
1
for
model_id
,
model
in
models
.
iter
items
():
for
model_id
,
model
in
models
.
items
():
print
(
"
\r
Model
"
,
model_count
,
"
of
"
,
len
(
models
),
end
=
''
)
sys
.
stdout
.
flush
()
model_count
+=
1
for
probe_key
,
probe_feature
in
probe_features
.
iter
items
():
for
probe_key
,
probe_feature
in
probe_features
.
items
():
# compute local scores for each model gabor jet and each probe jet
scores
=
numpy
.
ndarray
((
len
(
model
),
len
(
probe_feature
)),
dtype
=
numpy
.
float
)
for
model_feature_index
in
range
(
len
(
model
)):
...
...
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