preparing_inputs.md 1.7 KB
Newer Older
1
2
3
4
# Preparing Inputs

Tensorflow Object Detection API reads data using the TFRecord file format. Two
sample scripts (`create_pascal_tf_record.py` and `create_pet_tf_record.py`) are
5
provided to convert from the PASCAL VOC dataset and Oxford-IIIT Pet dataset to
6
7
8
9
10
11
12
13
TFRecords.

## Generating the PASCAL VOC TFRecord files.

The raw 2012 PASCAL VOC data set can be downloaded
[here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar).
Extract the tar file and run the `create_pascal_tf_record` script:

14
```bash
15
16
# From tensorflow/models/object_detection
tar -xvf VOCtrainval_11-May-2012.tar
17
python create_pascal_tf_record.py --data_dir=VOCdevkit \
18
    --year=VOC2012 --set=train --output_path=pascal_train.record
19
python create_pascal_tf_record.py --data_dir=VOCdevkit \
20
21
22
    --year=VOC2012 --set=val --output_path=pascal_val.record
```

23
24
You should end up with two TFRecord files named `pascal_train.record` and
`pascal_val.record` in the `tensorflow/models/object_detection` directory.
25
26

The label map for the PASCAL VOC data set can be found at
27
`data/pascal_label_map.pbtxt`.
28

29
## Generation the Oxford-IIIT Pet TFRecord files.
30

31
The Oxford-IIIT Pet data set can be downloaded from
32
33
34
[their website](http://www.robots.ox.ac.uk/~vgg/data/pets/). Extract the tar
file and run the `create_pet_tf_record` script to generate TFRecords.

35
```bash
36
37
38
# From tensorflow/models/object_detection
tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
39
python create_pet_tf_record.py --data_dir=`pwd` --output_dir=`pwd`
40
41
```

42
43
You should end up with two TFRecord files named `pet_train.record` and
`pet_val.record` in the `tensorflow/models/object_detection` directory.
44

45
The label map for the Pet dataset can be found at `data/pet_label_map.pbtxt`.