def calculate_clipping(cfg, scale):
    """
    Helper function for calculating lo and hi.

    Args:
    -- cfg: configuration file for model
    -- scale: scale for lo, hi. If lo, hi in [0,255], scale is 1. If lo, hi in [0,1], scale is 1/255

    Returns:
    -- LO, HI: list, lower bound and upper bound of each channel
    """
    LO = []
    HI = []
    for c in range(3):
        lo = float(-cfg.MODEL.PIXEL_MEAN[c] / cfg.MODEL.PIXEL_STD[c])*scale
        hi = float((255.0 - cfg.MODEL.PIXEL_MEAN[c]) / cfg.MODEL.PIXEL_STD[c])*scale
        LO.append(lo)
        HI.append(hi)
    return LO, HI