Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • ketos ketos
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 27
    • Issues 27
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • public_projects
  • ketosketos
  • Issues
  • #184

Closed
Open
Created Sep 01, 2022 by Bruno Padovese@bpadoveseOwner

Support for representation classes that instantiate the object when calling the construvtor

Normally, when we want to instantiate a class in python or any other object oriented laguange we simply have to call the class constructor as in:

our_obj = Our_class(whatever_arguments)

And that is it.

With ketos audio_representation, this is not the case. We have a number of different ways to create the object depending on the type of data we have, which makes things confusing in my opinion.

For instance, if we have the data array we call the constructor. If we have the waveform loaded already, we call the from_waveform method. And if we have the audio file we call the from_wav method instead. While this works, I think since we dont have many different ways of creating the object, we should group everything with the constructor. And the constructor should decide how to handle it. For instance how pandas deal with csv. the filepath_or_buffer argument allows you to pass either a data buffer or a string with a path an the function takes it from there and decide what to do with the argument and how to load the data.

The advantage of using such an approach is that we can standardize how representations are create accross the code. for instance, the load_audio function calls the constructor while the create_database function eventually calls the from_wav method.

The problem here is that someone implementing a new representation effectively has to create all these different methods to handle all the different ways we initialize representations. Furthermore, if they dont know ketos inner-workings, it becomes hard to predict what methods are mandatory to create. If we standardize this process, than we have to create just a constructor to handle the different ways to handle the data. And the reason i favor a constructor rather then a method is because that is the standard way of creating objects and people are already familiar with the process.

In addition, this doesnt exclude the other functions such as from_waveform and from_wav from existing if we deem it necessary. They just become an alternative, and backwards compatible. But we would start favouring using just the constructor.

tldr; Support for representation classes that create the representation when you instantiate the class

Edited Sep 01, 2022 by Bruno Padovese
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking