Few-Shot Object Detection via Association and DIscrimination

Related tags

Deep Learning FADI
Overview

Few-Shot Object Detection via Association and DIscrimination

Code release of our NeurIPS 2021 paper: Few-Shot Object Detection via Association and DIscrimination.

FSCE Figure

Bibtex

@inproceedings{cao2021few,
  title={Few-Shot Object Detection via Association and DIscrimination},
  author={Cao, Yuhang and Wang, Jiaqi and Jin, Ying and Wu, Tong and Chen, Kai and Liu, Ziwei and Lin, Dahua},
  booktitle={Thirty-Fifth Conference on Neural Information Processing Systems},
  year={2021}
}

Arxiv: https://arxiv.org/abs/2111.11656

Install dependencies

  • Create a new environment: conda create -n fadi python=3.8 -y
  • Active the newly created environment: conda activate fadi
  • Install PyTorch and torchvision: conda install pytorch=1.7 torchvision cudatoolkit=10.2 -c pytorch -y
  • Install MMDetection: pip install mmdet==2.11.0
  • Install MMCV: pip install mmcv==1.2.5
  • Install MMCV-Full: pip install mmcv-full==1.2.5 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.7.0/index.html

Note:

  • Only tested on MMDet==2.11.0, MMCV==1.2.5, it may not be consistent with other versions.
  • The above instructions use CUDA 10.2, make sure you install the correct PyTorch, Torchvision and MMCV-Full that are consistent with your CUDA version.

Prepare dataset

We follow exact the same split with TFA, please download the dataset and split files as follows:

Create a directory data in the root directory, and the expected structure for data directory:

data/
    VOCdevkit
    few_shot_voc_split

Training & Testing

Base Training

FADI share the same base training stage with TFA, we directly convert the corresponding checkpoints from TFA in Detectron2 format to MMDetection format, please download the base training checkpoints following the table.

Name Split
AP50
download
Base Model 1 80.8 model  | surgery
Base Model 2 81.9 model  | surgery
Base Model 3 82.0 model  | surgery

Create a directory models in the root directory, and the expected structure for models directory:

models/
    voc_split1_base.pth
    voc_split1_base_surgery.pth
    voc_split2_base.pth
    voc_split2_base_surgery.pth
    voc_split3_base.pth
    voc_split3_base_surgery.pth

Few-Shot Fine-tuning

FADI divides the few-shot fine-tuning stage into two steps, ie, association and discrimination,

Suppose we want to train a model for Pascal VOC split1, shot1 with 8 GPUs

1. Step 1: Association.

Getting the assigning scheme of the split:

python tools/associate.py 1

Aligning the feature distribution of the associated base and novel classes:

./tools/dist_train.sh configs/voc_split1/fadi_split1_shot1_association.py 8

2. Step 2: Discrimination

Building a discriminate feature space for novel classes with disentangling and set-specialized margin loss:

./tools/dist_train.sh configs/voc_split1/fadi_split1_shot1_discrimination.py 8

Holistically Training:

We also provide you a script tools/fadi_finetune.sh to holistically train a model for a specific split/shot by running:

./tools/fadi_finetune.sh 1 1

Evaluation

To evaluate the trained models, run

./tools/dist_test.sh configs/voc_split1/fadi_split1_shot1_discrimination.py [checkpoint] 8 --eval mAP --out res.pkl

Model Zoo

Pascal VOC split 1

Shot
nAP50
download
1 50.6 association  | discrimination
2 54.8 association  | discrimination
3 54.1 association  | discrimination
5 59.4 association  | discrimination
10 63.5 association  | discrimination

Pascal VOC split 2

Shot
nAP50
download
1 30.5 association  | discrimination
2 35.1 association  | discrimination
3 40.3 association  | discrimination
5 42.9 association  | discrimination
10 48.3 association  | discrimination

Pascal VOC split 3

Shot
nAP50
download
1 45.7 association  | discrimination
2 49.4 association  | discrimination
3 49.4 association  | discrimination
5 55.1 association  | discrimination
10 59.3 association  | discrimination
You might also like...
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

CLEAR algorithm for multi-view data association
CLEAR algorithm for multi-view data association

CLEAR: Consistent Lifting, Embedding, and Alignment Rectification Algorithm The Matlab, Python, and C++ implementation of the CLEAR algorithm, as desc

graph-theoretic framework for robust pairwise data association
graph-theoretic framework for robust pairwise data association

CLIPPER: A Graph-Theoretic Framework for Robust Data Association Data association is a fundamental problem in robotics and autonomy. CLIPPER provides

Pytorch Implementation for NeurIPS (oral) paper: Pixel Level Cycle Association: A New Perspective for Domain Adaptive Semantic Segmentation

Pixel-Level Cycle Association This is the Pytorch implementation of our NeurIPS 2020 Oral paper Pixel-Level Cycle Association: A New Perspective for D

