tensorflow / models

Models and examples built with TensorFlow
Other
77.18k stars 45.75k forks source link

Documentation Error in Object Detection Tutorial: Pets Dataset (running_pets.md) #1814

Closed jsawruk closed 7 years ago

jsawruk commented 7 years ago

System information

Describe the problem

When following the tutorial instructions Quick Start: Distributed Training on the Oxford-IIIT Pets Dataset on Google Cloud (https://github.com/tensorflow/models/blob/master/object_detection/g3doc/running_pets.md), the above code may not work depending on where the annotations.tar.gz and images.tar.gz files are located.

Under the heading Getting the Oxford-IIIT Pets Dataset and Uploading it to Google Cloud Storage, there are two code blocks. The first lists a directory structure, while the second lists commands to execute from the tensorflow/models directory.

The first code block (directory structure) looks like this:

+ object_detection/
  + data/
  - images.tar.gz
  - annotations.tar.gz
  - create_pet_tf_record.py
  ... other files and directories

This shows that images.tar.gz and annotations.tar.gz are located within the the directory tensorflow/models/object_detection. However, when running the above Python command (located in the next block), the following error occurs:

tensorflow.python.framework.errors_impl.NotFoundError: /tensorflow/models/annotations/trainval.txt

This occurs because the script is looking for the files in tensorflow/models, not tensorflow/models/object_detection.

If the directory structure is ignored, and the commands are run, then no error occurs because the files are in the correct place. Similarly, directions above the directory structure say:

You will need to download both the image dataset images.tar.gz and the groundtruth data annotations.tar.gz to the tensorflow/models directory.

This is a documentation error. The directory structure is incorrect and/or confusing. I initially downloaded the files into tensorflow/models as the above text directed, but then moved them into tensorflow/models/object_detection because the directions indicated that's what my directory structure should look like.

I propose changing the directory structure to this:

+ models/
  - annotations.tar.gz
  - images.tar.gz
  + object_detection/
    + data/
    - create_pet_tf_record.py
    ... other files and directories

I find this directory structure to be less confusing, as it shows the annotations.tar.gz and images.tar.gz to be contained within the tensorflow/models directory, rather than tensorflow/models/object_detection.

Source code / logs

Traceback (most recent call last):
  File "object_detection/create_pet_tf_record.py", line 213, in <module>
    tf.app.run()
  File "/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "object_detection/create_pet_tf_record.py", line 192, in main
    examples_list = dataset_util.read_examples_list(examples_path)
  File "/tensorflow/models/object_detection/utils/dataset_util.py", line 59, in read_examples_list
    lines = fid.readlines()
  File "/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 181, in readlines
    self._preread_check()
  File "/anaconda/envs/tf/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 78, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/anaconda/envs/tf/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/anaconda/env/tf/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: /tensorflow/models/annotations/trainval.txt
korrawat commented 7 years ago

See #1761 @derekjchow

ali01 commented 7 years ago

@panyx0718, could you take a look?

panyx0718 commented 7 years ago

Seems like a object_detection model specific issue @jch1

korrawat commented 7 years ago

1846 is fixing this

derekjchow commented 7 years ago

I've sent out this PR to update the documentation.