Skip to content

Commit

Permalink
Merge pull request #43 from JustinKavalan/master
Browse files Browse the repository at this point in the history
DL baselines can be run (fixes #15) by ignoring audio files that are too short (in the data loader).
  • Loading branch information
mdeff authored Nov 4, 2020
2 parents 7af1343 + 3f35ccf commit 189d764
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,15 @@ def __next__(self):
# print('queue', self.tids[batch_current], batch_size)
tids = np.array(self.tids[batch_current:batch_current+batch_size])

for i, tid in enumerate(tids):
self.X[i] = self.loader.load(get_audio_path(audio_dir, tid))
self.Y[i] = Y.loc[tid]
batch_size = 0
for tid in tids:
try:
audio_path = get_audio_path(audio_dir, tid)
self.X[batch_size] = self.loader.load(audio_path)
self.Y[batch_size] = Y.loc[tid]
batch_size += 1
except Exception as e:
print("\nIgnoring " + audio_path +" (error: " + str(e) +").")

with self.lock2:
while (batch_current - self.batch_rearmost.value) % self.tids.size > self.batch_size:
Expand Down

0 comments on commit 189d764

Please sign in to comment.