Created
June 4, 2021 02:18
-
-
Save eileen-code4fun/e73063b1c877b607279749391fbe6265 to your computer and use it in GitHub Desktop.
CIFAR10 BQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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