(bboxes, img_shape)
Flip bboxes horizontally.

    Args:
        bboxes(Tensor or ndarray): Shape (..., 4*k)
        img_shape(tuple): Image shape.

    Returns:
        Same type as `bboxes`: Flipped bboxes.
Flip bboxes horizontally.
Flip bboxes horizontally .
def bbox_flip(bboxes, img_shape):
    """Flip bboxes horizontally.

    Args:
        bboxes(Tensor or ndarray): Shape (..., 4*k)
        img_shape(tuple): Image shape.

    Returns:
        Same type as `bboxes`: Flipped bboxes.
    """
    if isinstance(bboxes, torch.Tensor):
        assert bboxes.shape[-1] % 4 == 0
        flipped = bboxes.clone()
        flipped[:, 0::4] = img_shape[1] - bboxes[:, 2::4] - 1
        flipped[:, 2::4] = img_shape[1] - bboxes[:, 0::4] - 1
        return flipped
    elif isinstance(bboxes, np.ndarray):
        return mmcv.bbox_flip(bboxes, img_shape)
def bbox_flip ( bboxes , img_shape ) : if isinstance ( bboxes , torch . Tensor ) : assert bboxes . shape [ - 1 ] % 4 == 0 flipped = bboxes . clone ( ) flipped [ : , 0 : : 4 ] = img_shape [ 1 ] - bboxes [ : , 2 : : 4 ] - 1 flipped [ : , 2 : : 4 ] = img_shape [ 1 ] - bboxes [ : , 0 : : 4 ] - 1 return flipped elif isinstance ( bboxes , np . ndarray ) : return mmcv . bbox_flip ( bboxes , img_shape )