当前位置:网站首页>keras转tf.keras中VGG19 input_shape
keras转tf.keras中VGG19 input_shape
2022-06-29 08:26:00 【端木宬】
使用tf.keras时出现报错。从keras改到tf中出现
结论:shape过大,不符合输入要求
更新:nice!之后试试这个
Traceback (most recent call last):
File "srgan.py", line 406, in <module>
gan = SRGAN()
File "srgan.py", line 63, in __init__
self.vgg = self.build_vgg()
File "srgan.py", line 150, in build_vgg
img_features = vgg(img)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 922, in __call__
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\network.py", line 719, in call
convert_kwargs_to_constants=base_layer_utils.call_context().saving)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\network.py", line 888, in _run_internal_graph
output_tensors = layer(computed_tensors, **kwargs)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 886, in __call__
self.name)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\input_spec.py", line 216, in assert_input_compatibility
' but received input with shape ' + str(shape))
ValueError: Input 0 of layer fc1 is incompatible with the layer: expected axis -1 of input shape to have value 25088 but received input with shape [None, 32768]
检查了img的shape(相关blog),两种引用shape一致。
检查两种应用api是否有区别:
tensorflow内input_shape[224.224.3]
keras内input_shape:299*299
代码测试img的shape为 256,256,3
warning也显示
WARNING:tensorflow:Model was constructed with shape (None, 224, 224, 3) for input Tensor("input_1:0", shape=(None, 224, 224, 3), dtype=float32), but it was called on an input with incompatible shape (None, 256, 256, 3).
改小shape
- 新错误,改低了tensorflow版本为1后未出现
X_test.shape:(None, 224, 224, 3)
X_test[num].shape:(224, 224, 3)
Traceback (most recent call last):
File "srgan.py", line 404, in <module>
gan = SRGAN()
File "srgan.py", line 63, in __init__
self.vgg = self.build_vgg()
File "srgan.py", line 148, in build_vgg
img_features = vgg(img)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 922, in __call__
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\network.py", line 719, in call
convert_kwargs_to_constants=base_layer_utils.call_context().saving)
File "C:\python3_7\lib\site-packages\tensorflow\python\keras\engine\network.py", line 900, in _run_internal_graph
tensor = tensor_dict[str(id(x))].pop()
IndexError: pop from empty list
- 绕不开,用gpu训练存在这个问题(?)
添加链接描述
边栏推荐
- First electric shock, so you are such a dragon lizard community | dragon lizard developer said that issue 8
- uni-app获取当前页面路由url
- Member inner class, static inner class, local inner class
- 图片格式-webp
- Measure the level of various chess playing activities through ELO mechanism
- Is the securities account of qiniu school really safe and reliable?
- P4769-[noi2018] bubble sort [combinatorics, tree array]
- 宏,函数和内联函数
- 2022春夏系列 KOREANO ESSENTIAL重塑时装生命力
- Verilog reduction operator
猜你喜欢
![[untitled]](/img/6e/5dd5dcff89a74f7d367c9186a77268.png)
[untitled]

ActiveMQ message component publish subscribe redelivery message redelivery

Verilog size and +: Using

微信小程序自定义多项选择器

微信小程序wx.navigateBack返回上一页携带参数

2022第六季完美童模 合肥赛区 决赛圆满落幕

2022春夏系列 KOREANO ESSENTIAL重塑时装生命力

Unity C # e-learning (12) -- protobuf generation protocol

Robcogen tutorial of robot code generator

今年的网络安全“体检”你做了吗?
随机推荐
背包九讲——全篇详细理解与代码实现
递归方法 rbac菜单层级显示 无限极分类
手写VirtualDOM
CDGA|交通行业做好数字化转型的核心是什么?
记自定义微信小程序顶部导航栏
MYSQL虚拟列
Verilog data type
图片格式-webp
查找字符串中重复次数最多的元素
微积分学习
Figure timers in SOC (I): what timers are there in the system?
The return values of hostname -f and uname -n may be different
工作好多年,回忆人生--高中三年
TypeScript 變量聲明 —— 類型斷言
Verilog 大小端以及 +:使用
对比HomeKit、米家,智汀家庭云版有哪些场景化的体验
一般乘法器设计,verilog code
微信小程序自定义多项选择器
General multiplier design, verilog code
C# 语音端点检测(VAD)实现过程分析