Skip to content
/ BHRL Public

[CVPR 2022] Balanced and Hierarchical Relation Learning for One-shot Object Detection

License

Notifications You must be signed in to change notification settings

hero-y/BHRL

Repository files navigation

Balanced and Hierarchical Relation Learning for One-shot Object Detection

This repository is an official implementation of the CVPR 2022 paper "Balanced and Hierarchical Relation Learning for One-shot Object Detection", based on mmdetection. BHRL

Installation

  1. Create a conda virtual environment and activate it
conda create -n BHRL python=3.7 -y
conda activate BHRL
  1. Install PyTorch and torchvision
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.2 -c pytorch
  1. Install mmcv
pip install mmcv-full==1.3.3 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html
  1. Install build requirements and then install MMDetection.
pip install -r requirements/build.txt
pip install -v -e . 

Datasets Preparation

Download coco dataset and voc dataset from the official websites.

Download voc_annotation from this link.

Download ref_ann_file from this link.

We expect the directory structure to be the following:

BHRL
β”œβ”€β”€ data
β”‚   β”œβ”€β”€coco
β”‚   β”‚   β”œβ”€β”€ annotations
β”‚   β”‚   β”œβ”€β”€ train2017
β”‚   β”‚   β”œβ”€β”€ val2017
β”‚   β”œβ”€β”€VOCdevkit
β”‚   β”‚   β”œβ”€β”€ voc_annotation
β”‚   β”‚   β”œβ”€β”€ VOC2007
β”‚   β”‚   β”œβ”€β”€ VOC2012
β”œβ”€β”€ ref_ann_file
...

Backbone Weight Preparation

Download the ResNet50 model for training from this link.

BHRL
β”œβ”€β”€ resnet_model
β”‚   β”œβ”€β”€res50_loadfrom.pth

Inference with a pretrained model

./tools/dist_test.sh ${CONFIG} ${CHECKPOINT} ${GPUS} --out ${RESULTS} --eval bbox --average ${EVALUATION_NUMBER}

# e.g.,
# test unseen classes
./tools/dist_test.sh configs/coco/split1/BHRL.py checkpoints/model_split1.pth 8 --out results.pkl --eval bbox --average 5
# test seen classes
./tools/dist_test.sh configs/coco/split1/BHRL.py checkpoints/model_split1.pth 8 --out results.pkl --eval bbox --average 5 --test_seen_classes

Download the pretrained models for inferencing from this link.

Train a model

./tools/dist_train.sh ${CONFIG} ${GPUS} --no-validate

# e.g.,
./tools/dist_train.sh configs/coco/split1/BHRL.py 8 --no-validate

Note: we observe an obvious variation of the performance for different runs on the VOC dataset due to its small amount of data, and we are still investigating possible solutions to stabilize the results. Moreover, the variation of performance on unseen classes is normal because the model is not trained on unseen classes.

Contact

For any questions, please contact [email protected]

Citation

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

@InProceedings{BHRL,
    author    = {Yang, Hanqing and Cai, Sijia and Sheng, Hualian and Deng, Bing and Huang, Jianqiang and Hua, Xiansheng and Tang, Yong and Zhang, Yu},
    title     = {Balanced and Hierarchical Relation Learning for One-shot Object Detection},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022}
}

About

[CVPR 2022] Balanced and Hierarchical Relation Learning for One-shot Object Detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published