You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

6 years ago
  1. # Preparing Inputs
  2. Tensorflow Object Detection API reads data using the TFRecord file format. Two
  3. sample scripts (`create_pascal_tf_record.py` and `create_pet_tf_record.py`) are
  4. provided to convert from the PASCAL VOC dataset and Oxford-IIIT Pet dataset to
  5. TFRecords.
  6. ## Generating the PASCAL VOC TFRecord files.
  7. The raw 2012 PASCAL VOC data set is located
  8. [here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar).
  9. To download, extract and convert it to TFRecords, run the following commands
  10. below:
  11. ```bash
  12. # From tensorflow/models/research/
  13. wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
  14. tar -xvf VOCtrainval_11-May-2012.tar
  15. python object_detection/dataset_tools/create_pascal_tf_record.py \
  16. --label_map_path=object_detection/data/pascal_label_map.pbtxt \
  17. --data_dir=VOCdevkit --year=VOC2012 --set=train \
  18. --output_path=pascal_train.record
  19. python object_detection/dataset_tools/create_pascal_tf_record.py \
  20. --label_map_path=object_detection/data/pascal_label_map.pbtxt \
  21. --data_dir=VOCdevkit --year=VOC2012 --set=val \
  22. --output_path=pascal_val.record
  23. ```
  24. You should end up with two TFRecord files named `pascal_train.record` and
  25. `pascal_val.record` in the `tensorflow/models/research/` directory.
  26. The label map for the PASCAL VOC data set can be found at
  27. `object_detection/data/pascal_label_map.pbtxt`.
  28. ## Generating the Oxford-IIIT Pet TFRecord files.
  29. The Oxford-IIIT Pet data set is located
  30. [here](http://www.robots.ox.ac.uk/~vgg/data/pets/). To download, extract and
  31. convert it to TFRecrods, run the following commands below:
  32. ```bash
  33. # From tensorflow/models/research/
  34. wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz
  35. wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz
  36. tar -xvf annotations.tar.gz
  37. tar -xvf images.tar.gz
  38. python object_detection/dataset_tools/create_pet_tf_record.py \
  39. --label_map_path=object_detection/data/pet_label_map.pbtxt \
  40. --data_dir=`pwd` \
  41. --output_dir=`pwd`
  42. ```
  43. You should end up with two 10-sharded TFRecord files named
  44. `pet_faces_train.record-?????-of-00010` and
  45. `pet_faces_val.record-?????-of-00010` in the `tensorflow/models/research/`
  46. directory.
  47. The label map for the Pet dataset can be found at
  48. `object_detection/data/pet_label_map.pbtxt`.