mxnet报错 Check failed: dshp.ndim() == 4U (3 vs. 4) : Input data should be 4D in batch-num_filter-y-x
报错:mxnet.base.MXNetError: Error in operator conv0: [17:40:27] src/operator/nn/convolution.cc:152: Check failed: dshp.ndim() == 4U (3 vs. 4) : Input data should be 4D in batch-num_filter-y-x
明明输入数据是4维的,为什么报错?
因为用collections.namedtuple装载数据,进行前向预测时,没有给data外面加上括号。也就是放在list里面
Batch = namedtuple("Batch",["data","label"])
label = 123
print('label',label)
label = mx.nd.array([label])
mod.forward(Batch([img],[label])) # 注意 Batch([img])的形式
参考
完整报错很吓人,问题很简单
Traceback (most recent call last):File "/home/user1/pjs/frvt/arcface_Siamese_offline/recognition/tools/eval_on_train_set.py", line 70, in <module>mod.forward(Batch(imgsNoMask))File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/module/module.py", line 625, in forwardself.reshape(new_dshape, new_lshape)File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/module/module.py", line 472, in reshapeself._exec_group.reshape(self._data_shapes, self._label_shapes)File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/module/executor_group.py", line 396, in reshapeself.bind_exec(data_shapes, label_shapes, reshape=True)File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/module/executor_group.py", line 372, in bind_execallow_up_sizing=True, **dict(data_shapes_i + label_shapes_i))File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/executor.py", line 458, in reshapectypes.byref(handle)))File "/home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/base.py", line 253, in check_callraise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: Error in operator conv0: [17:40:27] src/operator/nn/convolution.cc:152: Check failed: dshp.ndim() == 4U (3 vs. 4) : Input data should be 4D in batch-num_filter-y-x
Stack trace:[bt] (0) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x4b04cb) [0x7ff30319c4cb][bt] (1) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x8eb956) [0x7ff3035d7956][bt] (2) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x26206f2) [0x7ff30530c6f2][bt] (3) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x2622f68) [0x7ff30530ef68][bt] (4) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(mxnet::exec::GraphExecutor::Reshape(bool, bool, mxnet::Context const&, std::map<std::string, mxnet::Context, std::less<std::string>, std::allocator<std::pair<std::string const, mxnet::Context> > > const&, std::unordered_map<std::string, mxnet::TShape, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, mxnet::TShape> > > const&, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*, std::vector<mxnet::NDArray, std::allocator<mxnet::NDArray> >*)+0x2a5) [0x7ff3052f9745][bt] (5) /home/user1/miniconda3/envs/hardsample/lib/python2.7/site-packages/mxnet/libmxnet.so(MXExecutorReshapeEx+0x98c) [0x7ff305235bfc][bt] (6) /home/user1/miniconda3/envs/hardsample/lib/python2.7/lib-dynload/../../libffi.so.7(+0x69dd) [0x7ff33b1679dd][bt] (7) /home/user1/miniconda3/envs/hardsample/lib/python2.7/lib-dynload/../../libffi.so.7(+0x6067) [0x7ff33b167067][bt] (8) /home/user1/miniconda3/envs/hardsample/lib/python2.7/lib-dynload/_ctypes.so(_ctypes_callproc+0x4de) [0x7ff33b1809de]
mxnet报错 Check failed: dshp.ndim() == 4U (3 vs. 4) : Input data should be 4D in batch-num_filter-y-x相关推荐
- caffe 报错 Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encounteredcaffe
caffe 报错 Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered 训练时候 ...
- Protobuf报错CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
前言 Protobuf全称Protocol buffers,是Google研发的一种跨语言.跨平台的序列化结构的数据格式,是一个灵活的.高效的用于序列化数据的协议.使用protobuf时,既可以采用动 ...
- caffe 报错 Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered
之前从没有遇到这样的问题,找了三个小时的bug和资料后,在此处发现了解决方案,他是这么说的: In my case the "top" and "bottom" ...
- oracle补丁报错10044,【案例】Oracle补丁 数据库打patch报错OPatch failed with error code 73...
天萃荷净 运维DBA反映在给Oracle数据库安装patch补丁时报错OPatch failed with error code 73,分析原因为相关服务未关闭导致 打patch出现Copy fail ...
- SAP MIGO对工单做101收货,报错 - Check table TFBEFU_CR entry 10 does not exist – 对策
SAP MIGO对工单做101收货,报错 - Check table TFBEFU_CR entry 10 does not exist – 对策 执行事务代码MIGO,移动类型101,对某工单执行入 ...
- Android报错——connect failed: EHOSTUNREACH (No route to host)
2019独角兽企业重金招聘Python工程师标准>>> Android报错--connect failed: EHOSTUNREACH (No route to host) 没有路由 ...
- 关于android 5.0报错:dlopen failed: couldn't map ... Permission denied
问题描述: 我的应用当中集成了一个安全相关的sdk,而这个sdk中使用的so是加过壳的. 它加载native so的方式是:Java System.loadLibrary --> native ...
- 解决Mac安装tesserocr报错问题 Failed building wheel for
解决Mac安装tesserocr报错问题 Failed building wheel for 参考文章: (1)解决Mac安装tesserocr报错问题 Failed building wheel f ...
- 【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )
文章目录 一.报错信息 二.解决方案 一.报错信息 在 Android Studio 中首次向 GitHub 提交代码 , 报错 : Push failed: Failed with error: C ...
最新文章
- 下拉列表怎么判断html,判断下拉列表中的值,实现页面跳转,请问这个怎么判断?...
- 数塔 HDU - 2084
- Cisco C2960 升级IOS
- 各种环境下的渗透测试
- 无法访问你试图使用的功能所在的网络位置_[steam实用工具]解决无法访问商店/社区/好友列表的问题...
- 如何通过示例使用Java中的Exchanger
- SpringMVC学习记录--Validator验证分析
- C++学习之路 | PTA乙级—— 1020 月饼 (25分)(带注释)(精简)
- 父页面监听iframe路由变化_前端路由原理
- .NET中异常类(Exception)
- JAX-WS编写webservice
- Selenium爬虫 -- 图片视频的src绝对地址链接分析
- 一个简单的二层系统分析全程
- 推荐几款免费的MacOS/MacBook pro/MacBook air读取NTFS格式磁盘软件(完全免费)
- Win10 IE浏览器无法打开HTTPS网站的解决方法--win10专业版
- C++字符串大小写转换
- c#--在异步方法中异步地等待任务
- 如何制作自己的网站?
- FANUC机器人有关执行程序的停止和恢复的说明
- SpringCloud系列之六