def ld_svhn(extended=False, test_only=False):
 file_urls = ['http://ufldl.stanford.edu/housenumbers/train_32x32.mat', 'http://ufldl.stanford.edu/housenumbers/test_32x32.mat', 'http://ufldl.stanford.edu/housenumbers/extra_32x32.mat']
 local_urls = maybe_download(file_urls, FLAGS.data_dir)
 if (not test_only):
  (train_data, train_labels) = extract_svhn(local_urls[0])
  train_data = image_whitening(train_data)
  (ext_data, ext_labels) = extract_svhn(local_urls[2])
  ext_data = image_whitening(ext_data)
 (test_data, test_labels) = extract_svhn(local_urls[1])
 test_data = image_whitening(test_data)
 if test_only:
  return (test_data, test_labels)
 elif extended:
  train_data = np.vstack((train_data, ext_data))
  train_labels = np.hstack((train_labels, ext_labels))
  return (train_data, train_labels, test_data, test_labels)
 else:
  return (train_data, train_labels, test_data, test_labels, ext_data, ext_labels)

def ld_svhn ( extended = False , test_only = False ) : file_urls = [ 'http://ufldl.stanford.edu/housenumbers/train_32x32.mat' , 'http://ufldl.stanford.edu/housenumbers/test_32x32.mat' , 'http://ufldl.stanford.edu/housenumbers/extra_32x32.mat' ] local_urls = maybe_download ( file_urls , FLAGS . data_dir ) if ( not test_only ) : ( train_data , train_labels ) = extract_svhn ( local_urls [ 0 ] ) train_data = image_whitening ( train_data ) ( ext_data , ext_labels ) = extract_svhn ( local_urls [ 2 ] ) ext_data = image_whitening ( ext_data ) ( test_data , test_labels ) = extract_svhn ( local_urls [ 1 ] ) test_data = image_whitening ( test_data ) if test_only : return ( test_data , test_labels ) elif extended : train_data = np . vstack ( ( train_data , ext_data ) ) train_labels = np . hstack ( ( train_labels , ext_labels ) ) return ( train_data , train_labels , test_data , test_labels ) else : return ( train_data , train_labels , test_data , test_labels , ext_data , ext_labels )
load the original svhn data .