Skip to content

ENH: Feature module + API #91

Open

Description

@NickleDave

This is a meta issue to track thoughts about the API of the feature extraction module and related issues.

Thoughts:

  • make it functional to the extent possible -- avoid classes, standard scientific Python
  • provide named feature sets; we can provide these through functions, e.g. vocalpy.features.sat.similarity_features or vocalpy.features.warbleR.spectro_analysis
  • but at some point we're going to have re-duplication of features
  • which is where it might make sense to use classes to represent named sets of features; we'd have a "functional" module that's the implementation of the features, then
  • we might need to find a way to distinguish between frame-level features and segment-level features
    • SAT-style analyses basically extract each acoustic parameter per-frame
    • but I think warbleR takes a Raven selection table and then extracts scalar parameters per segment?
    • Or looking at it more, maybe warbleR is just taking whatever seewave gives them. More generally, I think it might be useful to have the ability to do both frame-level and segment-level feature extraction, with some way to specify how you do the reduction--I'm thinking of the pytorch reduction argument, but it could also be a callable so you say reduction=my_reduce_func and get e.g. the pitch at 20 ms or whatever you want
  • nice to have: follow logic of librosa API: accept either audio (y, in our case Audio) or spectral representation (S, in our case a Spectrogram), and if audio then apply appropriate spectral transforms to get whatever representation we need to extract the features

Related issues, to fix for closing this one

Activity

  1. added
    Acoustic feature
    ENH: enhancement
    on Dec 30, 2023
  2. ralphpeterson commented on Jan 3, 2024

    @ralphpeterson
    Contributor

    Chiming in here to document some discussion points David and I had over email.

    1.) The general sentiment I get from folks is that warbleR has the most "complete" feature set out there, so a port over to vocalpy would be great. A few recent cool papers use the library (Rivera et al. 2023, Jourjine et al. 2023).

    2a.) Re: frame vs. segment. I typically compute features in librosa using frames, then take the mean or median of all frames downstream of that. In an ideal world, I think that the user would be able to toggle between the two, perhaps by indicating "frames" or "segment" as a function argument.

    2b.) I really like the simplicity of dropping in raw audio as input to feature functions in librosa — not sure if that's how the feature functions work in vocalpy, but I agree with your suggestion that using a similar logic to librosa would be a nice to have.

  3. NickleDave commented on Jan 4, 2024

    @NickleDave
    ContributorAuthor

    Thank you @ralphpeterson, really appreciate the input.

    I can think of plenty of more than a few other papers that use the warbleR features too -- being able to access these features all in one place from Python would really help

    For 2a and 2b, I need to experiment a little to figure out what the API will look like.

    I also need to discuss a little with @yardencsGitHub but I have a feeling we will need to be extracting features for other things we're working on, so I am bumping this up the to-do list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Acoustic featureENH: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions