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

Visualize multiple categories #146

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Conversation

mbazzani
Copy link

Closes #135

These changes allow the visualize_spectrogram function to graph multiple different categories, assigning each category a different label and color. All actual changes are done in the spectrogram_graph function, since visualize_spectrogram just calls that to draw the final graph. If there are more than six categories, colors will start being re-used.

Tested using a modified version of the Screaming Piha test dataset provided on here. Here are some results from different calls of the function, to make sure my changes matched the intended results:

spectrogram_visualization(clip_path, premade_annotations_df = manual_df[manual_df["IN FILE"] == "ScreamingPiha2.wav"],premade_annotations_label = "Piha Human Labels")
image

spectrogram_visualization(clip_path,automated_df = True, isolation_parameters = isolation_parameters)
image

spectrogram_visualization(clip_path,automated_df = True,isolation_parameters=isolation_parameters,premade_annotations_df = manual_df[manual_df["IN FILE"] == "ScreamingPiha2.wav"])
image

@sprestrelski
Copy link
Member

Great work so far! I have a couple changes I'd like to see:

  1. Contrast - Given that the spectrogram is blue, it'll be hard to see colors like blue and cyan (green to an extent) overlaid on it. Can we limit the range of colors to those that are easier to see (e.g warm colors)?
  2. Limited classes - If we want to display more than 6 classes, what happens? It would be nice to have set colors (for consistency), then further colors are autogenerated in case someone is working with large amounts of classes.
  3. Customization - Along with consistency, can we have the option to specify colors? I'm thinking of a use case where you want to generate multiple spectrograms, but the color ends up different for the same class across multiple (e.g. Screaming Piha is red on one spectrogram, orange on another). There are multiple ways to go about this, but think from a user's perspective how you would want this to be standardized.

@mbazzani mbazzani self-assigned this Dec 16, 2022
@mbazzani
Copy link
Author

Currently, the colors can still change between each function call/different data sets. Is this the desired behavior, or should I make label colors persistent consistent throughout the entire program?

@sprestrelski
Copy link
Member

It'd be great if they were consistent throughout the whole program.

@sprestrelski sprestrelski self-requested a review December 16, 2022 12:07
@mbazzani
Copy link
Author

Commit 468cb4b is misnamed, that one is a large refactoring that changes spectrogram visualization to take a dataframe as input.

@mbazzani
Copy link
Author

Once these changes are approved, I'll modify the tutorial notebook to properly call the new functions

@mbazzani
Copy link
Author

Here are some examples of test outputs from this code:
The automated labels are always one color because they only have one label, but they are drawn with the same function as the manual labels, so once the models support multiple labels, the graphs will be able to show it.

2022-12-22_09-29
2022-12-22_09-28
2022-12-22_09-27

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.

Add ability to visualize multiple classes in the spectrogram visualization function
2 participants