preparing_inputs.md 2.26 KB
Newer Older
1
2
# Preparing Inputs

3
TensorFlow Object Detection API reads data using the TFRecord file format. Two
4
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
TFRecords.

## Generating the PASCAL VOC TFRecord files.

10
11
12
13
The raw 2012 PASCAL VOC data set is located
[here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar).
To download, extract and convert it to TFRecords, run the following commands
below:
14

15
```bash
16
# From tensorflow/models/research/
17
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
18
tar -xvf VOCtrainval_11-May-2012.tar
19
python object_detection/dataset_tools/create_pascal_tf_record.py \
20
21
22
    --label_map_path=object_detection/data/pascal_label_map.pbtxt \
    --data_dir=VOCdevkit --year=VOC2012 --set=train \
    --output_path=pascal_train.record
23
python object_detection/dataset_tools/create_pascal_tf_record.py \
24
25
26
    --label_map_path=object_detection/data/pascal_label_map.pbtxt \
    --data_dir=VOCdevkit --year=VOC2012 --set=val \
    --output_path=pascal_val.record
27
28
```

29
You should end up with two TFRecord files named `pascal_train.record` and
30
`pascal_val.record` in the `tensorflow/models/research/` directory.
31

32
33
34
The label map for the PASCAL VOC data set can be found at
`object_detection/data/pascal_label_map.pbtxt`.

35
## Generating the Oxford-IIIT Pet TFRecord files.
36

Derek Chow's avatar
Derek Chow committed
37
38
The Oxford-IIIT Pet data set is located
[here](http://www.robots.ox.ac.uk/~vgg/data/pets/). To download, extract and
Eric Jinks's avatar
Eric Jinks committed
39
convert it to TFRecords, run the following commands below:
40

41
```bash
42
# From tensorflow/models/research/
43
44
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz
45
46
tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
47
python object_detection/dataset_tools/create_pet_tf_record.py \
48
49
50
    --label_map_path=object_detection/data/pet_label_map.pbtxt \
    --data_dir=`pwd` \
    --output_dir=`pwd`
51
52
```

53
54
55
56
You should end up with two 10-sharded TFRecord files named
`pet_faces_train.record-?????-of-00010` and
`pet_faces_val.record-?????-of-00010` in the `tensorflow/models/research/`
directory.
57
58
59

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