直接上图,pascal数据中存在这么一张图片,尺寸为500X71,pascal图片预处理时会用到short_size_resize,如下:
def short_side_resize(img_tensor, gtboxes_and_label, target_shortside_len):
‘’’
:param img_tensor:[h, w, c], gtboxes_and_label:[-1, 5]
:param target_shortside_len:
:return:
‘’’
h, w = tf.shape(img_tensor)[0], tf.shape(img_tensor)[1]
new_h, new_w = tf.cond(tf.less(h, w),
true_fn=lambda: (target_shortside_len, target_shortside_len * w // h),
false_fn=lambda: (target_shortside_len * h // w, target_shortside_len))
img_tensor = tf.expand_dims(img_tensor, axis=0)
img_tensor = tf.image.resize_bilinear(img_tensor, [new_h, new_w])
ymin, xmin, ymax, xmax, label = tf.unstack(gtb
目标检测训练pascal,batch为1却会OOM!
最新推荐文章于 2024-03-25 12:03:14 发布