我正在尝试训练gif数据集,但出现此错误。 它说该错误可能是由于ResizeBilinear
这是调整线性双线性的代码
input_height, input_width = hub.get_expected_image_size(module_spec)
input_depth = hub.get_num_image_channels(module_spec)
gif_data = tf.placeholder(tf.string, name='DecodeGIFInput')
decoded_image = tf.image.decode_image(gif_data, channels=None,
dtype=tf.uint8, name=None)
# Convert from full range of uint8 to range [0,1] of float32.
decoded_image_as_float = tf.image.convert_image_dtype(decoded_image,
tf.float32)
decoded_image_4d = tf.expand_dims(decoded_image_as_float, 0)
resize_shape = tf.stack([input_height, input_width])
resize_shape_as_int = tf.cast(resize_shape, dtype=tf.int32)
resized_image = tf.image.resize_bilinear(decoded_image_4d,
resize_shape_as_int)
return gif_data, resized_image
这是指向完整文件github的链接。 Link to github retrain.py
答案 0 :(得分:0)
我假设您标题中的列表对应于[?,batch_size,height,width,channels]
。如果是这样,并且假设您不需要第一个维度([1]
),则可以替换
resized_image = tf.image.resize_bilinear(decoded_image_4d,resize_shape_as_int)
与
squeezed_image = tf.squeeze(decoded_image_4d,0)
resized_image = tf.image.resize_bilinear(squeezed_image,resize_shape_as_int)
tf.squeeze
将消除第一个尺寸(对应于轴0
),这将阻止错误弹出