Caffe: 运行classify.py时报错 Mean shape incompatible with input shape
2016-05-06 11:20
381 查看
运行classify.py时报错 Mean shape incompatible with input shape
转载自:http://www.ithao123.cn/content-8389876.html[摘要:办理方式参考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:]
解决方法参考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.')
相关文章推荐
- 详解HTML5中rel属性的prefetch预加载功能使用
- bootstrap制作导航条
- jquery form 表单ajax提交使用
- HTML5 input元素新的特性
- PorterDuffXfermode 正确使用方式(详解)
- JavaScript学习总结二(Date对象的用法)
- jQuery实现下拉框功能实例代码
- 【颗粒归仓】(一)jQuery easyui datagrid 的数据加载
- javascript代码模块化Demo(使用Require.js)
- Chart.js docs
- EL获得数组长度
- JS 表单验证不使用alert框
- Bootstrap + Font Awesome
- 第二天:让我们一起来玩玩css精灵(css sprites)
- 知识普及:彻底搞懂CSS中单位px和em,rem的区别
- CSS基础(四):盒模型
- 一站通offer 树上最长单色路径
- CSS 实现:父元素包含子元素,子元素垂直居中布局
- 框架浮动widgets默认样式
- BootstrapValidator demo