twosixlabs / armory

ARMORY Adversarial Robustness Evaluation Test Bed
MIT License
176 stars 67 forks source link

protobuf error in tfds load of kitti #1527

Closed mwartell closed 2 years ago

mwartell commented 2 years ago

MITRE has reported difficulties registering virtualkitti as an armory tfds dataset. Most recently there may be a version mismatch between the dataset builder, the tfds API declared API version and the dataset tagging of the form mydataset:1.0.0 as shown in that doc.

Traceback (most recent call last):

  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 515, in _ConvertFieldValuePair
    raise ParseError(
          └ <class 'google.protobuf.json_format.ParseError'>

google.protobuf.json_format.ParseError: Message type "tensorflow_datasets.DatasetInfo" has no field named "fileFormat".
Available Fields(except extensions): ['name', 'description', 'version', 'citation', 'sizeInBytes', 'downloadSize', 'location', 'downloadChecksums', 'schema', 'splits', 'supervisedKeys', 'redistributionInfo']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 399, in try_reraise
    yield
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/registered.py", line 244, in builder
    return builder_cls(name)(**builder_kwargs)
           │           │       └ {'data_dir': '/armory/datasets', 'version': '3.2.0'}
           │           └ 'kitti'
           └ <function builder_cls at 0x7f024f280af0>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/api_utils.py", line 69, in disallow_positional_args_dec
    return fn(*args, **kwargs)
           │   │       └ {'data_dir': '/armory/datasets', 'version': '3.2.0'}
           │   └ ()
           └ <bound method DatasetBuilder.__init__ of <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_builder.py", line 204, in __init__
    self.info.read_from_directory(self._data_dir)
    │    │                        │    └ '/armory/datasets/kitti/3.2.0'
    │    │                        └ <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>
    │    └ <tensorflow_datasets.core.utils.py_utils.memoized_property object at 0x7f024f2fb220>
    └ <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_info.py", line 363, in read_from_directory
    parsed_proto = read_from_json(json_filename)
                   │              └ '/armory/datasets/kitti/3.2.0/dataset_info.json'
                   └ <function read_from_json at 0x7f024e5f6430>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_info.py", line 514, in read_from_json
    parsed_proto = json_format.Parse(dataset_info_json_str,
                   │           │     └ '{\n  "citation": "@inproceedings{Geiger2012CVPR,\\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\\n  title...
                   │           └ <function Parse at 0x7f0263c80700>
                   └ <module 'google.protobuf.json_format' from '/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py'>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 425, in Parse
    return ParseDict(js, message, ignore_unknown_fields, descriptor_pool)
           │         │   │        │                      └ None
           │         │   │        └ False
           │         │   └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...           │         └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title = {Are...
           └ <function ParseDict at 0x7f0263c80790>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 445, in ParseDict
    parser.ConvertMessage(js_dict, message)
    │      │              │        └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...
    │      │              └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title = {Are...
    │      └ <function _Parser.ConvertMessage at 0x7f0263c80940>
    └ <google.protobuf.json_format._Parser object at 0x7f0246299ee0>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 476, in ConvertMessage
    self._ConvertFieldValuePair(value, message)
    │    │                      │      └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...
    │    │                      └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title =
{Are...
    │    └ <function _Parser._ConvertFieldValuePair at 0x7f0263c809d0>
    └ <google.protobuf.json_format._Parser object at 0x7f0246299ee0>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 590, in _ConvertFieldValuePair
    raise ParseError(str(e))
          └ <class 'google.protobuf.json_format.ParseError'>

google.protobuf.json_format.ParseError: Message type "tensorflow_datasets.DatasetInfo" has no field named "fileFormat".
Available Fields(except extensions): ['name', 'description', 'version', 'citation', 'sizeInBytes', 'downloadSize', 'location', 'downloadChecksums', 'schema', 'splits', 'supervisedKeys', 'redistributionInfo']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/opt/conda/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
           │         │     └ {'__name__': '__main__', '__doc__': '\nMain script for running scenarios. Users will run a scenario by calling:\n    armory r...
           │         └ <code object <module> at 0x7f024f684df0, file "/workspace/armory/scenarios/main.py", line 1>
           └ <function _run_code at 0x7f0389fd7d30>
  File "/opt/conda/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
         │     └ {'__name__': '__main__', '__doc__': '\nMain script for running scenarios. Users will run a scenario by calling:\n    armory r...
         └ <code object <module> at 0x7f024f684df0, file "/workspace/armory/scenarios/main.py", line 1>

  File "/workspace/armory/scenarios/main.py", line 228, in <module>
    run_config(
    └ <function run_config at 0x7f024dcb19d0>

  File "/workspace/armory/scenarios/main.py", line 144, in run_config
    scenario.evaluate()
    │        └ <function Scenario.evaluate at 0x7f024db3bd30>
    └ <armory.scenarios.virtual_kitti_object_detection.VirtualKittiObjectDetectionTask object at 0x7f03894ea670>

> File "/workspace/armory/scenarios/scenario.py", line 366, in evaluate
    self._evaluate()
    │    └ <function Scenario._evaluate at 0x7f024db3bca0>
    └ <armory.scenarios.virtual_kitti_object_detection.VirtualKittiObjectDetectionTask object at 0x7f03894ea670>

  File "/workspace/armory/scenarios/scenario.py", line 355, in _evaluate
    self.load()
    │    └ <function Scenario.load at 0x7f024db3b820>
    └ <armory.scenarios.virtual_kitti_object_detection.VirtualKittiObjectDetectionTask object at 0x7f03894ea670>

  File "/workspace/armory/scenarios/scenario.py", line 247, in load
   self.load_dataset()
    │    └ <function VirtualKittiObjectDetectionTask.load_dataset at 0x7f024d9c49d0>
    └ <armory.scenarios.virtual_kitti_object_detection.VirtualKittiObjectDetectionTask object at 0x7f03894ea670>

  File "/workspace/armory/scenarios/virtual_kitti_object_detection.py", line 29, in load_dataset
    super().load_dataset(eval_split_default="train")

  File "/workspace/armory/scenarios/scenario.py", line 193, in load_dataset
    self.test_dataset = config_loading.load_dataset(
    │                   │              └ <function load_dataset at 0x7f024dcb13a0>
    │                   └ <module 'armory.utils.config_loading' from '/workspace/armory/utils/config_loading.py'>
    └ <armory.scenarios.virtual_kitti_object_detection.VirtualKittiObjectDetectionTask object at 0x7f03894ea670>

  File "/workspace/armory/utils/config_loading.py", line 73, in load_dataset
    dataset = dataset_fn(batch_size=batch_size, framework=framework, *args, **kwargs)
              │                     │                     │           │       └ {'epochs': 1, 'split': 'train', 'shuffle_files': False}
              │                     │                     │           └ ()
              │                     │                     └ 'numpy'
              │                     └ 1
              └ <function kitti at 0x7f024dca8700>

  File "/workspace/armory/data/datasets.py", line 995, in kitti
    return _generator_from_tfds(
           └ <function _generator_from_tfds at 0x7f024dca5700>

  File "/workspace/armory/data/datasets.py", line 412, in _generator_from_tfds
    ds, ds_info = tfds.load(
                  │    └ <FunctionWrapper at 0x7f024f283580 for function at 0x7f024f280c10>
                  └ <module 'tensorflow_datasets' from '/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/__init__.py'>

  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/api_utils.py", line 69, in disallow_positional_args_dec
    return fn(*args, **kwargs)
           │   │       └ {'split': 'train', 'as_supervised': False, 'data_dir': '/armory/datasets', 'with_info': True, 'download_and_prepare_kwargs': ...
           │   └ ('kitti:3.2.0',)
           └ <function load at 0x7f024f280c10>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/registered.py", line 368, in load
    dbuilder = builder(name, data_dir=data_dir, **builder_kwargs)
               │       │              │           └ {'version': '3.2.0'}
               │       │              └ '/armory/datasets'
               │       └ 'kitti'
               └ <function builder at 0x7f024f280b80>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/registered.py", line 244, in builder
    return builder_cls(name)(**builder_kwargs)
           │           │       └ {'data_dir': '/armory/datasets', 'version': '3.2.0'}
           │           └ 'kitti'
           └ <function builder_cls at 0x7f024f280af0>
  File "/opt/conda/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
    │    │   │     │     │      └ <traceback object at 0x7f024629a880>
    │    │   │     │     └ ParseError('Message type "tensorflow_datasets.DatasetInfo" has no field named "fileFormat".\n Available Fields(except extensi...    │    │   │     └ <class 'google.protobuf.json_format.ParseError'>
    │    │   └ <method 'throw' of 'generator' objects>
    │    └ <generator object try_reraise at 0x7f024cd48cf0>
    └ <contextlib._GeneratorContextManager object at 0x7f0246299370>
 File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 401, in try_reraise
    reraise(*args, **kwargs)
    │        │       └ {'prefix': 'Failed to construct dataset kitti'}
    │        └ ()
    └ <function reraise at 0x7f024f06ca60>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 392, in reraise
    six.reraise(exc_type, exc_type(msg), exc_traceback)
    │   │       │         │        │     └ <traceback object at 0x7f024629ac40>
    │   │       │         │        └ 'Failed to construct dataset kittiMessage type "tensorflow_datasets.DatasetInfo" has no field named "fileFormat".\n Available...
    │   │       │         └ <class 'google.protobuf.json_format.ParseError'>
    │   │       └ <class 'google.protobuf.json_format.ParseError'>
    │   └ <function reraise at 0x7f029df3e160>
    └ <module 'six' from '/opt/conda/lib/python3.8/site-packages/six.py'>
  File "/opt/conda/lib/python3.8/site-packages/six.py", line 718, in reraise
    raise value.with_traceback(tb)
          │                    └ None
          └ None
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/utils/py_utils.py", line 399, in try_reraise
    yield
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/registered.py", line 244, in builder
    return builder_cls(name)(**builder_kwargs)
           │           │       └ {'data_dir': '/armory/datasets', 'version': '3.2.0'}
           │           └ 'kitti'
           └ <function builder_cls at 0x7f024f280af0>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/api_utils.py", line 69, in disallow_positional_args_dec
    return fn(*args, **kwargs)
           │   │       └ {'data_dir': '/armory/datasets', 'version': '3.2.0'}
           │   └ ()
           └ <bound method DatasetBuilder.__init__ of <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_builder.py", line 204, in __init__
    self.info.read_from_directory(self._data_dir)
    │    │                        │    └ '/armory/datasets/kitti/3.2.0'
    │    │                        └ <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>
    │    └ <tensorflow_datasets.core.utils.py_utils.memoized_property object at 0x7f024f2fb220>
    └ <tensorflow_datasets.object_detection.kitti.Kitti object at 0x7f02462994f0>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_info.py", line 363, in read_from_directory
    parsed_proto = read_from_json(json_filename)
                   │              └ '/armory/datasets/kitti/3.2.0/dataset_info.json'
                   └ <function read_from_json at 0x7f024e5f6430>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_datasets/core/dataset_info.py", line 514, in read_from_json
    parsed_proto = json_format.Parse(dataset_info_json_str,
                   │           │     └ '{\n  "citation": "@inproceedings{Geiger2012CVPR,\\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\\n  title...
                   │           └ <function Parse at 0x7f0263c80700>
                   └ <module 'google.protobuf.json_format' from '/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py'>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 425, in Parse
    return ParseDict(js, message, ignore_unknown_fields, descriptor_pool)
           │         │   │        │                      └ None
           │         │   │        └ False
           │         │   └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...           │         └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title = {Are...
           └ <function ParseDict at 0x7f0263c80790>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 445, in ParseDict
    parser.ConvertMessage(js_dict, message)
    │      │              │        └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...
    │      │              └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title = {Are...
    │      └ <function _Parser.ConvertMessage at 0x7f0263c80940>
    └ <google.protobuf.json_format._Parser object at 0x7f0246299ee0>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 476, in ConvertMessage
    self._ConvertFieldValuePair(value, message)
    │    │                      │      └ description: "Kitti contains a suite of vision tasks built using an autonomous driving\nplatform. The full benchmark contains...
    │    │                      └ {'citation': '@inproceedings{Geiger2012CVPR,\n  author = {Andreas Geiger and Philip Lenz and Raquel Urtasun},\n  title =
{Are...
    │    └ <function _Parser._ConvertFieldValuePair at 0x7f0263c809d0>
    └ <google.protobuf.json_format._Parser object at 0x7f0246299ee0>
  File "/opt/conda/lib/python3.8/site-packages/google/protobuf/json_format.py", line 590, in _ConvertFieldValuePair
    raise ParseError(str(e))
          └ <class 'google.protobuf.json_format.ParseError'>

google.protobuf.json_format.ParseError: Failed to construct dataset kittiMessage type "tensorflow_datasets.DatasetInfo" has no field named "fileFormat".
Available Fields(except extensions): ['name', 'description', 'version', 'citation', 'sizeInBytes', 'downloadSize', 'location', 'downloadChecksums', 'schema', 'splits', 'supervisedKeys', 'redistributionInfo']
lcadalzo commented 2 years ago

this issue should be in reference tokitti, not virtualkitti

lcadalzo commented 2 years ago

this error is a result of a discrepancy between (A) the environment used when running TFDS CLI tool's build command as such: tfds build kitti and (B) the environment inside the Armory docker container, specifically as it pertains to tfds + tensorflow versions.

@mwartell unless you have reason to believe we should keep this open, I think this issue should be closed

lcadalzo commented 2 years ago

@mwartell please see my comment above