Custom Object Detection using EfficientDet- The Simplest way

Akula Hemanth Kumar
Feb 18 · 3 min read
Object Detection

In this article, I am going to show you how to create your custom object detector using Monk’s EfficientDet.

I am assuming that you already know pretty basics of deep learning computer vision. Before diving into it, make sure you know what’s object detection, what’s transfer learning, and some other deep learning terms.

If you don’t know about all these, It’s time to go back and learn the basics and then come back to this post. Of course, you can do all this stuff without any knowledge using Monk but it’s perfect to have your basics clear. I will put some learning resources in the last section of this post.

Table of contents

  1. Data Gathering
  2. Convert to COCO format
  3. Training model
  4. Testing object detector

Data Gathering

In this article, we are using data from Exclusively-Dark-Image-Dataset.

wget --no-check-certificate '' -O

Convert to COCO format

The current format of downloaded data is

Dataset Directory Structure

Here we Convert to COCO format via Monk format

  1. Convert from the current format to Monk format

Monk Format

Dataset Directory Structure

Annotation file format

  • Labels: xmin ymin xmax ymax label
  • xmin, ymin — top left corner of bounding box

COCO Format

Dataset Directory Structure

  • instances_Train.json -> In proper COCO format
  • classes.txt -> A list of classes in alphabetical order

For TrainSet

  • root_dir = “./”;
  • coco_dir = “Dark”;
  • img_dir = “./”;
  • set_dir = “Images”;

Note: Annotation file name too coincides against the set_dir

Annotations folder contain two files classes.txt, instances_Images.json

2. Convert from Monk format to COCO format.

To get classes.txt run

For instances_Images.json run

Training model

In Training choose the appropriate batch size, learning rate, set path to directories. You can also train on multiple GPUs.For example, if you are using 2 GPU change line8 to gtf.model( gpu_devices=[0,1])

Testing object detector

After training the model, we can get the weights file in the trained folder.

Some of the image inferences you can see below:

Inference 1
Inference 2

You can find the complete code here.

If you have any questions, you can reach Abhishek and Akash. Feel free to reach out to them.

“Thank You”

References and Credit

  1. Paper on EfficientDet
  3. EfficientDet Blog

Photo by Srilekha

Towards AI

Towards AI, is the world’s fastest-growing AI community for learning, programming, building and implementing AI.

Akula Hemanth Kumar

Written by

Computer vision enthusiast |Linkedin

Towards AI

Towards AI, is the world’s fastest-growing AI community for learning, programming, building and implementing AI.

More From Medium

More from Towards AI

More from Towards AI

More from Towards AI

Image Filtering

More from Towards AI

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade