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函数。

红圈画的input_data应该是模型的输入,但是由于reshape时变量命名的问题,导致input_data变成了别的变量,所以在运行时会出现如下错误。

 

posted @ 2019-05-27 10:05  Wangtn  阅读(4816)  评论(0编辑  收藏  举报