code: import cPickle
  import numpy as np
  
  
  def unpickle(file):
      fo = open(file, 'rb')
      dict = cPickle.load(fo)
      fo.close()
      return dict
  
  
  def clean(data):
      imgs = data.reshape(data.shape[0], 3, 32, 32)
      grayscale_imgs = imgs.mean(1)
      cropped_imgs = grayscale_imgs[:, 4:28, 4:28]
      img_data = cropped_imgs.reshape(data.shape[0], -1)
      img_size = np.shape(img_data)[1]
      means = np.mean(img_data, axis=1)
      meansT = means.reshape(len(means), 1)
      stds = np.std(img_data, axis=1)
      stdsT = stds.reshape(len(stds), 1)
      adj_stds = np.maximum(stdsT, 1.0 / np.sqrt(img_size))
      normalized = (img_data - meansT) / adj_stds
      return normalized
  
  
  def read_data(directory):
      names = unpickle('{}/batches.meta'.format(directory))['label_names']
      print('names', names)
  
      data, labels = [], []
      for i in range(1, 6):
          filename = '{}/data_batch_{}'.format(directory, i)
          batch_data = unpickle(filename)
          if len(data) > 0:
              data = np.vstack((data, batch_data['data']))
              labels = np.hstack((labels, batch_data['labels']))
          else:
              data = batch_data['data']
              labels = batch_data['labels']
  
      print(np.shape(data), np.shape(labels))
  
      data = clean(data)
      data = data.astype(np.float32)
      return names, data, labels
  
apis: numpy.vstack numpy.hstack numpy.shape numpy.sqrt numpy.std numpy.mean