Skip to content

Commit 886712d

Browse files
committed
fixed some bug upon creation CSV files
1 parent f98d216 commit 886712d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

create_csv.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,20 @@ def write_tess_ravdess_csv(emotions=["sad", "neutral", "happy"], train_name="tra
6969

7070
for category in emotions:
7171
# for training speech directory
72-
for i, path in enumerate(glob.glob(f"data/training/Actor_*/*_{category}.wav")):
72+
total_files = glob.glob(f"data/training/Actor_*/*_{category}.wav")
73+
for i, path in enumerate(total_files):
7374
train_target["path"].append(path)
7475
train_target["emotion"].append(category)
75-
if verbose:
76-
print(f"[TESS&RAVDESS] There are {i} training audio files for category:{category}")
76+
if verbose and total_files:
77+
print(f"[TESS&RAVDESS] There are {len(total_files)} training audio files for category:{category}")
7778

7879
# for validation speech directory
79-
for i, path in enumerate(glob.glob(f"data/validation/Actor_*/*_{category}.wav")):
80+
total_files = glob.glob(f"data/validation/Actor_*/*_{category}.wav")
81+
for i, path in enumerate(total_files):
8082
test_target["path"].append(path)
8183
test_target["emotion"].append(category)
82-
if verbose:
83-
print(f"[TESS&RAVDESS] There are {i} testing audio files for category:{category}")
84+
if verbose and total_files:
85+
print(f"[TESS&RAVDESS] There are {len(total_files)} testing audio files for category:{category}")
8486
pd.DataFrame(test_target).to_csv(test_name)
8587
pd.DataFrame(train_target).to_csv(train_name)
8688

0 commit comments

Comments
 (0)