Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.tensorflow
Commits
e154fba1
Commit
e154fba1
authored
Feb 10, 2020
by
Amir MOHAMMADI
Browse files
Fix the biogenerator when the multiple samples is False
parent
a67951e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/tensorflow/dataset/bio.py
View file @
e154fba1
...
...
@@ -56,15 +56,20 @@ class BioGenerator(Generator):
self
.
load_data
=
load_data
self
.
biofile_to_label
=
biofile_to_label
def
reader
(
f
):
def
_
reader
(
f
):
label
=
int
(
self
.
biofile_to_label
(
f
))
data
=
self
.
load_data
(
self
.
database
,
f
)
key
=
str
(
f
.
make_path
(
""
,
""
)).
encode
(
"utf-8"
)
if
self
.
multiple_samples
:
return
data
,
label
,
key
if
multiple_samples
:
def
reader
(
f
):
data
,
label
,
key
=
_reader
(
f
)
for
d
in
data
:
yield
(
d
,
label
,
key
)
else
:
yield
(
data
,
label
,
key
)
else
:
def
reader
(
f
):
return
_reader
(
f
)
super
(
BioGenerator
,
self
).
__init__
(
biofiles
,
reader
,
multiple_samples
=
multiple_samples
,
**
kwargs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment