A succulent in a plant pot

Creating a custom Object Detector using Tensorflow

Written by Thomas Coldwell on Thursday, June 24, 2021 10:16 AM

Object detection is a process in which we can train an neural network to predict the bounding boxes for items and objects of specific classes in images or video. These neural networks can be made from scratch - however this requires a lot of knowledge on the internal workings and architectural choices of neural networks which is not the focus of this.

To train ours we will use a process called transfer learning using the Tensorflow framework from Google and a pretrained network called SSD MobileNetV2. This model has been trained to recognise lots of general items and objects in a scene from a plane to a salad, but we can now use its prior knowledge about identifying objects and just tweak it to recognise the objects we are interested in. This is akin to getting a chef (our pretrained model) to cook a new meal they haven't cooked before - they will likely do a much better job than someone who's never even cook a single meal before (if we did a model from scratch).

Plan

  • Choose a few objects you want to detect
  • Download LabelImg to create our dataset
  • Split our dataset up into train and test datasets
  • Convert our dataset from Pascal VOC → XML → TFRecords
  • Download a pretrained SSD MobileNetV2 model
  • Create a configuration file so we can retrain the model with our own classes
  • Create a PBTXT file to map our object names to numerical ids
  • Train the network on your custom dataset
  • Export your newly trained model to be used for inference