BHRL
[CVPR 2022] Balanced and Hierarchical Relation Learning for One-shot Object Detection
Install / Use
/learn @hero-y/BHRLREADME
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.

Installation
- Create a conda virtual environment and activate it
conda create -n BHRL python=3.7 -y
conda activate BHRL
- Install PyTorch and torchvision
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.2 -c pytorch
- Install mmcv
pip install mmcv-full==1.3.3 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html
- 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 hanqing.yang@zju.edu.cn
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}
}
Related Skills
proje
Interactive vocabulary learning platform with smart flashcards and spaced repetition for effective language acquisition.
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
groundhog
400Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
