Data preparation for the Pet dataset

The Oxford-IIIT Pet dataset is used for this example. Download the image and annotations with these commands from the Chapter04 directory.

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

Extract the image and annotations as shown here:

tar -xvf images.tar.gz
tar -xvf annotations.tar.gz

Create the pet_tf record file to create the dataset in the tf records, as they are the required input for the object detection trainer. The label_map for the Pet dataset can be found at object_detection/data/pet_label_map.pbtxt. Move to the research folder and run the following command:

python object_detection/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=~/chapter4/. \
--output_dir=~/chapter4/.

You can see two .record files in the research directory named pet_train.record and pet_val.record.