def extract_svhn(local_url):
 with gfile.Open(local_url, mode='r') as file_obj:
  dict = loadmat(file_obj)
  (data, labels) = (dict['X'], dict['y'])
  data = np.asarray(data, dtype=np.float32)
  labels = np.asarray(labels, dtype=np.int32)
  data = data.transpose(3, 0, 1, 2)
  labels[(labels == 10)] = 0
  labels = labels.reshape(len(labels))
  return (data, labels)

def extract_svhn ( local_url ) : with gfile . Open ( local_url , mode = 'r' ) as file_obj : dict = loadmat ( file_obj ) ( data , labels ) = ( dict [ 'X' ] , dict [ 'y' ] ) data = np . asarray ( data , dtype = np . float32 ) labels = np . asarray ( labels , dtype = np . int32 ) data = data . transpose ( 3 , 0 , 1 , 2 ) labels [ ( labels == 10 ) ] = 0 labels = labels . reshape ( len ( labels ) ) return ( data , labels )
extract a matlab matrix into two numpy arrays with data and labels .