def rescale(x,max_range,min_range):
    max_val = np.max(x)
    min_val = np.min(x)
    return (max_range-min_range)/(max_val-min_val)*(x-max_val)+max_range

x=(rescale(x,1,0)-mean)/std but do it per channnel