def to_chw(image):
    """
    Transpose image from HWC to CHW.
    Args:
        image (np.array): an image with HWC layout.
    """
    # HWC to CHW
    if len(image.shape) == 3:
        image = np.swapaxes(image, 1, 2)
        image = np.swapaxes(image, 1, 0)
    return image

    Transpose image from HWC to CHW.
    Args:
        image (np.array): an image with HWC layout.
    
ppdet/metrics/widerface_utils.py