(boxes, hw)
return clip_box
Clip the boxes into the image region.
Clip the boxes into the image region.
Clip the boxes into the image region .
def get_clipped_boxes(boxes, hw):
    """ Clip the boxes into the image region."""
    # x1 >=0
    box_x1 = F.clip(boxes[:, 0::4], lower=0, upper=hw[1])
    # y1 >=0
    box_y1 = F.clip(boxes[:, 1::4], lower=0, upper=hw[0])
    # x2 < im_info[1]
    box_x2 = F.clip(boxes[:, 2::4], lower=0, upper=hw[1])
    # y2 < im_info[0]
    box_y2 = F.clip(boxes[:, 3::4], lower=0, upper=hw[0])

    clip_box = F.concat([box_x1, box_y1, box_x2, box_y2], axis=1)

    return clip_box
def get_clipped_boxes ( boxes , hw ) : # x1 >=0 box_x1 = F . clip ( boxes [ : , 0 : : 4 ] , lower = 0 , upper = hw [ 1 ] ) # y1 >=0 box_y1 = F . clip ( boxes [ : , 1 : : 4 ] , lower = 0 , upper = hw [ 0 ] ) # x2 < im_info[1] box_x2 = F . clip ( boxes [ : , 2 : : 4 ] , lower = 0 , upper = hw [ 1 ] ) # y2 < im_info[0] box_y2 = F . clip ( boxes [ : , 3 : : 4 ] , lower = 0 , upper = hw [ 0 ] ) clip_box = F . concat ( [ box_x1 , box_y1 , box_x2 , box_y2 ] , axis = 1 ) return clip_box