Implementation of association rules mining algorithms (Apriori|FPGrowth) using python.
Implementation of association rules mining algorithms (Apriori|FPGrowth) using python.

Association Rules Mining Using Python Implementation of association rules mining algorithms (Apriori|FPGrowth) using python. As a part of hw1 code in

Groceries ARL: Association Rules (Birliktelik Kuralı)

Groceries_ARL Association Rules (Birliktelik Kuralı) Birliktelik kuralları, mark

[CVPR21] LightTrack: Finding Lightweight Neural Network for Object Tracking via One-Shot Architecture Search
[CVPR21] LightTrack: Finding Lightweight Neural Network for Object Tracking via One-Shot Architecture Search

LightTrack: Finding Lightweight Neural Networks for Object Tracking via One-Shot Architecture Search The official implementation of the paper LightTra

MOT-Tracking-by-Detection-Pipeline - For Tracking-by-Detection format MOT (Multi Object Tracking), is it a framework that separates Detection and Tracking processes?
[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

Comments
  • Results and configs of COCO

    Results and configs of COCO

    Hey there. Thanks a lot for the quality codes! It seems like you guys are only releasing the configs and models of VOC. Is it available to access the COCO counterparts?

    opened by dangelosue 2
  • cannot download the

    cannot download the "few_shot_voc_split"

    When I click this link, I encounter this problem:“That didn't work We're sorry, can't be found in the mycuhk-my.sharepoint.com directory. Please try again later, while we try to automatically fix this for you.”

    opened by HuangLian126 2
  • Inquiry about the similarity results

    Inquiry about the similarity results

    Hey there. :)

    I'm curious about the similarity results from associate.py Based on your code, the motorbike has a similarity of 1.0 with a bicycle but 0 with the rest of the classes. But even the sofa has a similarity of 0.409 with a bottle...

    motorbike [('bicycle', 1.0), ('tvmonitor', 0.0), ('train', 0.0), ('pottedplant', 0.0), ('person', 0.0)]
    sofa [('chair', 0.867), ('diningtable', 0.596), ('car', 0.431), ('bottle', 0.409), ('aeroplane', 0.407)]
    

    Do you think it is approvable?

    And I also wonder why you guys have done the experiments on all different seeds selectively.

    seeds = {
            1: dict(shot1=1, shot2=6, shot3=1, shot5=4, shot10=4),
            2: dict(shot1=5, shot2=5, shot3=1, shot5=3, shot10=0),
            3: dict(shot1=1, shot2=1, shot3=1, shot5=5, shot10=1),
        }
    
    opened by dangelosue 0
Owner
Cao Yuhang
Cao Yuhang
Code for T-Few from "Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learning"

T-Few This repository contains the official code for the paper: "Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learni

null 220 Dec 31, 2022
Novel Instances Mining with Pseudo-Margin Evaluation for Few-Shot Object Detection

Novel Instances Mining with Pseudo-Margin Evaluation for Few-Shot Object Detection (NimPme) The official implementation of Novel Instances Mining with

null 12 Sep 8, 2022
Few-NERD: Not Only a Few-shot NER Dataset

Few-NERD: Not Only a Few-shot NER Dataset This is the source code of the ACL-IJCNLP 2021 paper: Few-NERD: A Few-shot Named Entity Recognition Dataset.

THUNLP 319 Dec 30, 2022
[ArXiv 2021] Data-Efficient Instance Generation from Instance Discrimination

InsGen - Data-Efficient Instance Generation from Instance Discrimination Data-Efficient Instance Generation from Instance Discrimination Ceyuan Yang,

GenForce: May Generative Force Be with You 93 Dec 25, 2022
Code for our CVPR 2022 Paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection"

GEN-VLKT Code for our CVPR 2022 paper "GEN-VLKT: Simplify Association and Enhance Interaction Understanding for HOI Detection". Contributed by Yue Lia

Yue Liao 47 Dec 4, 2022
Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy" (ICLR 2022 Spotlight)

About Code release for Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy (ICLR 2022 Spotlight)

THUML @ Tsinghua University 221 Dec 31, 2022
Official repository for Few-shot Image Generation via Cross-domain Correspondence (CVPR '21)

Few-shot Image Generation via Cross-domain Correspondence Utkarsh Ojha, Yijun Li, Jingwan Lu, Alexei A. Efros, Yong Jae Lee, Eli Shechtman, Richard Zh

Utkarsh Ojha 251 Dec 11, 2022
Few-shot Relation Extraction via Bayesian Meta-learning on Relation Graphs

Few-shot Relation Extraction via Bayesian Meta-learning on Relation Graphs This is an implemetation of the paper Few-shot Relation Extraction via Baye

MilaGraph 36 Nov 22, 2022
null 190 Jan 3, 2023
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

null 5 Dec 10, 2022