问题说明:

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

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. Map总结--HashMap/HashTable/TreeMap/WeakHashMap使用场景分析(转)

    首先看下Map的框架图 1.Map概述 1.Map是键值对映射的抽象接口 2.AbstractMap实现了Map中绝大部分的函数接口,它减少了“Map实现类”的重复编码 3.SortedMap有序的“ ...

  2. iOS app submission : missing 64-bit support

  3. 在Linux下创建7种类型的文件

    在测试的时候有时会需要每种类型的文件,在系统中进行搜索都会找到,当然最方便的还是手动创建它们进行测试使用. 普通文件: $ touch regular 目录: $ mkdir directory 符号 ...

  4. php 获取上上个月数据 使用 strtotime('-1 months')的一个bug

    今天,使用php 日期函数处理数据,发现一个问题. 具体场景是这样的,我一直以为strtotime  格式化当前日期 或 指定日期可以找到对应的数据,比如我要查找上上个与的数据,因为我要获取当前时间的 ...

  5. tensorflow学习官网地址

    摘自: http://wiki.jikexueyuan.com/project/tensorflow-zh/tutorials/overview.html 内容很多,需要花时间看完

  6. matlab之细胞数组

    学习matlab的一个博客:https://blog.csdn.net/smf0504/article/details/51814362 Matlab从5.0版开始引入了一种新的数据类型—细胞( ce ...

  7. LightOJ 1132 Summing up Powers:矩阵快速幂 + 二项式定理

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1132 题意: 给定n.k,求(1K + 2K + 3K + ... + NK) % 2 ...

  8. linux应用之Lamp(apache+mysql+php)的源码安装(centos)

    Linux+Apache+Mysql+Php源码安装 一.安装环境: 系统:Centos6.5x64 Apache: httpd-2.4.10.tar.gz Mysql: mysql-5.6.20-l ...

  9. Hover show tips

    像上面这种效果,hover1时显示2,且1和2有一定间距的东东,一般有两种实现办法: 1.用JS,原理:over1时让2显示,out1时开个定时器延迟500ms再消失,over2时清除定时器,out2 ...

  10. java面试题05

    1.写一个冒泡排序的算法 升序排列: public static void main(String[] args) { int score[] = { 67, 20, 75, 87, 89, 90, ...