Comments (10)
@5pacedo9 You need to downsample the audio to 16000 before it is fed into the TensorflowPredictEffnetDiscogs algorithm, otherwise its internal frame and hop size to compute model input representation wouldn't match what the model expects. Therefore you should use MonoLoader with sampleRate=16000
.
Closing this issue as the initial question is resolved. We rely on Homebrew for all Essentia dependencies, and it supports only the latest three MacOS versions. If you have further questions about the model, feel free to open a separate issue.
from essentia.
I guess it's because I'm using Big Sur, and I also brewed essentia --with-tensorflow so I decided to replaced the essentia(2.1b6.dev1110) install by pip with the brewed one(HEAD-b584c9b),
I moved/opt/homebrew/Cellar/essentia/HEAD-b584c9b/lib/python3.9/site-packages/essentia
to /Users/5pacedo9/anaconda3/envs/py311/lib/python3.11/site-packages/essentia/
from essentia.
And the error was gone but another come.
Traceback (most recent call last):
File "/Volumes/A/PycharmProjects/essentia_test/main.py", line 1, in <module>
from essentia.standard import MonoLoader, TensorflowPredictEffnetDiscogs, TensorflowPredict2D
File "/Users/5pacedo9/anaconda3/envs/py311/lib/python3.11/site-packages/essentia/__init__.py", line 1, in <module>
from . import _essentia
ImportError: cannot import name '_essentia' from partially initialized module 'essentia' (most likely due to a circular import) (/Users/5pacedo9/anaconda3/envs/py311/lib/python3.11/site-packages/essentia/__init__.py)
It seems that brewed one was built on python3.9
from essentia.
I switched to python3.9 and replaced essentia with brewed one and finally the IMPORT ERROR was gone.
But I met runtime error which I don't know how to solve.
[ INFO ] TensorflowPredict: Successfully loaded graph file: `/Volumes/A/PycharmProjects/essentia_test/genre_discogs400-discogs-effnet-1.pb`
Traceback (most recent call last):
File "/Volumes/A/PycharmProjects/essentia_test/main.py", line 5, in <module>
embedding_model = TensorflowPredictEffnetDiscogs(graphFilename="/Volumes/A/PycharmProjects/essentia_test/genre_discogs400-discogs-effnet-1.pb", output="PartitionedCall:1")
File "/Users/5pacedo9/anaconda3/envs/python39/lib/python3.9/site-packages/essentia/standard.py", line 44, in __init__
self.configure(**kwargs)
File "/Users/5pacedo9/anaconda3/envs/python39/lib/python3.9/site-packages/essentia/standard.py", line 64, in configure
self.__configure__(**kwargs)
RuntimeError: Error while configuring TensorflowPredictEffnetDiscogs: TensorflowPredict: 'serving_default_melspectrogram' is not a valid node name of this graph.
TensorflowPredict: Available node names are:
Const, Const_1, NoOp, Const_2, serving_default_model_Placeholder, PartitionedCall, saver_filename, StatefulPartitionedCall, StatefulPartitionedCall_1.
Reconfigure this algorithm with valid node names as inputs and outputs before starting the processing.
code in main.py remains unchanged.
Please forgive me if I made some ridiculous mistakes, I'm totally new to python and tensorflow.
from essentia.
I've found that I put the wrong .pb file in TensorflowPredictEffnetDiscogs()
and now the code is like
from essentia.standard import MonoLoader, TensorflowPredictEffnetDiscogs, TensorflowPredict2D
if __name__ == '__main__':
audio = MonoLoader(filename="/Volumes/B/DJ/Trance/Dragon (Original Mix) - Shogun,Adara.mp3", sampleRate=44100, resampleQuality=4)()
embedding_model = TensorflowPredictEffnetDiscogs(graphFilename="/Volumes/A/PycharmProjects/essentia_test/discogs-effnet-bs64-1.pb", output="PartitionedCall:1")
embeddings = embedding_model(audio)
model = TensorflowPredict2D(graphFilename="/Volumes/A/PycharmProjects/essentia_test/genre_discogs400-discogs-effnet-1.pb", input="serving_default_model_Placeholder", output="PartitionedCall:0")
predictions = model(embeddings)
and the output:
[ INFO ] TensorflowPredict: Successfully loaded graph file: `/Volumes/A/PycharmProjects/essentia_test/discogs-effnet-bs64-1.pb`
2024-01-25 17:33:17.032197: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
[ INFO ] TensorflowPredict: Successfully loaded graph file: `/Volumes/A/PycharmProjects/essentia_test/genre_discogs400-discogs-effnet-1.pb`
[ INFO ] TensorflowPredict: Successfully loaded graph file: `/Volumes/A/PycharmProjects/essentia_test/genre_discogs400-discogs-effnet-1.pb`
Did I run it successfully? And how to transform the predictions
into the predicted genres that I want?
from essentia.
Hi @5pacedo9 , it ran successfully.
You can consult the list of the predicted genres in the model's metadata JSON file.
from essentia.
Thank you, @dbogdanov , do you know how to get predicted genres by consulting the json file?
predictions
is a numpy.ndarray in shape ["batch_size",400]
, and I don't know how to convert these data with json file into genres.
from essentia.
Here is an example of loading the JSON metadata file and matching activations to class labels.
from essentia.
Thank you, @dbogdanov , I got the predicted genres and output the one with highest possibility, but it seems that all the genres are not correct, the genre of these inputted songs is Trance, but I get either vaporware or experimental. And I realize it might be caused by sample rate, in my code:audio = MonoLoader(filename=filePath, sampleRate=44100, resampleQuality=4)()
, when I changed sampleRate to 16000, I finally got the right genre Trance. This seems weird because all of the tested songs' sample rate is 44100 but not 16000.
from essentia.
Thanks for your help.
from essentia.
Related Issues (20)
- Extractor Docs: "See detailed documentation" link 404's. HOT 1
- cannot import name 'TensorflowPredictMusiCNN' from 'essentia.standard' HOT 4
- Adding CMake and VS2019/2022 support HOT 30
- Update Vamp plugin to the latest Vamp SDK
- MSVC Vamp plugin builds for Windows
- speech vs music algorithms HOT 3
- Unexpected performance in melody tracking
- PitchMelodia requires 8192 samples
- Build fails with "error: βav_register_allβ was not declared in this scope"
- Pip install fail on Linux HOT 3
- Get rid of "MusicExtractorSVM: no classifier models were configured by default" HOT 1
- Change in frameCutter ? Error when checking types. Expected: Real, received: std::vector<Real>
- Description Issue of MelBands
- Warning about python wheel record file HOT 1
- Affero GPLv3 License link broken in documentation
- Benchmarking PitchYin for real-time
- Issues with FFmpeg and LibAV building essentia in macOS 10.15.7 HOT 2
- TF_FORCE_GPU_ALLOW_GROWTH seems to have no effect
- Declaring parameters section outdated in the documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from essentia.