-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdata_split.py
More file actions
26 lines (17 loc) · 751 Bytes
/
data_split.py
File metadata and controls
26 lines (17 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pandas as pd
if __name__ == "__main__":
DATA_DIR = "./dataset"
real_df = pd.read_csv(f"{DATA_DIR}/real_songs.csv")
real_df["filepath"] = f"{DATA_DIR}/real_songs/" + real_df.filename + ".mp3"
real_df["target"] = 0
fake_df = pd.read_csv(f"{DATA_DIR}/fake_songs.csv")
fake_df["filepath"] = f"{DATA_DIR}/fake_songs/" + fake_df.filename + ".mp3"
fake_df["target"] = 1
df = pd.concat([real_df, fake_df])
df = df[(df.duration >= 30) & (df.no_vocal == False)]
train_df = df[df.split == 'train']
train_df.to_csv("train.csv",index=False)
valid_df = df[df.split == 'valid']
valid_df.to_csv("valid.csv",index=False)
test_df = df[df.split == 'test']
test_df.to_csv("test.csv",index=False)