问题说明:

首先呢,报这个错误的代码是这行代码:

model = Model(inputs=input, outputs=output)

报错:

 AttributeError 'NoneType' object has no attribute '_inbound_nodes'

解决问题:

本人代码整体采用Keras Function API风格,其中使用代码中使用了concatenate以及reshape这两个方法,具体使用:

from keras import backend as K
from keras.layers import Dense, Input inpt = Input(shape=(224, 224, 3))
x = Conv2d(63, (3,3), padding='same', activation='relu')
...
x = K.concatenate([branch1, branch2, branch3], axis=3)
x = K.reshpe(x, (1000,))
# 上面两行代码并不是连续出现,这里写出来,主要描述使用了“连接”“reshape”两种操作;

或许,在你的代码中也存在这两行代码,又或者使用了类似的一些方法,问题就出在这里:

x = K.concatenate([branch1, branch2, branch3], axis=3)
x = K.reshpe(x, (1000,))

将之修改为:

from keras.layers import Concatenate, Resahpe

x = Concatenate(axis=3)([branch1, branch2, branch3])
x = Resahpe((1000,))(x)

可以想到,直接使用concatenate或者reshape不是作为一层,而Concatenate或者Reshape是一个layer;

那么,类似的错误都可以按照这个思路来检查代码吧。

Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'的更多相关文章

  1. python3 AttributeError: 'NoneType' object has no attribute 'split'

    from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...

  2. AttributeError: 'NoneType' object has no attribute 'split' 报错处理

    报错场景 social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别, 因此需要进行更改自行支持 JWT 方式 ...

  3. python提示AttributeError: 'NoneType' object has no attribute 'append'【转发】

    在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...

  4. python提示AttributeError: 'NoneType' object has no attribute 'append'

    在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...

  5. pyspark AttributeError: 'NoneType' object has no attribute 'setCallSite'

    pyspark: AttributeError: 'NoneType' object has no attribute 'setCallSite' 我草,是pyspark的bug.解决方法: prin ...

  6. AttributeError: 'NoneType' object has no attribute 'extend'

    Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'Non ...

  7. 解决opencv:AttributeError: 'NoneType' object has no attribute 'copy'

    情况一: 路径中有中文,更改即可 情况二:可以运行代码,在运行结束时显示 AttributeError: 'NoneType' object has no attribute 'copy' 因为如果是 ...

  8. appium 报错:AttributeError:"NoneType' object has no attribute 'XXX'

    报错截图如下: 问题原因: 根据以上报错提示可已看到问题的原因为:logger中没有info此方法的调用,点击"具体报错的位置"上面的链接,可直接定位到具体的报错位置.根据分析所得 ...

  9. PIL中分离通道发生“AttributeError: 'NoneType' object has no attribute 'bands'”

    解决方法: 这个貌似是属于一个bug 把Image.py中的1500行左右的split函数改成如下即可: def split(self): "Split image into bands&q ...

随机推荐

  1. Java for LeetCode 080 Remove Duplicates from Sorted Array II

    Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For examp ...

  2. jQuery 的文档操作

    在 js 中也有DOM操作,也可以进行 增删改查 ,但是通过 js 的DOM操作会发现,我的天哪,代码好多.但是 jQuery的文档操作就少了很多. js 中 DOM 的示例 : var box = ...

  3. Android databinding 开发参考

    1,android studio添加databinding依赖需要注意事项: http://www.zhihu.com/question/33538477?sort=created 2, databi ...

  4. 算法(Algorithms)第4版 练习 链表类 1.3.19~1.3.29

    package com.qiusongde.linkedlist; import java.util.Iterator; import java.util.NoSuchElementException ...

  5. 如何识别真Microsoft服务与非Microsoft服务来定位病毒自己的服务

    在我当网管的那段时间,发现有病毒入侵客户服务器,该病毒伪装自己的进程名,我们在服务中发现其也有伪装成系统服务的服务在运行,占用客户服务器的性能,使得CPU与内存的利用率达到90%以上,并持续时间长,甚 ...

  6. POJ 2976 Dropping tests:01分数规划【二分】

    题目链接:http://poj.org/problem?id=2976 题意: 共有n场考试,每场考试你得的分数为a[i],总分为b[i]. 你可以任意去掉k场考试. 问你最大的 100.0 * ( ...

  7. codeforces 659B B. Qualifying Contest(水题+sort)

    题目链接: B. Qualifying Contest time limit per test 1 second memory limit per test 256 megabytes input s ...

  8. codeforces 658B B. Bear and Displayed Friends(优先队列)

    题目链接: B. Bear and Displayed Friends time limit per test 2 seconds memory limit per test 256 megabyte ...

  9. HihoCoder1677 : 翻转字符串(Splay)(区间翻转)

    描述 给定一个字符串S,小Hi希望对S进行K次翻转操作. 每次翻转小Hi会指定两个整数Li和Ri,表示要将S[Li..Ri]进行翻转.(S下标从0开始,即S[0]是第一个字母) 例如对于S=" ...

  10. 【Lintcode】136.Palindrome Partitioning

    题目: Given a string s, partition s such that every substring of the partition is a palindrome. Return ...