Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
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.base
Commits
caf1f710
Commit
caf1f710
authored
4 years ago
by
Yannick DAYER
Browse files
Options
Downloads
Patches
Plain Diff
Added all_samples to csv dataset classes
parent
20bf6fe4
No related branches found
No related tags found
1 merge request
!217
Add a method to retrieve all the samples of a dataset
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/bio/base/database/csv_dataset.py
+40
-0
40 additions, 0 deletions
bob/bio/base/database/csv_dataset.py
with
40 additions
and
0 deletions
bob/bio/base/database/csv_dataset.py
+
40
−
0
View file @
caf1f710
...
...
@@ -326,6 +326,26 @@ class CSVDatasetDevEval:
group
=
group
,
purpose
=
"
probe
"
,
group_by_subject
=
False
)
def
all_samples
(
self
,
groups
=
None
):
"""
Reads and returns all the samples in `groups`.
Parameters
----------
groups: list or None
Groups to consider, or all groups if `None` is given.
"""
# Get train samples (background_model_samples returns a list of samples)
samples
=
self
.
background_model_samples
()
# Get enroll and probe samples
groups
=
[
"
dev
"
,
"
eval
"
]
if
not
groups
else
groups
for
group
in
groups
:
for
purpose
in
(
"
enroll
"
,
"
probe
"
):
label
=
f
"
{
group
}
_
{
purpose
}
_csv
"
samples
.
append
(
self
.
csv_to_sample_loader
(
self
.
__dict__
[
label
]))
return
samples
class
CSVDatasetCrossValidation
:
"""
...
...
@@ -456,6 +476,26 @@ class CSVDatasetCrossValidation:
def
probes
(
self
,
group
=
"
dev
"
):
return
self
.
_load_from_cache
(
"
dev_probe_csv
"
)
def
all_samples
(
self
,
groups
=
None
):
"""
Reads and returns all the samples in `groups`.
Parameters
----------
groups: list or None
Groups to consider, or all groups if `None` is given.
"""
# Get train samples (background_model_samples returns a list of samples)
samples
=
self
.
background_model_samples
()
# Get enroll and probe samples
groups
=
[
"
dev
"
,
"
eval
"
]
if
not
groups
else
groups
for
group
in
groups
:
for
purpose
in
(
"
enroll
"
,
"
probe
"
):
label
=
f
"
{
group
}
_
{
purpose
}
_csv
"
samples
.
append
(
self
.
csv_to_sample_loader
(
self
.
__dict__
[
label
]))
return
samples
def
group_samples_by_subject
(
samples
):
...
...
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