Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Update tensorflow-datasets version to 1.3.0 #956

Merged
merged 2 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions blueoil/datasets/tfds.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,16 @@ def _validate_feature_structure(self):
is_valid = \
"image" in self.info.features and \
"objects" in self.info.features and \
"label" in self.info.features["objects"] and \
"bbox" in self.info.features["objects"] and \
"label" in self.info.features["objects"].feature and \
"bbox" in self.info.features["objects"].feature and \
isinstance(self.info.features["image"], tfds.features.Image) and \
isinstance(self.info.features["objects"], tfds.features.SequenceDict) and \
isinstance(self.info.features["objects"], tfds.features.Sequence) and \
isinstance(self.info.features["objects"]["label"], tfds.features.ClassLabel) and \
isinstance(self.info.features["objects"]["bbox"], tfds.features.BBoxFeature)

if not is_valid:
raise ValueError("Datasets should have \"objects\" and \"image\" features and "
"\"objects\" should be a SequenceDict containing \"label\" and \"bbox\".")
"\"objects\" should be a Sequence containing \"label\" and \"bbox\".")

def _format_dataset(self):
if self.info.features['image'].shape[2] == 1:
Expand Down
4 changes: 2 additions & 2 deletions blueoil/utils/tfds_builders/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def _split_generators(self, dl_manager):
return splits

def _generate_examples(self, dataset):
for image, label in dataset:
yield {
for i, (image, label) in enumerate(dataset):
yield i, {
"image": image,
"label": label.tolist().index(1)
}
Expand Down
6 changes: 3 additions & 3 deletions blueoil/utils/tfds_builders/object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _info(self):
description="Custom TFDS dataset for object detection",
features=tfds.features.FeaturesDict({
"image": tfds.features.Image(),
"objects": tfds.features.SequenceDict({
"objects": tfds.features.Sequence({
"label": tfds.features.ClassLabel(),
"bbox": tfds.features.BBoxFeature(),
}),
Expand Down Expand Up @@ -68,7 +68,7 @@ def _split_generators(self, dl_manager):
return splits

def _generate_examples(self, dataset):
for image, annotations in dataset:
for i, (image, annotations) in enumerate(dataset):
height, width, _ = image.shape

objects = [
Expand All @@ -85,7 +85,7 @@ def _generate_examples(self, dataset):
if label != -1
]

yield {
yield i, {
"image": image,
"objects": objects
}
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install_requires =
prompt_toolkit==3.0.3
pytablewriter==0.47.0
PyYAML==5.3
tensorflow-datasets==1.0.2
tensorflow-datasets==1.3.0
inquirer==2.6.3
cython==0.27.3

Expand Down