TypeError: _obtain_input_shape() got an unexpected keyword argument 'include_top'

原文链接:http://www.one2know.cn/bug9/

  • 报错
Traceback (most recent call last):
  File "D:/PyCharm 5.0.3/WorkSpace/3.Keras/2.Application中五款已训练模型、VGG16框架(Sequential式、Model式)解读/2.py", line 159, in <module>
    model = VGG16(include_top=True, weights='imagenet')
  File "D:/PyCharm 5.0.3/WorkSpace/3.Keras/2.Application中五款已训练模型、VGG16框架(Sequential式、Model式)解读/2.py", line 51, in VGG16
    include_top=include_top)
TypeError: _obtain_input_shape() got an unexpected keyword argument 'include_top'
  • 原因
    没有叫include_top的参数
  • 解决
    打开keras.applications.imagenet_utils找到preprocess_input()函数,def _obtain_input_shape(input_shape, default_size, min_size, data_format, require_flatten, weights=None):
    将参数include_top改成require_flatten
posted @ 2019-07-09 15:08  鹏懿如斯  阅读(1415)  评论(0编辑  收藏  举报