Skip to content

Instantly share code, notes, and snippets.

@eileen-code4fun
Created June 4, 2021 02:18
Show Gist options
  • Save eileen-code4fun/e73063b1c877b607279749391fbe6265 to your computer and use it in GitHub Desktop.
Save eileen-code4fun/e73063b1c877b607279749391fbe6265 to your computer and use it in GitHub Desktop.
CIFAR10 BQ
import tensorflow as tf
import tensorflow_datasets as tfds
ds = tfds.load('cifar10', as_supervised=True)
def csvfy(dataset, filename):
with open(filename, 'w') as f:
for image, label in dataset:
f.write('{},'.format(label.numpy()))
f.write(','.join(str(x) for x in list(image.numpy().reshape(-1))))
f.write('\n')
csvfy(ds['train'], 'train.csv')
csvfy(ds['test'], 'test.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment