vonclites / squeezenet

Tensorflow implementation of SqueezeNet.
MIT License
129 stars 63 forks source link

Expected image (JPEG, PNG, or GIF),get /000/000/000 #14

Open aboy2018 opened 5 years ago

aboy2018 commented 5 years ago

tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected image (JPEG, PNG, or GIF), got unknown format starting with '\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'

PatrickFeng commented 4 years ago

Suppose you generating your tfrecord data in a incorrect way. You can reference the official tutorial of converting CIFAR-10 dataset to .tfrecord files: https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10_estimator/generate_cifar10_tfrecords.py

PatrickFeng commented 4 years ago

Suppose you generating your tfrecord data in a incorrect way. You can reference the official tutorial of converting CIFAR-10 dataset to .tfrecord files: https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10_estimator/generate_cifar10_tfrecords.py

If you follow the official tutorial to generate your tfrecord data, some minor changes should be done in inputs.py. Some of 'image' and 'label' in function _parse_serialized_example() and _preprocess_example() should be replaced by 'image/encoded' and 'image/class/label' like:

def _preprocess_example(self, serialized_example):
    parsed_example = self._parse_serialized_example(serialized_example)
    image = self._preprocess_image(parsed_example['image/encoded'])
    return {'image': image}, parsed_example['image/class/label']

@staticmethod
def _parse_serialized_example(serialized_example):
    features = {
        'image/encoded': tf.FixedLenFeature([], tf.string),
        'image/class/label': tf.FixedLenFeature([], tf.int64),
    }
    return tf.parse_single_example(serialized=serialized_example,
                                   features=features)