Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
FBurkhardt committed Mar 19, 2024
1 parent 8e66265 commit 958a091
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions 1.3.0/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,53 @@ def main():
df = df[df["corrupted"] != True]
audeer.mkdir(image_dir)
util.describe_df(df, f"{image_dir}all.png")
# make a dataframe for 20 samples per speaker
df_lim = util.limit_speakers(df)
util.describe_df(df_lim, f"{image_dir}limited.png")
# make a dataframe for emotionally neutral samples
df["emotion"] = df_emo["emotion.0"].values
df = df[df.emotion.isin(["neutral"])]
util.describe_df(df, f"{image_dir}all_neutral.png")
df = util.limit_speakers(df)
util.describe_df(df, f"{image_dir}all_limited.png")
df_neut = df[df.emotion.isin(["neutral"])]
util.describe_df(df_neut, f"{image_dir}neutral.png")
# make a dataframe for emotionally neutral samples , limited to 20 samples
df_neut_lim = util.limit_speakers(df_neut)
util.describe_df(df_neut_lim, f"{image_dir}neutral_limited.png")

# create split sets
splits = {}
df_train, df_dev, df_test = trainDevTestSplit.split_df(df)
splits["train"] = df_train
splits["dev"] = df_dev
splits["test"] = df_test
# create split sets for samples from all emotions
splits_emo = {}
df_train, df_dev, df_test = trainDevTestSplit.split_df(df_lim)
splits_emo["train"] = df_train
splits_emo["dev"] = df_dev
splits_emo["test"] = df_test
# create split sets for neutral samples
splits_neut = {}
df_train, df_dev, df_test = trainDevTestSplit.split_df(df_neut_lim)
splits_neut["train"] = df_train
splits_neut["dev"] = df_dev
splits_neut["test"] = df_test
# plot distributions
for split in ["train", "dev", "test"]:
for split in splits_emo.keys():
print(f"split: {split}")
util.describe_df(splits[split], f"{image_dir}{split}.png")
util.describe_df(splits_emo[split], f"{image_dir}{split}.png")
util.describe_df(splits_neut[split], f"{image_dir}{split}_neut.png")

# fill the database with new tables
age_tables_name = "age."
for split in splits.keys():
age_tables_emotional_name = "age.emotional."
for split in splits_emo.keys():
db[f"{age_tables_name}{split}"] = audformat.Table(
splits[split].index,
description=f"Table selected for age and binary gender balance from the emotionally neutral samples, max 20 samples per speaker.",
splits_neut[split].index,
description=f"Table selected for age and binary gender balance from the emotionally neutral samples, limited to 20 samples per speaker.",
)
for field in ["speaker"]:
db[f"{age_tables_name}{split}"][field] = audformat.Column(scheme_id=field)
db[f"{age_tables_name}{split}"][field].set(splits[split][field])
db[f"{age_tables_name}{split}"][field].set(splits_neut[split][field])
db[f"{age_tables_emotional_name}{split}"] = audformat.Table(
splits_emo[split].index,
description=f"Table selected for age and binary gender balance from all samples, limited to 20 samples per speaker.",
)
for field in ["speaker"]:
db[f"{age_tables_emotional_name}{split}"][field] = audformat.Column(scheme_id=field)
db[f"{age_tables_emotional_name}{split}"][field].set(splits_emo[split][field])

db.save(build_dir)

Expand Down

0 comments on commit 958a091

Please sign in to comment.