Last active
November 1, 2023 09:18
-
-
Save ketanhdoshi/51af76ba8bf6f21ed56698ff3bbc8126 to your computer and use it in GitHub Desktop.
Audio Classification Metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------- | |
# Prepare training data from Metadata file | |
# ---------------------------- | |
import pandas as pd | |
from pathlib import Path | |
download_path = Path.cwd()/'UrbanSound8K' | |
# Read metadata file | |
metadata_file = download_path/'metadata'/'UrbanSound8K.csv' | |
df = pd.read_csv(metadata_file) | |
df.head() | |
# Construct file path by concatenating fold and file name | |
df['relative_path'] = '/fold' + df['fold'].astype(str) + '/' + df['slice_file_name'].astype(str) | |
# Take relevant columns | |
df = df[['relative_path', 'classID']] | |
df.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment