SSD-tensorflow:ValueError: number of input channels does not match corresponding dimension of filter
来源:互联网 发布:卡拉扬去世 知乎 编辑:程序博客网 时间:2024/05/01 02:35
在利用caffe_to_tensorflow.py来转换模型之前,我们需要设置安装一下py caffe版本,如果不会的可以参考我的博客:
Ubuntu16.04安装教程
pycaffe的配置
当运行原作者给出命令,然后修改caffe的路径:
CAFFE_MODEL=./models/VGGNet/VOC0712Plus/SSD_512x512/VGG_VOC0712Plus_SSD_512x512_iter_240000.caffemodelpython caffe_to_tensorflow.py \ --model_name=ssd_300_vgg \ --num_classes=21 \ --caffemodel_path=${CAFFE_MODEL}会报错,信息为:
Traceback (most recent call last): File "caffe_to_tensorflow.py", line 65, in <module> tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "caffe_to_tensorflow.py", line 51, in main ssd_net.net(img_input, is_training=False) File "/home/whsyxt/Downloads/SSD-Tensorflow/nets/ssd_vgg_300.py", line 155, in net scope=scope) File "/home/whsyxt/Downloads/SSD-Tensorflow/nets/ssd_vgg_300.py", line 516, in ssd_net normalizations[i]) File "/home/whsyxt/Downloads/SSD-Tensorflow/nets/ssd_vgg_300.py", line 418, in ssd_multibox_layer scope='conv_loc') File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args return func(*args, **current_args) File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1027, in convolution outputs = layer.apply(inputs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 503, in apply return self.__call__(inputs, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/base.py", line 450, in __call__ outputs = self.call(inputs, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/layers/convolutional.py", line 158, in call data_format=utils.convert_data_format(self.data_format, self.rank + 2)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 652, in convolution num_spatial_dims]))ValueError: number of input channels does not match corresponding dimension of filter, 512 != 256
正确的命令为:
CAFFE_MODEL=./models/VGGNet/VOC0712Plus/SSD_512x512/VGG_VOC0712Plus_SSD_512x512_iter_240000.caffemodelpython caffe_to_tensorflow.py \ --model_name=ssd_512_vgg \ --num_classes=21 \ --caffemodel_path=${CAFFE_MODEL}
注意model_name要与你的模型的input大小一致,我这里是512×512的,所以相应的要作出改变。
参考文献
[1].caffemodel conversion error:number of input channels does not match corresponding dimension of filter. https://github.com/balancap/SSD-Tensorflow/issues/106
阅读全文
0 0
- SSD-tensorflow:ValueError: number of input channels does not match corresponding dimension of filter
- Number of responses does not match queries
- Invalid parameter number: number of bound variables does not match number of tokens
- Error: The number of filter groups does not divide the total number of filters.
- Bad number of channels()
- DataTables warning: Added data does not match known number of columns
- TypeError: Input 'b' of 'MatMul' Op has type float32 that does not match type int32 of argument 'a'.
- TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int
- Could not load file or assembly '***' or one of its does not match the assembly reference
- python中关于Np.hstack()错误的ValueError: all the input arrays must have same number of dimensions
- Java compiler level does not match the version of the installed Java project
- CompressedSize in local header does not match that of central directory header in new zip file
- Eclipse Java compiler level does not match the version of the installed Java project facet.
- Java compiler level does not match the version of the installed Java project fac
- error: argument of type 'void* (My_Thread::)(void*)' does not match 'void *(*)(void*)'
- Java compiler level does not match the version of the installed Java project facet
- Java compiler level does not match the version of the installed Java project fac
- Error: Java compiler level does not match the version of the installed Java project facet.
- Windows下编译WebRTC
- 关于SpringBoot的配置文件
- 【Java】如何用Java实现数据库查询
- maven的settings.xml配置文件详解
- js javascript 获取各种时间计算方法
- SSD-tensorflow:ValueError: number of input channels does not match corresponding dimension of filter
- 微信公众号h5牛牛源码搭建教程
- 抓取Android平台数据包之tcpdump 工具的使用过程中出现的问题
- 第十周项目一__验证算法(4)
- 数百种编程语言,而我为什么要学 Python?
- Invalid handle returned
- python 调试
- 数据结构实验之二叉树一:树的同构
- Mybatis中的statementType="STATEMENT"使用注意