Introduction
This blog series is divided into four parts,
Part 1- The first part is about setting up the docker container for detectron2.
Part 2- Part two is about an open-source tool called labelme to label training images for detection
Part 4- Training and evaluating the detectron2 detection model. The architecture of the detection model is a Faster region proposal convolutional neural network (FRCNN) with a Feature pyramid network(FPN) and the backbone is resnet101. We will learn the steps to train a multiclass model.
what is detectron2?
Detectron2 is created by the Facebook research team. This is the official GitHub repository of Detectron2.
It is a library that has algorithms written with a research perspective that deliver state of the art solutions to artificial intelligence — computer vision focused problem statements.
You can explore all the projects done here. I would still want to mention a few interesting and my favourite ones here, 2D image-based detection, DensePose, Panoptic-DeepLab, Pointly-Supervised Instance Segmentation.
The detectron2 uses PyTorch as its framework. If you are new to training a PyTorch model then consider this as an excellent opportunity to begin your PyTorch journey.
NOTE: If your other deep learning models are deployed using a tensorflow serving and you wish to use detectron2 along with them then you may want to read this blog that helps to deploy models in PyTorch. I have spent a huge amount to figure this out. The weights that we get after training the detectron2 detection PyTorch model is in the format “WeightsFile.pth” and converting/exporting a “.pth” file to any other format and its deployment steps are very well written here.
Why one can read this blog?
Since we will train the resnet101+FRCNN+FPN detection model we would need GPU’s to train and evaluate the model. To train on GPU we will use the detectron2 docker provided by the Facebook research team.
I have documented my experience of running this docker container on my remote Linux machine.
I have added real-time screenshots while creating a docker container on my remote machine. I have shared all the cases where the installation failed and how I resolved them and successfully trained the model.
This is an end to end blog series to train the Detectron2 model. The data creation which is Part 3 is written by my husband
who is a deep learning enthusiast. I have given the link to his blog. He has shared the code he wrote to convert the CSV file which has annotation and other metadata of training data to a coco JSON file that goes as an input to detectron2 training code.
Working on a remote machine? This blog will help you to open JupyterLab, which will give you a Graphic user interface (GUI) to view, edit, save, run and debug your codes.
Learn about the best open-source labelling tool Labelme to create your own dataset.
Let us begin with setting up the docker container. If you are new to the field of docker containers, please read my step by step hands-on guide to the docker containers blog.
Successfully get the detectron2 docker image on your machineThe first step is to open a terminal on your machine. Please ensure that the machine has GPU’s support.
The remote machine I am working on has 4 NVIDIA A100 Tensor Core GPUs. It is a Linux machine, Ubuntu 18.04.2 LTS.
Step 1: Create a directory on your remote machine where you will clone the detectron2 git repository.
Create a new folder where you want to clone the detectron2 repository and data for this project.
Use the command “mkdir detectron2_detection” to create a new folder.
<div> A Simple Box </div>
1 comment
testing