(img, cfg)
return img
formats the image channels based on config
formats the image channels based on config
formats the image channels based on config
def format_img_channels(img, cfg):
    """ formats the image channels based on config """
    img = img[:, :, (2, 1, 0)]
    img = img.astype(np.float32)
    img[:, :, 0] -= cfg.img_channel_mean[0]
    img[:, :, 1] -= cfg.img_channel_mean[1]
    img[:, :, 2] -= cfg.img_channel_mean[2]
    img /= cfg.img_scaling_factor
    img = np.transpose(img, (2, 0, 1))
    img = np.expand_dims(img, axis=0)
    return img
def format_img_channels ( img , cfg ) : img = img [ : , : , ( 2 , 1 , 0 ) ] img = img . astype ( np . float32 ) img [ : , : , 0 ] -= cfg . img_channel_mean [ 0 ] img [ : , : , 1 ] -= cfg . img_channel_mean [ 1 ] img [ : , : , 2 ] -= cfg . img_channel_mean [ 2 ] img /= cfg . img_scaling_factor img = np . transpose ( img , ( 2 , 0 , 1 ) ) img = np . expand_dims ( img , axis = 0 ) return img