我想在Keras中加载经过预训练的ResNet50v2模型。我试过了

keras.applications.resnet_v2.ResNet50V2()


这给了一个错误

Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: module 'keras.applications' has no attribute 'resnet_v2'


在搜索该错误时,this answer建议使用keras_applications软件包。所以我尝试了

keras_applications.resnet_v2.ResNet50V2()


这给出了错误

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/nagabhushan/.local/lib/python3.6/site-packages/keras_applications/resnet_common.py", line 495, in ResNet50V2
    **kwargs)
  File "/home/nagabhushan/.local/lib/python3.6/site-packages/keras_applications/resnet_common.py", line 348, in ResNet
    data_format=backend.image_data_format(),
AttributeError: 'NoneType' object has no attribute 'image_data_format'


在搜索该错误时,this answer建议使用keras.applications软件包。我很困惑。如何加载ResNetv2模型?

注意:我能够加载ResNet50。只有ResNet50v2出现问题

from keras.applications.resnet50 import ResNet50

最佳答案

import keras

keras.applications.resnet_v2.ResNet50V2()




上面的代码在jupyter笔记本中执行
在安装Keras之前,请先安装其后端引擎之一TensorFlow


点安装tensorflow
点安装keras


keras - Keras中的ResNet50v2-LMLPHP

08-15 22:24