Skip to content

Instantly share code, notes, and snippets.

@visionNoob
Created October 9, 2019 17:27
Show Gist options
  • Save visionNoob/d8e0c367298fd0a8584d60dd1318a24e to your computer and use it in GitHub Desktop.
Save visionNoob/d8e0c367298fd0a8584d60dd1318a24e to your computer and use it in GitHub Desktop.
tfds pascal voc example
import warnings
warnings.filterwarnings("ignore")
import tensorflow_datasets as tfds
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
# tfds works in both Eager and Graph modes
tf.compat.v1.enable_eager_execution()
dataset = tfds.load("voc2007", split=tfds.Split.TRAIN, batch_size=16)
dataset = dataset.shuffle(10)
for feature in dataset.take(1):
print(feature['image'].shape)
plt.imshow(feature['image'][5])
plt.show()
print(feature['objects']['bbox'][5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment