在使用 CNN的时候,报错: TypeError: ('Keyword argument not understood:', 'padding')

将“padding”改为“border_mode”,即可:

原因:padding 是Keras 2.X的语法,而我的PC安装的是 Keras 1.X版本。

二者的API 有一些地方是有变化的。

如下:(从 1.X 到 2.X )

========【Models】

1、Constructor arguments for Model have been renamed:

  • input -> inputs
  • output -> outputs

2、The Sequential model not longer supports the set_input method.

3、For any model saved with Keras 2.0 or higher, weights trained with backend X will be converted to work with backend Y without any manual conversion step.

========【Layers】

1、Dense layer

  • Changed interface:
  • output_dim -> units
  • init -> kernel_initializer
  • added bias_initializer argument
  • W_regularizer -> kernel_regularizer
  • b_regularizer -> bias_regularizer
  • b_constraint -> bias_constraint
  • bias -> use_bias

2、Embedding

Convolutional layers :

Interface changes common to all convolutional layers:

  • nb_filter -> filters
  • float kernel dimension arguments become a single tuple argument, kernel size. E.g. a legacy call Conv2D(10, 3, 3) becomes Conv2D(10, (3, 3))
  • kernel_size can be set to an integer instead of a tuple, e.g. Conv2D(10, 3) is equivalent toConv2D(10, (3, 3)).
  • subsample -> strides. Can also be set to an integer.
  • border_mode -> padding
  • init -> kernel_initializer
  • added bias_initializer argument
  • W_regularizer -> kernel_regularizer
  • b_regularizer -> bias_regularizer
  • b_constraint -> bias_constraint
  • bias -> use_bias
  • dim_ordering -> data_format
  • In the SeparableConv2D layers, init is split into depthwise_initializer andpointwise_initializer.
  • Added dilation_rate argument in Conv2D and Conv1D.
  • 1D convolution kernels are now saved as a 3D tensor (instead of 4D as before).
  • 2D and 3D convolution kernels are now saved in format spatial_dims + (input_depth, depth)), even with data_format="channels_first".

3、Pooling1D

  • pool_length -> pool_size
  • stride -> strides
  • border_mode -> padding

4、Pooling2D,3D

  • border_mode -> padding
  • dim_ordering -> data_format

【Reference】

1、Keras 2.x和1.x的区别 :https://blog.csdn.net/ch1209498273/article/details/78287145

2、Keras 官方发布的 :Keras 2.0 release notes :https://github.com/keras-team/keras/wiki/Keras-2.0-release-notes

Debug 路漫漫-08:Keras 版本升级函数变换导致的问题的更多相关文章

  1. Debug 路漫漫-05

    Debug 路漫漫-05: 1.使用这种方式计算 AUC 指标,结果出来居然是 NAN, —— 分母为(M*N),M或者N必有一个为0 了.(nan出现的情况绝大部分是分母出现0了)   若分子为0的 ...

  2. Debug 路漫漫-03

    Debug 路漫漫-03:SVD++的 Matlab 版本 SVD++ 的 pu 这一项: 圈圈中的这一项,它既然要和pu 相加 的话 ,那么,它的维度也应该是 m*K.(就是维度和Pu一致的 . 而 ...

  3. Debug 路漫漫-01

    运行到子函数时提示报错:  === 这个断点一步步debug下来是顺利的,但是咋就超出数组范围了呢,这会是什么问题. ——sess肯定超过索引了,那个sess(:,2)的值肯定超过V的行数了. ——由 ...

  4. Debug 路漫漫-15:Python: NameError:name 'dataset' is not defined

    在调试 <Outer Product-based Neural Collaborative Filtering>论文的源码(https://github.com/duxy-me/ConvN ...

  5. Debug 路漫漫-02

    重现标准 BTL Model ,using MATLAB: 1. 错误使用 cat要串联的数组的维度不一致.出错 cell2mat (line 83) m{n} = cat(1,c{:,n}); —— ...

  6. Debug 路漫漫-13:Python: pandas IndexError: single positional indexer is out-of-bounds

    在数据预处理过程中,出现:IndexError: single positional indexer is out-of-bounds 原因是在使用 Pandas 读取 dataframe 的时候,分 ...

  7. Debug 路漫漫-11:Python: TypeError: 'generator' object is not subscriptable

    调试程序,出现以下错误: Python: TypeError: 'generator' object is not subscriptable “在Python中,这种一边循环一边计算的机制,称为生成 ...

  8. Debug 路漫漫-10:AttributeError: 'Embedding' object has no attribute 'get_shape'

    CNN的Embedding层报错: 报错:AttributeError: 'Embedding' object has no attribute 'get_shape' 查了下是这个问题: https ...

  9. Debug 路漫漫-07

    201811—201903???   1)关于训练参数是复数的问题    ——q_k ^theta   q_k(是item的特征矩阵)中有可能是负数,而指数 theta 如果是含小数点的话,就会产生复 ...

随机推荐

  1. 深入理解 Kubernetes 资源限制:CPU

    原文地址:https://www.yangcs.net/posts/understanding-resource-limits-in-kubernetes-cpu-time/ 在关于 Kubernet ...

  2. ES6的强大变量声明

    ES6是javascript的新特性,今天来说说声明变量 过去我们声明变量,都是一个一个声明,现在有了一种新的声明方式,它可以将一个多个变量同时声明,声明后变量同时存在一个集合中,集合的数据类型是对象 ...

  3. 如何在相同的类名中单独为选中元素设置JS

    很多时候,我发现对一个类名添加事件,每次都是所有同类名元素一起触发,使用 this可以仅对当前选中的元素应用事件 如 $('.guowai button').click(function() { /* ...

  4. 利用Python读取图片exif敏感信息

    众所周知,现在很多的照相机等软件,拍摄会有选项,是否包含位置信息等. 当然有的人会说,我在微信中查看图片exif信息并没有啊,这是因为你发送到微信服务器的时候,微信帮你完成了保密工作. 常见的图片中包 ...

  5. idea使用过程中的一些常见问题,做个笔记

    :当实现这个接口方法时重载是不允许的. 首先我相信我的代码肯定没问题,因为我实现的接口确实有这个方法.在编程阶段就提示这个错误,于是我有理由相信应该是编译错误!通过google,解决办法so easy ...

  6. Shell基础 -Linux从入门到精通第九天(非原创)

    文章大纲 一.关于shell二.shell进阶(重点)三.学习资料下载四.参考文章   一.关于shell 1. 什么是shell 1.1 shell简介  Shell(外壳) 是一个用 C 语言编写 ...

  7. Ueditor文字和echarts图片 生成 word 前端解决方案

    编程就像搭积木,少了任何一个就拼接不起来,所有积木都找到就只剩下调试. 一.echarts  获取图片方法getDataURL  详细配置:https://www.echartsjs.com/zh/a ...

  8. linux中find命令的使用详解(转载)

    常用命令 find  (目录)   [-type d | f]  (文件夹 | 文件)   -name   (名称,可使用正则表达式) find  /root  -name "*core&q ...

  9. nginx 配置相关解析

    nginx模块处理流程一般是这样的: 客户端发送HTTP请求 –> Nginx基于配置文件中的位置选择一个合适的处理模块 ->(如果有)负载均衡模块选择一台后端服务器 –> 处理模块 ...

  10. SpringBoot配置多注册中心(yml,properties)

    dubbo-2.6.6 dubbo.config.multiple=true    dubbo.registries.z1.timeout = 5000    dubbo.registries.z1. ...