SSD using Inception
Download the following file and modify it:
cd /tf_files/SSD-Tensorflow/VOC2007
Modify "process_bounding_boxes.py" as in /tf_files/SSD-Tensorflow/MY_PIPELINE and copy to /tf_files/SSD-Tensorflow/VOC2007/ directory Run it as: python process_bounding_boxes.py trainval python process_bounding_boxes.py test Remember to have 2 levels of hierarchy to reach *.xml files Running the modified script generates all necessary bounding box and synset files necessary to convert to tf_records format
Worked on TinyImagenet data from Stanford
#Run the following to re-structure the TinyImagenet train/ directory:
cd /tf_files/SSD_TENSORFLOW/MY_PIPELINE
python process_bounding_boxes_for_tinyImagenet.py /tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/train
#Run the following to re-structure the TinyImagenet val/ directory:
cd /tf_files/SSD_TENSORFLOW/MY_PIPELINE
python process_bounding_boxes_forTIval.py /tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/val
# Then copy the *_bboxes.txt file one directory level up and concatenate them together
cat train_bboxes.txt newVal_bboxes.txt > train_val_bboxes.txt
Now download this file:
python build_imagenet_data.py \
--train_directory=/tmp \
--validation_directory=/tmp \
--output_directory=/tmp \
--train_shards=1024 \
--validation_shards=128 \
--num_threads=8 \
--labels_file=voc_trainval_synset.txt \
--imagenet_metadata_file=voc_trainval_synset_label.txt \
--bounding_box_file=voc_trainval_bbox.txt
In our case do:
mkdir /tmp/out_inception
cd /tensorflow_models/models/inception/inception/data
TRAIN_DIR=/tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/train
VAL_DIR=/tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/newVal
OUT_DIR=/tmp/out_inception
python build_imagenet_data.py \
--train_directory=${TRAIN_DIR} \
--validation_directory=${VAL_DIR} \
--output_directory=${OUT_DIR} \
--train_shards=1024 \
--validation_shards=128 \
--num_threads=8 \
--labels_file=/tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/wnids.txt \
--imagenet_metadata_file=/tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/words.txt \
--bounding_box_file=/tf_files/SSD-Tensorflow/TINY_IMAGENET/tiny-imagenet-200/train_val_bboxes.txt
# The TFRecords are generated in: /tmp/out_inception/
Some important links:
https://github.com/tensorflow/models/blob/master/slim/datasets/dataset_factory.py
https://github.com/tensorflow/models/tree/master/slim
https://github.com/tensorflow/models/blob/master/inception/README.md#getting-started
Last updated
Was this helpful?