def _clip_boxes(boxes, im_shape):
 boxes[:, 0::4] = np.maximum(boxes[:, 0::4], 0)
 boxes[:, 1::4] = np.maximum(boxes[:, 1::4], 0)
 boxes[:, 2::4] = np.minimum(boxes[:, 2::4], (im_shape[1] - 1))
 boxes[:, 3::4] = np.minimum(boxes[:, 3::4], (im_shape[0] - 1))
 return boxes

def _clip_boxes ( boxes , im_shape ) : boxes [ : , 0 : : 4 ] = np . maximum ( boxes [ : , 0 : : 4 ] , 0 ) boxes [ : , 1 : : 4 ] = np . maximum ( boxes [ : , 1 : : 4 ] , 0 ) boxes [ : , 2 : : 4 ] = np . minimum ( boxes [ : , 2 : : 4 ] , ( im_shape [ 1 ] - 1 ) ) boxes [ : , 3 : : 4 ] = np . minimum ( boxes [ : , 3 : : 4 ] , ( im_shape [ 0 ] - 1 ) ) return boxes
clip boxes to image boundaries .