def denormalize_colors(rgb_norm, mean_rgb=(0.485, 0.456, 0.406), std_rgb=(0.229, 0.224, 0.225)):
    """
    Denormalize colors

    Args:
        rgb_norm: Image in RGB format, normalized by normalize_colors()
            Numpy array of shape (h, w, 3)
        mean_rgb, std_rgb: Mean and standard deviation for RGB channels used
            Array_likes of length 3
            Optional; default to results computed from a random subset of ImageNet training images

    Returns:
        rgb_0to1_out: Output image in RGB format, with channels normalized
            Numpy array of the same shape as input
    """
    assert ('float' in rgb_norm.dtype.name), "Input image must be color-normalized and hence be float"

    if rgb_norm.ndim == 3:
        # HxWx3
        for i in range(3):
            rgb_norm[:, :, i] = rgb_norm[:, :, i] * std_rgb[i] + mean_rgb[i]
    elif rgb_norm.ndim == 4:
        # Nx3xHxW
        for i in range(3):
            rgb_norm[:, i, :, :] = rgb_norm[:, i, :, :] * std_rgb[i] + mean_rgb[i]
    else:
        raise NotImplementedError(rgb_norm.ndim)

    return rgb_norm