Commit 023d61f7 authored by Amelie Royer's avatar Amelie Royer 🐼

Adding compressed TFRecords code for FashionMNIST

parent 97713b54
......@@ -8,11 +8,11 @@ import os
import numpy as np
import tensorflow as tf
from .tfrecords_utils import *
from .tfrecords_utils import *
from .mnist import MNISTConverter, MNISTLoader
class FashionMNISTConverter(MNISTConverter):
class FashionMNISTConverter(MNISTConverter):
def __init__(self, data_dir):
"""Initialize the object for the fashion MNIST dataset in `data_dir`"""
......@@ -21,15 +21,15 @@ class FashionMNISTConverter(MNISTConverter):
for name, key in [('train', 'train'), ('test', 't10k')]:
images = os.path.join(data_dir, '%s-images-idx3-ubyte' % key)
labels = os.path.join(data_dir, '%s-labels-idx1-ubyte' % key)
if not os.path.isfile(images) or not os.path.isfile(labels):
if not os.path.isfile(images) or not os.path.isfile(labels):
print('Warning: Missing %s data' % name)
else:
self.data.append((name, images, labels))
class FashionMNISTLoader(MNISTLoader):
classes_names = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt',
'Sneaker', 'Bag', 'Ankle boot']
def __init__(self, image_size=None, verbose=False):
super(FashionMNISTLoader, self).__init__(image_size=image_size, verbose=verbose)
\ No newline at end of file
super(FashionMNISTLoader, self).__init__(image_size=image_size, verbose=verbose)
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment