preparing_inputs.md 2.01 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
TFRecords.

## Generating the PASCAL VOC TFRecord files.

The raw 2012 PASCAL VOC data set can be downloaded
11
12
[here](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar),
or by using the command below.
13
14
Extract the tar file and run the `create_pascal_tf_record` script:

15
```bash
16
17
# From tensorflow/models
wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar
18
tar -xvf VOCtrainval_11-May-2012.tar
19
20
21
22
23
24
25
26
python object_detection/create_pascal_tf_record.py \
    --label_map_path=object_detection/data/pascal_label_map.pbtxt \
    --data_dir=VOCdevkit --year=VOC2012 --set=train \
    --output_path=pascal_train.record
python object_detection/create_pascal_tf_record.py \
    --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` directory.
31

32
## Generating the Oxford-IIIT Pet TFRecord files.
33

34
The Oxford-IIIT Pet data set can be downloaded from
35
36
37
[their website](http://www.robots.ox.ac.uk/~vgg/data/pets/), or by using the
command below. Extract the tar file and run the `create_pet_tf_record` script
to generate TFRecords.
38

39
```bash
40
41
42
# From tensorflow/models
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
43
44
tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
45
46
47
48
python object_detection/create_pet_tf_record.py \
    --label_map_path=object_detection/data/pet_label_map.pbtxt \
    --data_dir=`pwd` \
    --output_dir=`pwd`
49
50
```

51
You should end up with two TFRecord files named `pet_train.record` and
52
`pet_val.record` in the `tensorflow/models` directory.