【发布时间】:2021-02-24 13:26:58
【问题描述】:
from tensorflow import keras
from segmentation_models import PSPNet
运行此程序时,我遇到以下错误:
AttributeError Traceback (most recent call last)
<ipython-input-14-fbd9360b4944> in <module>()
1
2 from tensorflow import keras
----> 3 from segmentation_models import PSPNet
3 frames
/usr/local/lib/python3.6/dist-packages/segmentation_models/__init__.py in <module>()
96 _framework = os.environ.get('SM_FRAMEWORK', _DEFAULT_KERAS_FRAMEWORK)
97 try:
---> 98 set_framework(_framework)
99 except ImportError:
100 other = _TF_KERAS_FRAMEWORK_NAME if _framework == _KERAS_FRAMEWORK_NAME else _KERAS_FRAMEWORK_NAME
/usr/local/lib/python3.6/dist-packages/segmentation_models/__init__.py in set_framework(name)
66 if name == _KERAS_FRAMEWORK_NAME:
67 import keras
---> 68 import efficientnet.keras # init custom objects
69 elif name == _TF_KERAS_FRAMEWORK_NAME:
70 from tensorflow import keras
/usr/local/lib/python3.6/dist-packages/efficientnet/keras.py in <module>()
15 preprocess_input = inject_keras_modules(model.preprocess_input)
16
---> 17 init_keras_custom_objects()
/usr/local/lib/python3.6/dist-packages/efficientnet/__init__.py in init_keras_custom_objects()
69 }
70
---> 71 keras.utils.generic_utils.get_custom_objects().update(custom_objects)
72
73
AttributeError: module 'keras.utils' has no attribute 'generic_utils'
我使用 pip 作为提供的指令安装了分段模型库 (link) 如果有人可以帮助我解决它,我将不胜感激。我只是从指令中复制代码,我在网上找到的都是一样的。是不是安装有问题?
请指导我完成这个!:)
【问题讨论】:
标签: tensorflow keras deep-learning artificial-intelligence semantic-segmentation