【发布时间】:2016-04-09 06:31:26
【问题描述】:
我在使用 caffe 从图像生成 HDF5 数据文件时遇到了这个问题。
caffe.io.load_image 将图像加载到标准化范围 0-1 内的变量中。
调整大小,但 img 中的所有值都转换为零
img = caffe.io.load_image( patht_to_file )
print img.shape
print img.dtype
img = caffe.io.resize( img, (3,SIZE, SIZE) ) #resizes but all values in img converted to zero
print img.shape
print img.dtype
我得到的输出是
(240, 320, 3)
float32
(3, 58, 58)
float64
img 的值已将某些值更改为全 0
谁能帮我解决这个问题。
我想要相同的 float32 更改 resize 命令的顺序给出正确的输出
为 var img 提供实数非零值
但顺序和类型不是我需要的
img = caffe.io.resize( img, (SIZE, SIZE, 3) ) # Gives real non zero values to var img
print img.shape
print img.dtype
输出
(240, 320, 3)
float32
(58, 58, 3)
float64
我需要形状为 3,58,58,而不会将所有值都转换为零,即真实数据
【问题讨论】:
-
您觉得与
img = caffe.io.resize_image( img, (SIZE,SIZE), interp_order=3 )有很大不同吗?因为我正在做类似的实验并将图像大小调整为网络输入 (data) 大小不会改变我的结果!
标签: python image-processing neural-network deep-learning caffe