[under construction]
Note this is for a SSD: Single Shot MultiBox Detector
This is for using the COCO dataset (http://cocodataset.org/#home) this is licensed under https://creativecommons.org/licenses/by/4.0/legalcode
First let's set up our directory structure for the entire pipeline:
+ ele_detect
+ data
+ images
- images
- XML files
- CSV file
- Training TFRecord file
- Evaluation TFRecord file
+ models
- [Note to self: please complete this structure using a diagram!!]
-- ANNOTATE IMAGES AND CONVERT TO TFRECORD --
1. Annotate our training images using: https://github.com/tzutalin/labelImg . This will save images in PASCAL VOC format (http://host.robots.ox.ac.uk/pascal/VOC/) using XML.
You can obtain this from PyPi , and run it with:
sudo pip install labelImg
labelImg
You can build it yourself too. Full instructions are on the GitHub link above.
Here it is in action:
So it's really easy to but bounding boxes around the elephants! And then to give the bounding box a class corresponding to the elephant type e.g. elephant/babyelephant/male.
Then you can go ahead and save the XML file containing the bounding box coordinates, and class, for each image. Shown below:
Here are the XML files and their associated images all the the images directory:
Now, let's see what's in the XML file:
2. Now we can go ahead and parse + convert these XML files to one CSV file using code written in python.
[code here]
Now, let's see what's in that CSV file. It's everything from the XML files!
3. Now we are ready to convert the CSV file to TFRecord format for training!
4. Convert CSV to TFRecord for TensorFlow
-- TRAINING MODEL --
5. Download a checkpoint file (model.ckpt-#####) pre-training on COCO dataset via https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md There's no need for a fast one. So http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_resnet_v2_atrous_coco_11_06_2017.tar.gz (DL link) is good.
6. Setup your config file (.config)
7. Go ahead with training using https://github.com/tensorflow/models/blob/master/research/object_detection/train.py
** Note that tensorflow code from github.com/tensorflow is licensed under http://www.apache.org/licenses/LICENSE-2.0
8. Export inference graph (.pb) per https://github.com/tensorflow/models/blob/master/research/object_detection/export_inference_graph.py
9. Go ahead with testing
-- USEFUL LINKS --
This is the create_pascal_tf_record.py code from the tensorflow repository to convert raw PASCAL dataset to TFRecord format: https://github.com/tensorflow/models/blob/master/research/object_detection/create_pascal_tf_record.py and this is preprocessor_builder.py: https://github.com/tensorflow/models/blob/a4944a57ad2811e1f6a7a87589a9fc8a776e8d3c/object_detection/builders/preprocessor_builder.py This code is licensed under http://www.apache.org/licenses/LICENSE-2.0
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.