/yolov3_dyhead

An implementation of YOLOv3 with DyHead applied

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Final Project: DyHead YOLOv3

Note: This is a final project repository for the Deep Learning course at Georgia Institute of Technology OMSCS. It is built using source code from the two libraries listed below and we do not take credit for that code nor intend for this repository to be used instead of either of those projects. This project is for learning purposes only.

Members:

  • Hoyean Hwang
  • Waris Kulnguan
  • Jun Xiong Tan
  • Jacob H. Biros

This project is a direct copy of the PyTorch-YOLOv3 project with the DyHead Adapter implemented directly inside the codebase.

It references the code from the DyHead project to some extent.

Outline

This is an implementation of the DyHead adapter for the YOLOv3 object detection model. Our goal is to benchmark the DyHead adapted version along with the original YOLOv3 to see how performance increases, and determine if there are any tradeoffs for any gains obtained.

For benchmarking we will be using the PASCAL VOC dataset for training and validation.

Relevant Research Papers:

AWS Environment

We used an EC2 GPU instance with the AWS Deep Learning AMI (Ubuntu 18.04). However, because we are using a docker environment, the AMI should not matter as long as it is CUDA enabled and contains docker.

Setup

Docker Environment

To run the model, first build your docker image with the following command:

docker build . -t dyhead

When running locally, use this command to start a container:

docker run -dit -p 6006:6006 -v $(PWD):/code --name dyhead dyhead

When running on an EC2 server, use this command to start a container:

docker run --gpus --shm-size=2gb all -p 6006:6006 -dit -v $PWD:/code --name dyhead dyhead

Once started, you can access your container with:

docker exec -it dyhead bash

If you need to shutdown your container, to stop it run:

docker container stop dyhead

To remove it, run:

docker container rm dyhead

If it is your first time building the container then DynamicHead is not installed yet, so please run the following command:

poetry run python3 -m pip install -e DynamicHead
Data Setup

The VOC dataset is in a different format than the COCO dataset that this model was originall built for. To convert the VOC dataset to the COCO format, we used this script

Training

To begin training first ssh into the container using the command in the Docker section.

Then run tmux to start a client session. Once inside the client session use the following commands to start training.

Note: Both of these commands use the YOLOv3 tiny configurations.

For pure YOLOv3 run:

./train.sh

For YOLOv3 + DyHead run:

./train_dyhead.sh

To run tensorboard use the following command:

poetry run tensorboard --logdir='logs' --host=0.0.0.0 --port=6006