【边喝caffee边Caffe 】(二)python版本的报错:Mean shape incompatible with input shape
来源:互联网 发布:利用java获取snmp开发 编辑:程序博客网 时间:2024/05/29 03:51
在运行Ubuntu上的python版本,希望对比一下C++的结果是否正确时,发现一直报错Mean shape incompatible with input shape
后来遍查网络,发现了一个解决方法,见
http://blog.csdn.net/gzljss/article/details/45849013
直接贴过来
------------------------------------------分割线-----------------------------------------
解决方法参考http://stackoverflow.com/questions/29842935/mean-shape-incompatible-with-input-shape-caffe-classification-error-in-io-py
在运行caffe的python例子时,命令行输入
- python classify.py cat.jpg foo
报错
ValueError: Mean shape incompatible with input shape.
原因是‘mean’与‘input’的尺寸不同造成的。
参考前面的文章,修改了 ./python/caffe/io.py 文件
将:
- if ms != self.inputs[in_][1:]:
- raise ValueError('Mean shape incompatible with input shape.')
修改为:
- if ms != self.inputs[in_][1:]:
- print(self.inputs[in_])
- in_shape = self.inputs[in_][1:]
- m_min, m_max = mean.min(), mean.max()
- normal_mean = (mean - m_min) / (m_max - m_min)
- mean = resize_image(normal_mean.transpose((1,2,0)),
- in_shape[1:]).transpose((2,0,1)) * \
- (m_max - m_min) + m_min
- #raise ValueError('Mean shape incompatible with input shape.')
0 0
- 【边喝caffee边Caffe 】(二)python版本的报错:Mean shape incompatible with input shape
- caffe运行出现Mean shape incompatible with input shape错误
- python调用caffe接口进行classify时提示Mean shape incompatible with input shape错误的解决方法
- python调用caffe接口进行classify时提示Mean shape incompatible with input shape错误的解决方法
- python调用caffe接口进行classify时提示Mean shape incompatible with input shape错误的解决方法
- Caffe: 运行classify.py时报错 Mean shape incompatible with input shape
- python调用caffe模型进行classify时读入mean文件错误:mean shape incompatible with input shape
- 运行classify.py时报错 Mean shape incompatible with input shape
- 运行classify.py时报错 Mean shape incompatible with input shape
- 运行classify.py时报错 Mean shape incompatible with input shape
- 【边喝caffee边Caffe 】(一)Caffe的安装
- 【Tensorflow】报错的坑--could not broadcast input array from shape (100,784) into shape (100)
- WLI:There are running instances with incompatible serialization shape问题解决
- 【边喝caffee边Caffe 】(三) Check failed: registry.count(t ype) == 1 (0 vs. 1) Unknown layer type
- shape
- Shape
- shape
- shape
- 堆和栈区别
- 编译错误 error: control may reach end of non-void function
- Java学习之InputStream中read()与read(byte[] b)
- 杭电计算机研究生复试2015年第二题
- hibernate3与hibernate4区别
- 【边喝caffee边Caffe 】(二)python版本的报错:Mean shape incompatible with input shape
- 指针指向类中的成员
- Linux min()的宏定义中的(void) (&_x == &_y)的含义
- 第一个windows应用程序
- poj 2352 树状数组
- 阿里云-workerman 服务器环境配置
- 负载均衡
- 试验nginx和apache的结合(此贴有疑问,未完工,暂做记录)
- Python爬虫之MySql5.7.11数据库安装教程及其路径选择