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 如果是含小数点的话,就会产生复 ...
随机推荐
- .NetCore使用NLog写入数据库总结
考虑到项目后期添加日志的需求,抽个闲暇时间学习一下使用NLog插件将日志信息写入到数据库中,完整项目见下面: 遇到的问题: 使用NLog写到SQLServer里面的中文显示问号? 解决方法:调整数据库 ...
- c#专业的UVC摄像头深控类库-SharpCamera介绍
SharpCamera是专业的UVC摄像头深控类库.允许您在C#代码内修改摄像头的高级参数,比如亮度.对比度.清晰度.色调.饱和度.伽玛值.白平衡.逆光对比.增益.缩放.焦点.曝光.光圈.全景.倾斜. ...
- Flask中request与response参数
目录 request response request from flask import Flask from flask import request app = Flask(__name__) ...
- Redis基本使用(一)
redis window系统的redis是微软团队根据官方的linux版本高仿的 官方原版: https://redis.io/ 中文官网:http://www.redis.cn 1 redis下载和 ...
- Linux shell awk数组使用
awk中使用数组 一.数组格式 数组是一个包含一系列元素的表. 格式如下: abc[1]="xiaohong" abc[2]="xiaolan" ...
- dapi 基于Django的轻量级测试平台六 怎样使用压测功能
QQ群: GitHub:https://github.com/yjlch1016/dapi JMeter非GUI模式下: jmeter -n -t jmx脚本 -l jtl文件 -e -o 测试报告目 ...
- 云数据库 Redis 版,知识点
资料 网址 什么是云数据库Redis版 https://help.aliyun.com/document_detail/26342.html?spm=a2c4g.11174283.6.542.6b11 ...
- 20180610模拟赛T3——书本整理
[问题描述] 小明的书架上放了许多书,为了使书架变得整洁,小明决定整理书架,他将所有书按高度大小排列,这样排了之后虽然整齐了许多,但小明发现,书本的宽度不同,导致书架看上去还是有些凌乱.小明把这个凌乱 ...
- Django 缓存配置的多种方式
django 的缓存配置有多种方式,主要包含以下几种: 1.开发调试模式 2.内存模式 3.使用文件 4.直接使用数据库 5.使用redis或者memcache 这里主要是记录一下那些不常用,但是在微 ...
- wp_list_categories()函数使用方法|wordpress函数
wp_list_categories()函数是将分类以链接的形式罗列出来,点击分类的链接,就可以访问该分类页面.我们有时候会在一些页面调用分类链接,这时这个函数就可以用上了.注意: wp_list_c ...