在运行ShuffleNet的过程中碰到了如下报错 :

I1018 19:26:19.104892  3548 net.cpp:84] Creating Layer resx13_concat
I1018 19:26:19.104895  3548 net.cpp:406] resx13_concat <- resx13_match_conv
I1018 19:26:19.104898  3548 net.cpp:406] resx13_concat <- resx13_conv3
I1018 19:26:19.104902  3548 net.cpp:380] resx13_concat -> resx13_concat
F1018 19:26:19.104913  3548 concat_layer.cpp:42] Check failed: top_shape[j] == bottom[i]->shape(j) (1 vs. 2) All inputs must have the same shape, except at concat_axis.
*** Check failure stack trace: ***@     0x7f2beb8fcdaa  (unknown)@     0x7f2beb8fcce4  (unknown)@     0x7f2beb8fc6e6  (unknown)@     0x7f2beb8ff687  (unknown)@     0x7f2bebfc6227  caffe::ConcatLayer<>::Reshape()@     0x7f2bec05e365  caffe::Net<>::Init()@     0x7f2bec060262  caffe::Net<>::Net()@     0x7f2bec01b9a0  caffe::Solver<>::InitTrainNet()@     0x7f2bec01c8f3  caffe::Solver<>::Init()@     0x7f2bec01cbcf  caffe::Solver<>::Solver()@     0x7f2bec079b01  caffe::Creator_SGDSolver<>()@           0x40ee6e  caffe::SolverRegistry<>::CreateSolver()@           0x407efd  train()@           0x40590c  main@     0x7f2bea908f45  (unknown)@           0x40617b  (unknown)@              (nil)  (unknown)

可以看到,是输入和输出的blob尺寸不对才导致了这个错误,查看训练的log文件,报错是在

I1018 19:26:19.104895  3548 net.cpp:406] resx13_concat <- resx13_match_conv
I1018 19:26:19.104898  3548 net.cpp:406] resx13_concat <- resx13_conv3
I1018 19:26:19.104902  3548 net.cpp:380] resx13_concat -> resx13_concat

层上面,也就是Concat层数据传输有问题,在这之前也有相似的Concat连接,刚开始也是没有头绪,通过仔细查看前面concat连接的日志发现了问题所在。

I1018 19:26:19.052892  3548 net.cpp:84] Creating Layer resx1_conv3
I1018 19:26:19.052904  3548 net.cpp:406] resx1_conv3 <- resx1_conv2
I1018 19:26:19.052908  3548 net.cpp:380] resx1_conv3 -> resx1_conv3
I1018 19:26:19.053154  3548 net.cpp:122] Setting up resx1_conv3
I1018 19:26:19.053160  3548 net.cpp:129] Top shape: 90 216 6 6 (699840)

上面是rex1_conv3层的定义,可以看见输出shape 为 [90 216 6 6]

I1018 19:26:19.051407  3548 net.cpp:84] Creating Layer resx1_match_conv
I1018 19:26:19.051409  3548 net.cpp:406] resx1_match_conv <- pool1_pool1_0_split_0
I1018 19:26:19.051414  3548 net.cpp:380] resx1_match_conv -> resx1_match_conv
I1018 19:26:19.051427  3548 net.cpp:122] Setting up resx1_match_conv
I1018 19:26:19.051434  3548 net.cpp:129] Top shape: 90 24 6 6 (77760)

上面是resx1_match_conv层的定义,可以看见输出的shape 为 [90 24 6 6]
然后:

I1018 19:26:19.053496  3548 net.cpp:84] Creating Layer resx1_concat
I1018 19:26:19.053500  3548 net.cpp:406] resx1_concat <- resx1_match_conv
I1018 19:26:19.053503  3548 net.cpp:406] resx1_concat <- resx1_conv3
I1018 19:26:19.053508  3548 net.cpp:380] resx1_concat -> resx1_concat
I1018 19:26:19.053527  3548 net.cpp:122] Setting up resx1_concat
I1018 19:26:19.053532  3548 net.cpp:129] Top shape: 90 240 6 6 (777600)
I1018 19:26:19.053534  3548 net.cpp:137] Memory required for data: 51244200

正常输入,网络继续搭建。

————————————–分割线—————————————

I1018 19:26:19.102349  3548 net.cpp:84] Creating Layer resx13_match_conv
I1018 19:26:19.102351  3548 net.cpp:406] resx13_match_conv <- resx12_elewise_resx12_elewise_relu_0_split_0
I1018 19:26:19.102355  3548 net.cpp:380] resx13_match_conv -> resx13_match_conv
I1018 19:26:19.102373  3548 net.cpp:122] Setting up resx13_match_conv
I1018 19:26:19.102377  3548 net.cpp:129] Top shape: 90 480 1 1 (43200)

此时resx13_match_conv的输出shape是 [ 90 480 1 1]

I1018 19:26:19.103997  3548 net.cpp:84] Creating Layer resx13_conv3
I1018 19:26:19.103999  3548 net.cpp:406] resx13_conv3 <- resx13_conv2
I1018 19:26:19.104003  3548 net.cpp:380] resx13_conv3 -> resx13_conv3
I1018 19:26:19.104576  3548 net.cpp:122] Setting up resx13_conv3
I1018 19:26:19.104599  3548 net.cpp:129] Top shape: 90 480 2 2 (172800)

此时resx13_conv3的输出shape是 [ 90 480 2 2 ]

这就是top_shape[j] == bottom[i]->shape(j) (1 vs. 2)报错是(1 vs. 2)的原因。

解决方法

