我使用extract_image_patches作为我的图像数据集,它具有动态维度。
我得到以下错误日志:
array_grad.py", line 604, in _ExtractImagePatchesGrad rows_out = int(ceil(rows_in / stride_r))
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'我试着用
1) image.set_shape方法
2)图像resizing_using_crop_or_pad以避免错误,但仍然存在错误。
Update1:下面是代码片段
#######
#shape=[batch_size,height,width, target_size2
out_processed_model2 =tf.reshape(out_processed2, shape = [tf.shape(image_patch_tf2)[0], tf.shape(image_patch_tf2)[1], tf.shape(image_patch_tf2)[2], target_size2])
#PostProcessing
as0, as1, as2, as3, as4, as5= tf.split(out_processed_model2, target_size, 0)
out_model2_batch_to_depth = tf.concat([as0, as1, as2, as3, as4, as5],3)
#Model-3 Preprocessing
s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15,s16, s17, s18, s19= tf.split(out_model2_batch_to_depth , target_size2, 3)
A_3= tf.concat([s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15,s16, s17, s18, s19],1)
out_model2_depth_to_batch=tf.reshape(A_3, [tf.shape(image_patch_tf2)[0]*target_size2, tf.shape(image_patch_tf2)[1], tf.shape(image_patch_tf2)[2], 1])
############################Model -3#######################
stride_h3= 2
stride_w3 = 4
cell3 = 50
target_size3 = 80
input_size3 =stride_h3*stride_w3
image_patch_tf3 = tf.extract_image_patches(images = out_model2_depth_to_batch, ksizes = [1, stride_h3, stride_w3, 1], strides = [1, stride_h3, stride_w3, 1], rates = [1,1,1,1], padding="SAME", name="Extract_Image_Patches3")发布于 2017-07-21 03:59:47
根据错误,您正在尝试将NoneType用于rows_in。这很可能意味着,不管您如何设置这个变量,都是不正确的。
错误信息准确地告诉您发生了什么。unsupported operand type(s) for /告诉您,无论是什么原因造成的错误正在发生在您的部门。它提供给您的两种类型之后,NoneType和int告诉您与该操作一起使用的两个变量的类型。由于不能将任何一个除以int,因此会发生错误。
https://stackoverflow.com/questions/45228701
复制相似问题