Giter Site home page Giter Site logo

wmyname / vfa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csuhan/vfa

0.0 0.0 0.0 265 KB

Official code of the paper "Few-Shot Object Detection via Variational Feature Aggregation" (AAAI 2023)

Home Page: https://arxiv.org/abs/2301.13411

Shell 0.59% Python 99.41%

vfa's Introduction

VFA

Few-Shot Object Detection via Variational Feature Aggregation (AAAI2023)
Jiaming Han, Yuqiang Ren, Jian Ding, Ke Yan, Gui-Song Xia.
arXiv preprint.

Our code is based on mmfewshot.

Setup

  • Installation

Here is a from-scratch setup script.

conda create -n vfa python=3.8 -y
conda activate vfa

conda install pytorch==1.7.1 torchvision==0.8.2 cudatoolkit=11.0 -c pytorch

pip install openmim
mim install mmcv-full==1.3.12

# install mmclassification mmdetection
mim install mmcls==0.15.0
mim install mmdet==2.16.0

# install mmfewshot
mim install mmfewshot==0.1.0

# install VFA
python setup.py develop
  • Prepare Datasets

Please refer to mmfewshot's detection data preparation.

Model Zoo

All pretrained models can be found at github release.

Results on PASCAL VOC dataset

  • Base Training
Split Base AP50 config ckpt
1 78.6 config ckpt
2 79.5 config ckpt
3 79.8 config ckpt
  • Few Shot Fine-tuning
Split Shot nAP50 config ckpt
1 1 57.5 config ckpt
1 2 65.0 config ckpt
1 3 64.3 config ckpt
1 5 67.1 config ckpt
1 10 67.4 config ckpt
2 1 40.8 config ckpt
2 2 45.9 config ckpt
2 3 51.1 config ckpt
2 5 51.8 config ckpt
2 10 51.8 config ckpt
3 1 49.0 config ckpt
3 2 54.9 config ckpt
3 3 56.6 config ckpt
3 5 59.0 config ckpt
3 10 58.5 config ckpt

Results on COCO dataset

  • Base Training
Base mAP config ckpt
36.0 config ckpt
  • Few Shot Finetuning
Shot nAP config ckpt
10 16.8 config ckpt
30 19.5 config ckpt

Train and Test

  • Testing
# single-gpu test
python test.py ${CONFIG} ${CHECKPOINT} --eval mAP|bbox

# multi-gpus test
bash dist_test.sh ${CONFIG} ${CHECKPOINT} ${NUM_GPU} --eval mAP|bbox

For example:

  • test VFA on VOC split1 1-shot with sinel-gpu, we should run:
python test.py configs/vfa/voc/vfa_split1/vfa_r101_c4_8xb4_voc-split1_1shot-fine-tuning.py \
work_dirs/vfa_r101_c4_8xb4_voc-split1_1shot-fine-tuning/iter_400.pth \
--eval mAP
  • test VFA on COCO 10-shot with 8 gpus, we should run:
bash dist_test.sh configs/vfa/coco/vfa_r101_c4_8xb4_coco_10shot-fine-tuning.py \
work_dirs/vfa_r101_c4_8xb4_coco_10shot-fine-tuning/iter_10000.pth \
8 --eval bbox
  • Training
# single-gpu training
python train.py ${CONFIG}

# multi-gpus training
bash dist_train.sh ${CONFIG} ${NUM_GPU}

For example: train VFA on VOC.

# Stage I: base training.
bash dist_train.sh configs/vfa/voc/vfa_split1/vfa_r101_c4_8xb4_voc-split{1,2,3}_base-training.py 8

# Stage II: few-shot fine-tuning on all splits and shots.
voc_config_dir=configs/vfa/voc/
for split in 1 2 3; do
    for shot in 1 2 3 5 10; do
        config_path=${voc_config_dir}/vfa_split${split}/vfa_r101_c4_8xb4_voc-split${split}_${shot}shot-fine-tuning.py
        echo $config_path
        bash dist_train.sh $config_path 8
    done
done

Note: All our configs and models are trained with 8 gpus. You need to change the learning rate or batch size if you use fewer/more gpus.

Citation

If you find our work useful for your research, please consider citing:

@InProceedings{han2023vfa,
    title     = {Few-Shot Object Detection via Variational Feature Aggregation},
    author    = {Han, Jiaming and Ren, Yuqiang and Ding, Jian and Yan, Ke and Xia, Gui-Song},
    booktitle = {Proceedings of the 37th AAAI Conference on Artificial Intelligence (AAAI-23)},
    year      = {2023}
}

vfa's People

Contributors

csuhan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.