def channel_shift_multi(x, intensity, channel_index=2):
 if is_random:
  factor = np.random.uniform((- intensity), intensity)
 else:
  factor = intensity
 results = []
 for data in x:
  data = np.rollaxis(data, channel_index, 0)
  (min_x, max_x) = (np.min(data), np.max(data))
  channel_images = [np.clip((x_channel + factor), min_x, max_x) for x_channel in x]
  data = np.stack(channel_images, axis=0)
  data = np.rollaxis(x, 0, (channel_index + 1))
  results.append(data)
 return np.asarray(results)

def channel_shift_multi ( x , intensity , channel_index = 2 ) : if is_random : factor = np . random . uniform ( ( - intensity ) , intensity ) else : factor = intensity results = [ ] for data in x : data = np . rollaxis ( data , channel_index , 0 ) ( min_x , max_x ) = ( np . min ( data ) , np . max ( data ) ) channel_images = [ np . clip ( ( x_channel + factor ) , min_x , max_x ) for x_channel in x ] data = np . stack ( channel_images , axis = 0 ) data = np . rollaxis ( x , 0 , ( channel_index + 1 ) ) results . append ( data ) return np . asarray ( results )
shift the channels of images with the same arguments .