此函数是利用deltas对box修正,我并没有详细说明,若有问题,欢迎留言交流:


def clip_boxes_graph(boxes, window):
"""
boxes: [N, (y1, x1, y2, x2)]
window: [4] in the form y1, x1, y2, x2
"""
# Split
wy1, wx1, wy2, wx2 = tf.split(window, 4)
y1, x1, y2, x2 = tf.split(boxes, 4, axis=1)
# Clip
y1 = tf.maximum(tf.minimum(y1, wy2), wy1)
x1 = tf.maximum(tf.minimum(x1, wx2), wx1)
y2 = tf.maximum(tf.minimum(y2, wy2), wy1)
x2 = tf.maximum(tf.minimum(x2, wx2), wx1)
clipped = tf.concat([y1, x1, y2, x2], axis=1, name="clipped_boxes")
clipped.set_shape((clipped.shape[0], 4))
return clipped

相关文章:

  • 2021-09-09
  • 2021-12-14
  • 2021-08-25
  • 2021-08-15
  • 2022-12-23
  • 2021-12-09
猜你喜欢
  • 2021-12-17
  • 2021-05-16
  • 2021-11-15
  • 2021-04-20
  • 2021-09-15
  • 2021-12-01
  • 2021-06-16
相关资源
相似解决方案