imatif17 / Prototype-Mean-Teacher

16 stars 1 forks source link

Multi-Source Domain Adaptation for Object Detection with Prototype-based Mean-teacher

This is the Pytorch implementation of our paper -

Multi-Source Domain Adaptation for Object Detection with Prototype-based Mean-teacher
Atif Belal, Akhil Meethal, Francisco Perdigon Romero, Marco Pedersoli, Eric Granger

[WACV] [arXiv]

Installation

Prerequisites

Create Python environment and Install PyTorch

mkdir python_env
python3 -m venv python_env/
source python_env/bin/activate
pip3 install torch torchvision torchaudio

Build Detectron2 from Source

Follow the INSTALL.md to install Detectron2.

Dataset download

  1. Download the datasets

BDD100K - Download the dataset from BDD100K page

Cityscapes - Follow the instruction on DA-Faster-RCNN

Kitty - Download the dataset from Kitty

MS COCO - Download the dataset from COCO

Synscapes - Follow the instruction on Synscapes

  1. Organize the dataset as following:
PMTeacher/
└── datasets/
    └── Daytime/
        ├── Annotations/
        ├── Imagesets/
        ├── JPEGImages/

  └── Night/
          ├── Annotations/
          ├── Imagesets/
          ├── JPEGImages/
  └── DuskDawn/
        ├── Annotations/
        ├── Imagesets/
        ├── JPEGImages/
  └── Kitty/
        ├── Annotations/
        ├── Imagesets/
        ├── JPEGImages/
  └── Cityscapes/
        ├── annotations/
        ├── gtFine/
        ├── leftIm8bits
  └── Synscapes/
        ├── img/
        ├── meta/
  └── Coco/
        ├── annotations/
        ├── train2017/

Training

Train the PMT under Daytime, Night (source) and DuskDawn (target)

python train_net.py \
      --num-gpus 4 \
      --config configs/crosstime.yaml \
      OUTPUT_DIR output/crosstime

Train the PMT under Cityscapes, Kitty (source) and Daytime (target)

python train_net.py \
      --num-gpus 4 \
      --config configs/crosscamera.yaml \
      OUTPUT_DIR output/crosscamera

Resume Training

python train_net.py \
      --resume \
      --num-gpus 4 \
      --config configs/crosstime.yaml \
      MODEL.WEIGHTS <your weight>.pth

Evaluation

python train_net.py \
      --eval-only \
      --num-gpus 4 \
      --config configs/crosstime.yaml \
      MODEL.WEIGHTS <your weight>.pth

Pre-trained Models

Crosstime Setting - Model

Crosscamera Setting - Model

Result comparison on the Crosstime Setting

Result comparison on the Crosscamera Setting