def flip_axis_multi(x, axis, is_random=False):
 if is_random:
  factor = np.random.uniform((-1), 1)
  if (factor > 0):
   results = []
   for data in x:
    data = np.asarray(data).swapaxes(axis, 0)
    data = data[::(-1), ...]
    data = data.swapaxes(0, axis)
    results.append(data)
   return np.asarray(results)
  else:
   return np.asarray(x)
 else:
  results = []
  for data in x:
   data = np.asarray(data).swapaxes(axis, 0)
   data = data[::(-1), ...]
   data = data.swapaxes(0, axis)
   results.append(data)
  return np.asarray(results)

def flip_axis_multi ( x , axis , is_random = False ) : if is_random : factor = np . random . uniform ( ( - 1 ) , 1 ) if ( factor > 0 ) : results = [ ] for data in x : data = np . asarray ( data ) . swapaxes ( axis , 0 ) data = data [ : : ( - 1 ) , ... ] data = data . swapaxes ( 0 , axis ) results . append ( data ) return np . asarray ( results ) else : return np . asarray ( x ) else : results = [ ] for data in x : data = np . asarray ( data ) . swapaxes ( axis , 0 ) data = data [ : : ( - 1 ) , ... ] data = data . swapaxes ( 0 , axis ) results . append ( data ) return np . asarray ( results )
flip the axises of multiple images together .