AllSetup
  • Introduction
  • Docker
  • Common commands
    • Various S3 utilities
    • Mac stuff
  • Mac stuff
  • Dockerfile examples
  • Docker GPU
  • TensorFlow
  • tensorFlow on iOS
  • Jupyter
  • iOS
  • SSD work
  • SSD using Inception
  • Object Detection
  • Docker GPU
  • TitBits
  • MySQL
  • FAIR Multipathnet
  • Git and GitFlow
  • Java Scala Mongo Installation
  • Devops
  • scratchpad
  • GCP Production
  • GStreamer
  • bash
  • Scala
  • Unix commands
  • Publish-Subscribe
  • Sensor-project
  • Flutter-project
Powered by GitBook
On this page

Was this helpful?

SSD using Inception

PreviousSSD workNextObject Detection

Last updated 5 years ago

Was this helpful?

Download the following file and modify it:

cd /tf_files/SSD-Tensorflow/VOC2007

wget

  1. 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:

wget

https://raw.githubusercontent.com/tensorflow/models/master/inception/inception/data/process_bounding_boxes.py
https://raw.githubusercontent.com/tensorflow/models/master/inception/inception/data/build_imagenet_data.py
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
https://github.com/tensorflow/models/tree/master/inception
https://github.com/tensorflow/models/blob/4cc1fa0f58950b32532b5655aa46d3fb98bcd612/attention_ocr/python/data_provider_test.py