You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to import ModelTraining with from imageai.Prediction.Custom import ModelTraining and I get the following error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File ".../python3.7/site-packages/imageai/Prediction/Custom/__init__.py", line 4, in <module>
from ..DenseNet.densenet import DenseNetImageNet121
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File ".../python3.7/site-packages/imageai/Prediction/DenseNet/densenet.py", line 21, in <module>
from tensorflow.python.keras.utils import convert_all_kernels_in_model
ImportError: cannot import name 'convert_all_kernels_in_model' from 'tensorflow.python.keras.utils' (.../python3.7/site-packages/tensorflow_core/python/keras/utils/__init__.py)
This issue gets resolved when I update all tensorflow.python.keras imports with tensorflow.keras in ImageAI library. For example, I change from tensorflow.python.keras.utils import convert_all_kernels_in_model to from tensorflow.keras.utils import convert_all_kernels_in_model.
Is there a specific tensorflow version ImageAI requires?
Currently, ImageAI works on tensorflow version 1.14 (and higher) but is not compactible with 2.0 or higher. Thats the reason you face this issue. Try downgrading your tensorflow version.
I faced similar issues and the downgrade helped
Hi,
I am trying to import ModelTraining with
from imageai.Prediction.Custom import ModelTraining
and I get the following error:This issue gets resolved when I update all
tensorflow.python.keras
imports withtensorflow.keras
in ImageAI library. For example, I changefrom tensorflow.python.keras.utils import convert_all_kernels_in_model
tofrom tensorflow.keras.utils import convert_all_kernels_in_model
.Is there a specific tensorflow version ImageAI requires?
Here is some info about my environment:
Python 3.6.10
imageai==2.1.5
tensorflow==2.1.0
Keras==2.3.1
The text was updated successfully, but these errors were encountered: