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.
- Linux or macOS with Python ≥ 3.6
- PyTorch ≥ 1.5 and torchvision that matches the PyTorch installation.
- Detectron2
# 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
Follow the INSTALL.md to install Detectron2.
- Download VisDrone dataset
Follow the instructions on VisDrone page
- 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
- Download DOTA dataset
Please follow the instructions on DOTA page. Organize it the same way as above.
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
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
python train_net.py \
--eval-only \
--num-gpus 1 \
--config-file configs/visdrone/Semi-Sup-RCNN-FPN-CROP.yaml \
MODEL.WEIGHTS <your weight>.pth
This project is licensed under GPL License, as found in the LICENSE file.