报错: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相关推荐

  1. 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 训练时候 ...

  2. Protobuf报错CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):

    前言 Protobuf全称Protocol buffers,是Google研发的一种跨语言.跨平台的序列化结构的数据格式,是一个灵活的.高效的用于序列化数据的协议.使用protobuf时,既可以采用动 ...

  3. caffe 报错 Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered

    之前从没有遇到这样的问题,找了三个小时的bug和资料后,在此处发现了解决方案,他是这么说的: In my case the "top" and "bottom" ...

  4. oracle补丁报错10044,【案例】Oracle补丁 数据库打patch报错OPatch failed with error code 73...

    天萃荷净 运维DBA反映在给Oracle数据库安装patch补丁时报错OPatch failed with error code 73,分析原因为相关服务未关闭导致 打patch出现Copy fail ...

  5. 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,对某工单执行入 ...

  6. Android报错——connect failed: EHOSTUNREACH (No route to host)

    2019独角兽企业重金招聘Python工程师标准>>> Android报错--connect failed: EHOSTUNREACH (No route to host) 没有路由 ...

  7. 关于android 5.0报错:dlopen failed: couldn't map ... Permission denied

    问题描述: 我的应用当中集成了一个安全相关的sdk,而这个sdk中使用的so是加过壳的. 它加载native so的方式是:Java System.loadLibrary --> native ...

  8. 解决Mac安装tesserocr报错问题 Failed building wheel for

    解决Mac安装tesserocr报错问题 Failed building wheel for 参考文章: (1)解决Mac安装tesserocr报错问题 Failed building wheel f ...

  9. 【错误记录】Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )

    文章目录 一.报错信息 二.解决方案 一.报错信息 在 Android Studio 中首次向 GitHub 提交代码 , 报错 : Push failed: Failed with error: C ...

最新文章

  1. 下拉列表怎么判断html,判断下拉列表中的值,实现页面跳转,请问这个怎么判断?...
  2. 数塔 HDU - 2084
  3. Cisco C2960 升级IOS
  4. 各种环境下的渗透测试
  5. 无法访问你试图使用的功能所在的网络位置_[steam实用工具]解决无法访问商店/社区/好友列表的问题...
  6. 如何通过示例使用Java中的Exchanger
  7. SpringMVC学习记录--Validator验证分析
  8. C++学习之路 | PTA乙级—— 1020 月饼 (25分)(带注释)(精简)
  9. 父页面监听iframe路由变化_前端路由原理
  10. .NET中异常类(Exception)
  11. JAX-WS编写webservice
  12. Selenium爬虫 -- 图片视频的src绝对地址链接分析
  13. 一个简单的二层系统分析全程
  14. 推荐几款免费的MacOS/MacBook pro/MacBook air读取NTFS格式磁盘软件(完全免费)
  15. Win10 IE浏览器无法打开HTTPS网站的解决方法--win10专业版
  16. C++字符串大小写转换
  17. c#--在异步方法中异步地等待任务
  18. 如何制作自己的网站?
  19. FANUC机器人有关执行程序的停止和恢复的说明
  20. SpringCloud系列之六

热门文章

  1. Oracle查询库中记录数大于2千万的所有表
  2. python毕业设计作品基于django框架外卖点餐系统毕设成品(4)开题报告
  3. MATLAB中bar函数的使用
  4. 英特尔处理器上有8个新的漏洞
  5. A股市场全景分析系列—在调整阶段建立自己的概念板块监测池
  6. java moco_使用moco单元测试
  7. 泰山OFFICE技术讲座:奇怪的Times New Roman字体的高度
  8. 【大话GSM】物理信道与逻辑信道映射详细解析
  9. 腾讯云AMD EPYC Milan(2.55GHz/3.5GHz)服务器CPU处理器
  10. 人生因奋斗而变得有意义