Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.vein
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.bio.vein
Commits
192eb5af
Commit
192eb5af
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Make verafinger file load both image and mask from annotations
parent
e0efe30b
No related branches found
No related tags found
1 merge request
!18
Simplifications
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/vein/database/verafinger.py
+49
-40
49 additions, 40 deletions
bob/bio/vein/database/verafinger.py
with
49 additions
and
40 deletions
bob/bio/vein/database/verafinger.py
+
49
−
40
View file @
192eb5af
...
...
@@ -7,72 +7,81 @@ from bob.bio.base.database import BioFile, BioDatabase
class
File
(
BioFile
):
"""
Implements extra properties of vein files for the Vera Fingervein database
"""
Implements extra properties of vein files for the Vera Fingervein database
Parameters:
Parameters:
f (object): Low-level file (or sample) object that is kept inside
f (object): Low-level file (or sample) object that is kept inside
"""
"""
def
__init__
(
self
,
f
):
def
__init__
(
self
,
f
):
super
(
File
,
self
).
__init__
(
client_id
=
f
.
model_id
,
path
=
f
.
path
,
file_id
=
f
.
id
)
self
.
__f
=
f
super
(
File
,
self
).
__init__
(
client_id
=
f
.
model_id
,
path
=
f
.
path
,
file_id
=
f
.
id
)
self
.
__f
=
f
def
roi
(
self
):
"""
Returns the binary mask from the ROI annotations available
"""
from
..preprocessor.utils
import
poly_to_mask
def
mask
(
self
):
"""
Returns the binary mask from the ROI annotations available
"""
# The size of images in this database is (250, 665) pixels (h, w)
return
poly_to_mask
((
250
,
665
),
self
.
__f
.
roi
())
from
..preprocessor.utils
import
poly_to_mask
# The size of images in this database is (250, 665) pixels (h, w)
return
poly_to_mask
((
250
,
665
),
self
.
__f
.
roi
())
def
load
(
self
,
*
args
,
**
kwargs
):
"""
(Overrides base method) Loads both image and mask
"""
image
=
super
(
File
,
self
).
load
(
*
args
,
**
kwargs
)
return
image
,
self
.
mask
()
class
Database
(
BioDatabase
):
"""
Implements verification API for querying Vera Fingervein database.
"""
"""
Implements verification API for querying Vera Fingervein database.
"""
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
super
(
Database
,
self
).
__init__
(
name
=
'
verafinger
'
,
**
kwargs
)
from
bob.db.verafinger.query
import
Database
as
LowLevelDatabase
self
.
__db
=
LowLevelDatabase
()
super
(
Database
,
self
).
__init__
(
name
=
'
verafinger
'
,
**
kwargs
)
from
bob.db.verafinger.query
import
Database
as
LowLevelDatabase
self
.
__db
=
LowLevelDatabase
()
self
.
low_level_group_names
=
(
'
train
'
,
'
dev
'
)
self
.
high_level_group_names
=
(
'
world
'
,
'
dev
'
)
self
.
low_level_group_names
=
(
'
train
'
,
'
dev
'
)
self
.
high_level_group_names
=
(
'
world
'
,
'
dev
'
)
def
groups
(
self
):
def
groups
(
self
):
return
self
.
convert_names_to_highlevel
(
self
.
__db
.
groups
(),
self
.
low_level_group_names
,
self
.
high_level_group_names
)
return
self
.
convert_names_to_highlevel
(
self
.
__db
.
groups
(),
self
.
low_level_group_names
,
self
.
high_level_group_names
)
def
client_id_from_model_id
(
self
,
model_id
,
group
=
'
dev
'
):
"""
Required as ``model_id != client_id`` on this database
"""
def
client_id_from_model_id
(
self
,
model_id
,
group
=
'
dev
'
):
"""
Required as ``model_id != client_id`` on this database
"""
return
self
.
__db
.
finger_name_from_model_id
(
model_id
)
return
self
.
__db
.
finger_name_from_model_id
(
model_id
)
def
model_ids_with_protocol
(
self
,
groups
=
None
,
protocol
=
None
,
**
kwargs
):
def
model_ids_with_protocol
(
self
,
groups
=
None
,
protocol
=
None
,
**
kwargs
):
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
return
self
.
__db
.
model_ids
(
groups
=
groups
,
protocol
=
protocol
)
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
return
self
.
__db
.
model_ids
(
groups
=
groups
,
protocol
=
protocol
)
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
retval
=
self
.
__db
.
objects
(
groups
=
groups
,
protocol
=
protocol
,
purposes
=
purposes
,
model_ids
=
model_ids
,
**
kwargs
)
groups
=
self
.
convert_names_to_lowlevel
(
groups
,
self
.
low_level_group_names
,
self
.
high_level_group_names
)
retval
=
self
.
__db
.
objects
(
groups
=
groups
,
protocol
=
protocol
,
purposes
=
purposes
,
model_ids
=
model_ids
,
**
kwargs
)
return
[
File
(
f
)
for
f
in
retval
]
return
[
File
(
f
)
for
f
in
retval
]
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