Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WandB logging and Support training on a dataframe of clip labels #609

Merged
merged 30 commits into from
Dec 20, 2022

Conversation

sammlapp
Copy link
Collaborator

This PR adds two features to training CNNs in OpenSoundscape:

  1. monitor training and prediction progress in Weights and Biases, where you can interact with samples, training progress, charts of training and validation metrics, and compare metadata/hyperparameters/performance across model training runs
  2. train CNN using a dataframe describing labeled audio segments without splitting the audio files into clips
  • for instance, load annotations from a Raven file, map them onto a clip dataframe, and train without generating short audio clips

logs training and validation data separately. Also logs epochs and 
batches.
added code to set up wandb with init(config) and logging samples + metrics during train.

still need to test and add it to .predict()
Full working version of wandb integration for training and prediction. Instead of wandb.init() inside train, the user starts a wandb session and passes it to train or predict.

The train and predict functions log sample-preview tables and progress/metrics to the wandb session, and update the config.
to train on clips from longer files, pass a training dataframe with a multi-index of (file,start_time,end_time).

The preprocessor will first extract clips based on the specified start_time and end_time. It will then further trim the clips (randomly or from the beginning, depending on preprocessor/augmentation settings) to match the necessary sample duration.

I think the same behavior applies to validation without any issues, but should check that its working as expected.
Needed to change AudioSplittingDataset to return a df with multi-index (file,start_time,end_time). That df is used to set up the prediction dataframe for predicting on clips. Seems to be working now, but deserves tests.
needed file, start_time, end_time as columns
CNN.predict() can recieve a list of files, a dataframe with files as index, or (New) a dataframe which already contains clip information (multi-index of file, start_time, end_time)
AudioClipLoader now takes _end_time rather than _clip_duration. Update tests with correct arguments.
wasn't implemented correctly, was just initializing an empty dataset. Now, creates empty dataset then adds the clip_df as dataset.label_df.
- predicting from a list of audio files
- predicting from a clip_df specifying clip start and end times
was using unnecessarily complex logic. Now correctly uses the base class AudioFileDataset and provides better comments describing the logic
@sammlapp sammlapp merged commit 7629e8d into develop Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant