AttributeError: 'Model' object has no attribute 'name'

Traceback (most recent call last):

  File "<ipython-input-15-7fa9988e38ef>", line 1, in <module>
    runfile('E:/experiment/paper1/train.py', wdir='E:/experiment/paper1')

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
    execfile(filename, namespace)

  File "C:\Users\admin\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "E:/experiment/paper1/train.py", line 44, in <module>
    model=hsi_net.FDSSC()

  File "E:\experiment\paper1\hsi_net.py", line 115, in FDSSC
    model=Model([input_data],pred)

  File "C:\Users\admin\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)

  File "C:\Users\admin\Anaconda3\lib\site-packages\keras\engine\network.py", line 91, in __init__
    self._init_graph_network(*args, **kwargs)

  File "C:\Users\admin\Anaconda3\lib\site-packages\keras\engine\network.py", line 183, in _init_graph_network
    'The tensor that caused the issue was: ' +

AttributeError: 'Model' object has no attribute 'name'

進入hsi_net.py文件找到FDSSC函數。python

紅圈畫的input_data應該是模型的輸入,可是因爲reshape時變量命名的問題,致使input_data變成了別的變量,因此在運行時會出現以下錯誤。app

相關文章
相關標籤/搜索