Is there a tutorial for using tensorflow object detection API for training object and key point detection? - tensorflow

This link provides a Google Colab notebook for inference of CenterNet HourGlass104 Keypoints 512x512 for object detection and pose key point detection. Is there a similar notebook or tutorial to train object detection and key point detection on custom datasets?

I have created a detailed github repo Custom Keypoint Detection for dataset preparation, model training and inference on Centernet-hourglass104 keypoint detection model based on Tensorflow Object detection API with examples.
This could help you in training your keypoint detection model on custom dataset.
Any issues related to the project can be raised in the github itself and doubts can be cleared here.

Related

How to perform keypoint regression on a custom dataset in Tensorflow?

Is it possible to use CenterNet with MobilenetV2 backbone (TF Lite compatible) to perform keypoints detection on a custom dataset? Is there a tutorial somewhere?
I have something for training keypoint detection model for custom dataset on Centernet model with hourglass backbone.
This github repo Custom Keypoint Detection for dataset preparation, model training and inference on Centernet-hourglass104 keypoint detection model based on Tensorflow Object detection API with examples.
This could help you in training your keypoint detection model on custom dataset.
Any issues related to the project can be raised in the github itself and doubts can be cleared here.

How to convert model trained on custom data-set for the Edge TPU board?

I have trained my custom data-set using the Tensor Flow Object Detection API. I run my "prediction" script and it works fine on the GPU. Now , I want to convert the model to lite and run it on the Google Coral Edge TPU Board to detect my custom objects. I have gone through the documentation that Google Coral Board Website provides but I found it very confusing.
How to convert and run it on the Google Coral Edge TPU Board?
Thanks
Without reading the documentation, it will be very hard to continue. I'm not sure what your "prediction script" means, but I'm assuming that the script loaded a .pb tensorflow model, loaded some image data, and run inference on it to produce prediction results. That means you have a .pb tensorflow model at the "Frozen graph" stage of the following pipeline:
Image taken from coral.ai.
The next step would be to convert your .pb model to a "fully quantized .tflite model" using the post training quantization technique. The documentation to do that are given here. I also created a github gist, containing an example of Post Training Quantization here. Once you have produced the .tflite model, you'll need to compile the model via the edgetpu_compiler. Although everything you need to know about the edgetpu compiler is in that link, for your purpose, compiling a model is as simple as:
$ edgetpu_compiler your_model_name.tflite
Which will creates a your_model_name_edgetpu.tflite model that is compatible with the EdgeTPU. Now, if at this stage, instead of creating an edgetpu compatible model, you are getting some type of errors, then that means your model did not meets the requirements that are posted in the models-requirements section.
Once you have produced a compiled model, you can then deploy it on an edgetpu device. Currently are 2 main APIs that can be use to run inference with the model:
EdgeTPU API
python api
C++ api
tflite API
C++ api
python api
Ultimately, there are many demo examples to run inference on the model here.
The previous answer works with general classification models, but not with TF object detection API trained models.
You cannot do post-training quantization with TF Lite converter on TF object detection API models.
In order to run object detection models on EdgeTPU-s:
You must train the models in quantized aware training mode with this addition in model config:
graph_rewriter {
quantization {
delay: 48000
weight_bits: 8
activation_bits: 8
}
}
This might not work with all the models provided in the model-zoo, try a quantized model first.
After training, export the frozen graph with: object_detection/export_tflite_ssd_graph.py
Run tensorflow/lite/toco tool on the frozen graph to make it TFLite compatible
And finally run edgetpu_complier on the .tflite file
You can find more in-depth guide here:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_mobile_tensorflowlite.md

Understanding exactly what the pretrained model does on the Tensorflow object detection API

I am trying to understand what I need from any pre-trained model used in the API regardless of any additional code found on the Tensorflow object detection API.
For example: ssd_mobilenet_v1_coco_2017_11_17, depending on what I have understood: it is a model that is already trained to detect objects (there is a classification to know the category of the object + Regression to bound the objects with rectangles and those rectangles are actually the x,y,w,h coordinates on the object).
How do we benefit from the regression output of that model (x,y,w,h coordinates) to use them in another model?
Let's assume we want to print out just the coordinates x,y,w,h of a detected object on an image without any need of the code of Tensorflow object detection API, how can we do that?
Certainly you can use the pretrained model provided in tensorflow object detection model zoo without installing object detection api. The alternative solution is to use opencv.
Opencv has provided both c++ and python api to call .pb models generated by tensorflow. Here is a nice tutorial.

How to add feature extractor netwrok for example mobilenetv2 to tensorflow's object detection API

This tutorial discusses how to use objection detection API at tensorflow.
I am looking for the tutorial explaining how to add feature extractor such as mobilenetV2 to tensorflow's object detection framework.
Have you checked out the Tensorflow provided Model Zoo? :)
It includes various object detection models with various feature extractors such as MobileNet, Inception, ResNet etc.
Here below you will find a link to the Tensorflow Detection Model Zoo, where you can choose detection model architectures, Region-Based (R-CNN) or Single Shot Detector (SSD) models, and feature extractors.
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
You can download a frozen graph of the pre-trained models based on COCO, Kitti and Open-Images etc.

Using TensorFlow Object Detection API with LSTM on a video

I am trying to track (by detection) objects on a video. The problem is that detected objects' label changed over frames of the video. I believe using RNNs (e.g., LSTMs) may help to make labels more stable but I don't have any idea how to use the frozen model of my object detector (MobilenetV2+SSD) as input for an LSTM layer and train the layer.
you can try this https://github.com/tensorflow/models/tree/master/research/lstm_object_detection. It implementation from Tensorflow mobile video object detection implementation proposed in the following paper:
Mobile Video Object Detection with Temporally-Aware Feature Maps (CVPR 2018).
http://openaccess.thecvf.com/content_cvpr_2018/papers/Liu_Mobile_Video_Object_CVPR_2018_paper.pdf
Help you for guideline.