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

How to import ML models ad use for autotagging #134

Open
2 of 9 tasks
bianchilo opened this issue Jan 14, 2024 · 1 comment
Open
2 of 9 tasks

How to import ML models ad use for autotagging #134

bianchilo opened this issue Jan 14, 2024 · 1 comment
Labels
EssentiaModel Issues related to essentia.js-model add-on build help wanted Extra attention is needed

Comments

@bianchilo
Copy link

bianchilo commented Jan 14, 2024

What is the issue about?

  • Bug
  • Feature request
  • Usage question
  • Documentation
  • Contributing / Development

What part(s) of Essentia.js is involved?

  • essentia.js-core (vanilla algorithms)
  • essentia.js-model (machine learning algorithms)
  • essentia.js-plot (plotting utility module)
  • essentia.js-extractor (typical algorithm combinations utility)

Description

Hello everyone, I am trying to adapt the Real-time music autotagging with MusicCNN example using a different machine learning model among those published on Essentia ( https://essentia.upf.edu/models/ ) . Target is recognizing musical instruments in realtime. I chose mtg_jamendo_instrument-discogs-effnet-1.pb because it has more musical instruments. I converted it to TensorFlow format using tensorflowjs-converter, and now I have the problem of handling a different feature input required by this model.

The model used in the example I was modifying had the following input configuration:

"inputs": [
{
"name": "model/Placeholder",
"type": "float",
"shape": [
187,
96
]
}
]
and it performs inference with "algorithm": "TensorflowPredictMusiCNN"

However, the model I would like to use now has the following input configuration:

"inputs": [
{
"name": "model/Placeholder",
"type": "float",
"shape": [
1280
]
}
]
and it performs inference with "algorithm": "TensorflowPredict2D"

So, at the very least, I need to change the FeatureExtractProcessor. Is there any place where I can find an example that suits my case or detailed information on how to do this? I haven't found anything in the documentation that helps me understand what I need to change in the code. Any suggestions are welcome. Thank you in advance.

Steps to reproduce / Code snippets / Screenshots

System info

Chromium based browser, Essentia.js

@albincorreya
Copy link
Member

albincorreya commented Jan 18, 2024

These new models based on effnet-discogs has a different signal flow than older generation models. From the python docs and examples, you can see the following process

audio input -> embeddings -> activations (tags)

There are two models for inference, ie. one to compute embeddings (vector representation) and another one to compute tags from these vector representations.

For making this work in JS, the following signal chain has to be added to essentia.js-model lib.

  1. audio -> embeddings
  2. embeddings -> tags

@albincorreya albincorreya added help wanted Extra attention is needed EssentiaModel Issues related to essentia.js-model add-on build labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EssentiaModel Issues related to essentia.js-model add-on build help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants