Imread returns 4 个维度,而预期是 3 个维度。为什么?
Imread returns 4 dimensions when 3 expected. Why?
我正在研究基于张量流的卷积神经网络。为了处理转换,SciKit 函数重塑了原始图像。我有一个意想不到的情况:
def read_img(file):
img = skimage.io.imread(img_folder + file)
print(img.shape)
img = skimage.transform.resize(img, (img_width, img_height), mode=mode)
return img[:,:,:img_channels]
阻止模型形成如下回溯:
File "A:\anoth\...\newmodel.py", line 76, in read_img
img = skimage.transform.resize(img, (img_width, img_height), mode=mode)
File "A:\anoth\...\skimage\transform\_warps.py", line 124, in resize
raise ValueError("len(output_shape) cannot be smaller than the image "
ValueError: len(output_shape) cannot be smaller than the image dimensions
输入变量(print(img.shape)
)的打印表明有一个图像进入模型,由 4 个维度组成
(2, 480, 720, 3)
当之前的文件有3个像:
(480, 720, 3)
这里可能发生了什么?当输入都是图像时,这个第四维是什么?
该数组是动画 GIF 的数组。
我正在研究基于张量流的卷积神经网络。为了处理转换,SciKit 函数重塑了原始图像。我有一个意想不到的情况:
def read_img(file):
img = skimage.io.imread(img_folder + file)
print(img.shape)
img = skimage.transform.resize(img, (img_width, img_height), mode=mode)
return img[:,:,:img_channels]
阻止模型形成如下回溯:
File "A:\anoth\...\newmodel.py", line 76, in read_img
img = skimage.transform.resize(img, (img_width, img_height), mode=mode)
File "A:\anoth\...\skimage\transform\_warps.py", line 124, in resize
raise ValueError("len(output_shape) cannot be smaller than the image "
ValueError: len(output_shape) cannot be smaller than the image dimensions
输入变量(print(img.shape)
)的打印表明有一个图像进入模型,由 4 个维度组成
(2, 480, 720, 3)
当之前的文件有3个像:
(480, 720, 3)
这里可能发生了什么?当输入都是图像时,这个第四维是什么?
该数组是动画 GIF 的数组。