diff --git a/blueoil/datasets/tfds.py b/blueoil/datasets/tfds.py index 9d0a0f028..36242e802 100644 --- a/blueoil/datasets/tfds.py +++ b/blueoil/datasets/tfds.py @@ -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: diff --git a/blueoil/utils/tfds_builders/classification.py b/blueoil/utils/tfds_builders/classification.py index aa05a43fb..d4416e1f2 100644 --- a/blueoil/utils/tfds_builders/classification.py +++ b/blueoil/utils/tfds_builders/classification.py @@ -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) } diff --git a/blueoil/utils/tfds_builders/object_detection.py b/blueoil/utils/tfds_builders/object_detection.py index 647130211..280c85354 100644 --- a/blueoil/utils/tfds_builders/object_detection.py +++ b/blueoil/utils/tfds_builders/object_detection.py @@ -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(), }), @@ -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 = [ @@ -85,7 +85,7 @@ def _generate_examples(self, dataset): if label != -1 ] - yield { + yield i, { "image": image, "objects": objects } diff --git a/setup.cfg b/setup.cfg index ea4556fe4..8622452e3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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