MTG / essentia

C++ library for audio and music analysis, description and synthesis, including Python bindings
http://essentia.upf.edu
GNU Affero General Public License v3.0
2.85k stars 533 forks source link

Problem: cannot import name [TensorflowPredict...] from essentia.streaming #1391

Closed perli99 closed 10 months ago

perli99 commented 10 months ago

Hi, first of all really nice work you guys are doing here, really appreciate it.

I am trying to use Essentia and also Essentia-Tensorflow, for live audio classification of an incoming signal (as shown here: https://www.youtube.com/watch?v=Cp0zkojT9RQ) as part of my Bachelor Thesis. I do not have much programming experience yet and that is probably part of the problem here, but i just can't get essentia-tensorflow to work. I switched to Linux from windows to use essentia without limitations and also successfully installed essentia and essentia-tensorflow (no error output) in my jupyter notebook with the !pip command. I also a downloaded the discogs-effnet-bs64-1-savedmodel.zip and the correct header which jupyter is also able to find. But when i want to import TensorflowPredictEffnetDiscogs or any other Tensorflow model- like it was done on the ML Modules section on the Essentia website - I always get this error _message:

ImportError Traceback (most recent call last) Cell In[49], line 1 ----> 1 from essentia.streaming import MonoLoader, TensorflowPredictEffnetDiscogs, TensorflowPredict2D

ImportError: cannot import name 'TensorflowPredictEffnetDiscogs' from 'essentia.streaming' (/home/vincent/anaconda3/lib/python3.11/site-packages/essentia/streaming.py)

I checked the path and both folders essentia and essentia tensorflow.libs with libtensorflow-43a352e2.so.2.5.0 are located in /home/vincent/anaconda3/lib/python3.11/site-packages.

What am I missing? Are there any Version incompatibilities which I did not account for?

I am looking forward to hearing from you and hope it is an easy fix :). Vincent

dbogdanov commented 10 months ago

This looks like the Python picks up a wrong Essentia package. Just in case there is might be any confusion, do not install essentia package, install essentia-tensorflow instead.

You can check the directory of the package that is actually being imported with

import essentia
print(essentia.__file__)
perli99 commented 10 months ago

Yes the problem was that i installed both packages and python accessed the one without tensorflow. So indeed an easy fix, thanks for your fast help :).