我们需要在train.prototxt修改网络参数,来让resx13_match_conv的输出也变成[ 90 480 2 2],所以找到resx13_match_conv层的定义:

layer {name: "resx13_match_conv"type: "Pooling"bottom: "resx12_elewise"top: "resx13_match_conv"pooling_param {pool: AVEkernel_size: 3stride: 2}
}

因为上一层来的数据从下面日志文件可以读到shape是:[ 90 480 3 3]

I1018 19:26:19.102326  3548 net.cpp:122] Setting up resx12_elewise_resx12_elewise_relu_0_split
I1018 19:26:19.102330  3548 net.cpp:129] Top shape: 90 480 3 3 (388800)
I1018 19:26:19.102334  3548 net.cpp:129] Top shape: 90 480 3 3 (388800)
I1018 19:26:19.102335  3548 net.cpp:137] Memory required for data: 256336200
I1018 19:26:19.102337  3548 layer_factory.hpp:77] Creating layer resx13_match_conv
I1018 19:26:19.102349  3548 net.cpp:84] Creating Layer resx13_match_conv
I1018 19:26:19.102351  3548 net.cpp:406] resx13_match_conv <- resx12_elewise_resx12_elewise_relu_0_split_0
I1018 19:26:19.102355  3548 net.cpp:380] resx13_match_conv -> resx13_match_conv
I1018 19:26:19.102373  3548 net.cpp:122] Setting up resx13_match_conv
I1018 19:26:19.102377  3548 net.cpp:129] Top shape: 90 480 1 1 (43200)

所以这里将 kernel_size: 3 改为 kernel_size: 2,即:

layer {name: "resx13_match_conv"type: "Pooling"bottom: "resx12_elewise"top: "resx13_match_conv"pooling_param {pool: AVEkernel_size: 2stride: 2}
}

这样就可以改变输出的数据shape,网络就可以成功训练了!

Check failed: top_shape[j] == bottom[i]-shape(j) (1 vs. 2) All inputs must have the same shape, exc相关推荐

  1. Failed startup of context o.e.j.w.WebAppContext@e7892a8{/admin,file:///activemq/webapps/admin/,STOPP

    activemq 报错及解决步骤 一.报错情况 报错一: 1.重点内容: 2.完整报错内容: 报错二: 1.重点内容: 2.完整报错内容: 二.处理步骤 2.1 问题一解决方法: 2.2 问题二解决方 ...

  2. Check failed: 0 == bottom[0]-count() % explicit_count (0 vs. 76) bottom count (160600) must be divi

    问题:Check failed: 0 == bottom[0]->count() % explicit_count (0 vs. 76) bottom count (160600) must b ...

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

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

  4. 【caffe】 Check failed: error == cudaSuccess (30 vs. 0) unknown error

    解决办法 : 加 sudo 用caffe,不报错,那一定要的时假caffe. ubuntu16.04 ,写了一个.py文件调用resnet.caffemodel 来对图片进行分类. 但是在运行时出错, ...

  5. windows7下解决caffe check failed registry.count(type) == 1(0 vs. 1) unknown layer type问题

    在Windows7下调用vs2013生成的Caffe静态库时经常会提示Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer t ...

  6. mxnet dmlc-core\src\io\local_filesys.cc: Check failed: allow_null

    mxnet加载模型设计文件,报错了 sym = mx.sym.load(args.symbol_path) local_filesys.cc:209: Check failed: allow_null ...

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

  8. Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0) CUDNN_STATUS_INTERNAL_ERROR

    pycharm调用cuda时报错: Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0)  CUDNN_STATUS_INTERNAL_ERRO ...

  9. Check failed: error == cudaSuccess (35 vs. 0) CUDA driver version is insufficient for CUDA runtime

    Check failed: error == cudaSuccess (35 vs. 0)  CUDA driver version is insufficient for CUDA runtime ...

最新文章

  1. JMeter基础之一个简单的性能测试
  2. 从强制卸载Office到强制安装WPS
  3. 批量绑定(bulk binds):FOR循环与FORALL的性能比较
  4. 指数型生成函数[bzoj3456]城市规划
  5. esp8266 rtos 开发环境 ubuntu_Ubuntu快速搭建C++开发环境(VS Code编辑器)
  6. asp.net页面的验证码代码
  7. vue-cli3 项目从搭建优化到docker部署
  8. python嵌套列表输出_Python列表的增删改查排嵌套特殊输出格式
  9. 信捷PLC应用-三轴钻孔机
  10. Semantic Nets
  11. badboy linux 版本,jmeter/Badboy安装教程
  12. python 判断健在循环字典的第几层_2.关于python的if判断,循环总结。
  13. 2019深圳入户攻略
  14. gridcontrol 添加行删除行
  15. gitea 忘记密码 重设密码
  16. JsDelivr CDN缓存刷新工具-缓存清除-缓存更新
  17. 极客标签:可能是目前最好的前端代码学习工具
  18. python kfold交叉验证_KFold交叉验证
  19. 微信小程序地图标记点marker,点击标记点显示详细信息
  20. android友盟自定义事件,友盟统计事件添加

热门文章

  1. navicat导入sql文件成功但没有表
  2. svn: E155037: Previous operation has not finished; run 'cleanup' if it was i
  3. golang计算任意两点间的方位角
  4. Android通讯录(联系人)-ContentProvider
  5. 加速Yahoo收录你博客的窍门
  6. clannad手游汉化版_clannad游戏中文版
  7. 交互式多模型算法IMM——机动目标跟踪中的应用
  8. 今天,彻底弄懂什么是URI
  9. 使用MMX/SSE汇编指令集优化视频开发
  10. trim函数 html,jQuery trim()函数怎么用?