Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Fuchs
tensorflow2_trainer_template
Commits
3404aa9e
Commit
3404aa9e
authored
Aug 04, 2020
by
Alexander Fuchs
Browse files
Fixed shuffle of dataset
parent
44b85dff
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/scripts/birdsong_simple_main.py
View file @
3404aa9e
...
...
@@ -121,6 +121,7 @@ def main(argv):
train_data_gen
=
data_generator
(
dg_train
.
generate
,
batch_size
,
is_training
=
True
,
shuffle_buffer
=
256
,
take_n
=
n_train
)
val_data_gen
=
data_generator
(
dg_train
.
generate
,
10
,
...
...
src/utils/data_loader.py
View file @
3404aa9e
...
...
@@ -7,6 +7,7 @@ import glob
import
warnings
import
multiprocessing
import
sys
import
random
import
tensorflow
as
tf
warnings
.
filterwarnings
(
'ignore'
)
...
...
@@ -250,8 +251,9 @@ class DataGenerator(object):
samples
=
self
.
dataset
.
train_samples
else
:
samples
=
self
.
dataset
.
test_samples
#Shuffle files before loading since dataset is ordered by class
random
.
shuffle
(
samples
)
for
sample
in
samples
:
filename
=
sample
[
'filename'
]
#If feature was already created load from file
...
...
@@ -262,6 +264,9 @@ class DataGenerator(object):
#Create features via STFT if no file exists
spectra
=
self
.
create_feature
(
sample
)
#Check for None type
if
np
.
any
(
spectra
)
==
None
:
continue
#If only mono --> duplicate
if
spectra
.
shape
[
0
]
==
1
:
spectra
=
np
.
tile
(
spectra
,[
2
,
1
,
1
])
...
...
Write
Preview
Supports
Markdown
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