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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM