Skip to content

akhilpm/DroneSSOD

Repository files navigation

Density Crop-guided Semi-supervised Object Detection in Aerial Imges

License: GPL

This is the PyTorch implementation of our paper:
Density Crop-guided Semi-supervised Object Detection in Aerial Imges
Akhil Meethal, Eric Granger, Marco Pedersoli
[arXiv]

This code base can be used to train the CZ Detector or QueryDet in a semi-supervised fashion using the mean-teacher method.

Installation

Prerequisites

  • Linux or macOS with Python ≥ 3.6
  • PyTorch ≥ 1.5 and torchvision that matches the PyTorch installation.
  • Detectron2

Install PyTorch in Conda env

# create conda env
conda create -n detectron2 python=3.6
# activate the enviorment
conda activate detectron2
# install PyTorch >=1.5 with GPU
conda install pytorch torchvision -c pytorch

Build Detectron2 from Source

Follow the INSTALL.md to install Detectron2.

Dataset download

  1. Download VisDrone dataset

Follow the instructions on VisDrone page

  1. Organize the dataset as following:
croptrain/
└── datasets/
    └── VisDrone/
        ├── train/
        ├── val/
        ├── annotations_VisDrone_train.json
        └── annotations_VisDrone_val.json

The original annotations provided with the VisDrone dataset is in PASCAL VOC format. I used this code to convert it to COCO style annotation: VOC2COCO.

I am sharing the json files I generated for the VisDrone dataset via google drive below.

a) annotations_VisDrone_train.json

b) annotations_VisDrone_val.json

  1. Download DOTA dataset

Please follow the instructions on DOTA page. Organize it the same way as above.

Training

Train the detector in supervised mode on VisDrone dataset

python train_net.py \
      --num-gpus 1 \
      --config-file configs/Base-RCNN-FPN.yaml \
      OUTPUT_DIR outputs_Sup

Train the detector in supervised mode using density crops on VisDrone dataset

python train_net.py \
      --num-gpus 1 \
      --config-file configs/RCNN-FPN-CROP.yaml \
      OUTPUT_DIR outputs_Sup_Dcrop

Train the detector in semi-supervised mode with the vanilla mean-teacher method on VisDrone dataset

python train_net.py \
      --num-gpus 1 \
      --config-file configs/visdrone/Semi-Sup-RCNN-FPN.yaml \
      OUTPUT_DIR outputs_SSOD

Train the detector in semi-supervised mode with density crop guidance on VisDrone dataset

python train_net.py \
      --num-gpus 1 \
      --config-file configs/visdrone/Semi-Sup-RCNN-FPN-CROP.yaml \
      OUTPUT_DIR outputs_SSOD_Dcrop

Resume the training

python train_net.py \
      --resume \
      --num-gpus 8 \
      --config configs/visdrone/Semi-Sup-RCNN-FPN-CROP.yaml \
      OUTPUT_DIR outputs_SSOD_Dcrop MODEL.WEIGHTS <your weight>.pth

Evaluation

python train_net.py \
      --eval-only \
      --num-gpus 1 \
      --config-file configs/visdrone/Semi-Sup-RCNN-FPN-CROP.yaml \
      MODEL.WEIGHTS <your weight>.pth

Results comparison on the VisDrone dataset

Results comparison on the DOTA dataset

License

This project is licensed under GPL License, as found in the LICENSE file.