Debug 路漫漫-08:Keras 版本升级函数变换导致的问题
在使用 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_sizestride->stridesborder_mode->padding
4、Pooling2D,3D
border_mode->paddingdim_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 版本升级函数变换导致的问题的更多相关文章
- Debug 路漫漫-05
Debug 路漫漫-05: 1.使用这种方式计算 AUC 指标,结果出来居然是 NAN, —— 分母为(M*N),M或者N必有一个为0 了.(nan出现的情况绝大部分是分母出现0了) 若分子为0的 ...
- Debug 路漫漫-03
Debug 路漫漫-03:SVD++的 Matlab 版本 SVD++ 的 pu 这一项: 圈圈中的这一项,它既然要和pu 相加 的话 ,那么,它的维度也应该是 m*K.(就是维度和Pu一致的 . 而 ...
- Debug 路漫漫-01
运行到子函数时提示报错: === 这个断点一步步debug下来是顺利的,但是咋就超出数组范围了呢,这会是什么问题. ——sess肯定超过索引了,那个sess(:,2)的值肯定超过V的行数了. ——由 ...
- Debug 路漫漫-15:Python: NameError:name 'dataset' is not defined
在调试 <Outer Product-based Neural Collaborative Filtering>论文的源码(https://github.com/duxy-me/ConvN ...
- Debug 路漫漫-02
重现标准 BTL Model ,using MATLAB: 1. 错误使用 cat要串联的数组的维度不一致.出错 cell2mat (line 83) m{n} = cat(1,c{:,n}); —— ...
- Debug 路漫漫-13:Python: pandas IndexError: single positional indexer is out-of-bounds
在数据预处理过程中,出现:IndexError: single positional indexer is out-of-bounds 原因是在使用 Pandas 读取 dataframe 的时候,分 ...
- Debug 路漫漫-11:Python: TypeError: 'generator' object is not subscriptable
调试程序,出现以下错误: Python: TypeError: 'generator' object is not subscriptable “在Python中,这种一边循环一边计算的机制,称为生成 ...
- Debug 路漫漫-10:AttributeError: 'Embedding' object has no attribute 'get_shape'
CNN的Embedding层报错: 报错:AttributeError: 'Embedding' object has no attribute 'get_shape' 查了下是这个问题: https ...
- Debug 路漫漫-07
201811—201903??? 1)关于训练参数是复数的问题 ——q_k ^theta q_k(是item的特征矩阵)中有可能是负数,而指数 theta 如果是含小数点的话,就会产生复 ...
随机推荐
- SQL Server merge用法
有两个表名:source 表和 target 表,并且要根据 source 表中匹配的值更新 target 表. 有三种情况: source 表有一些 target 表不存在的行.在这种情况下,需要将 ...
- 深入浅出JVM之垃圾收集算法
判断哪些对象需要被回收 引用计数算法: 给对象中添加一个引用计数器,每当有一个地方引用时,计数器值就加1:当引用失效时,计数器值就减1:任何时刻计数器为0的对象就是不可能再被使用的. 但是JVM没有使 ...
- 编译OpenCV提示opencv_contrib缺少boostdesc_bgm.i等文件
错误提示: ~/opencv_contrib/modules/xfeatures2d/src/boostdesc.:: fatal error: boostdesc_bgm.i: No such fi ...
- 记录Mac OS下编译Thrift库
方法一:brew管理工具安装Homebrew是Mac开发包管理工具,类似于Linux的apt-get之类的,实它相当于开发软件界的 Appstore.借助该管理工具,可以自动化地安装软件包,它会自动安 ...
- webrtc (6) 在Webrtc中集成VideoToolbox
来源:http://blog.csdn.net/wangruihit/article/details/46550853 VideoToolbox是iOS平台在iOS8之后开放的一个Framework, ...
- flink 安装及wordcount
1.下载 http://mirror.bit.edu.cn/apache/flink/ 2.安装 确保已经安装java8以上 解压flink tar zxvf flink-1.8.0-bin-scal ...
- 使用Python3导出MySQL查询数据
整理个Python3导出MySQL查询数据d的脚本. Python依赖包: pymysql xlwt Python脚本: #!/usr/bin/env python # -*- coding: utf ...
- TCP 通信时序及状态变迁
TCP 通信时序及状态变迁 参考链接: https://www.cnblogs.com/boxker/p/11214886.html https://blog.csdn.net/miss_ruoche ...
- iOS-快速开发直播APP所需第三方SDK
直播SDK 金山云, 推荐 七牛云, 推荐 阿里云(收费) 网易云(收费) 腾讯云(收费) 又拍云 播放SDK IJKPlayer 自定义IJKPlayer,进度条.音量.亮度 短视频SDK 七牛云( ...
- 常用dos命令(2)
文件管理 type 显示文本文件的内容. copy 将一份或多份文件复制到另一个位置. del 删除一个或数个文件. move 移动文件并重命名文件和目录.(Windows XP Home Editi ...