Git Product home page Git Product logo

ifs-rcnn's Introduction

iFS-RCNN: An Incremental Few-shot Instance Segmenter

This is the official code for the CVPR 2022 paper: "iFS-RCNN: An Incremental Few-shot Instance Segmenter"

This codebase is primarily based on this codebase of https://github.com/ucbdrive/few-shot-object-detection

Table of Contents

Installation

Requirements

  • Linux with Python >= 3.6
  • PyTorch >= 1.4
  • torchvision that matches the PyTorch installation
  • CUDA 10.0, 10.1, 10.2
  • GCC >= 4.9

Build fsdet

  • Create a virtual environment.
python3 -m venv fsdet
source fsdet/bin/activate

You can also use conda to create a new environment.

conda create --name fsdet
conda activate fsdet
  • Install Pytorch 1.6 with CUDA 10.2
pip install torch torchvision

You can choose the Pytorch and CUDA version according to your machine. Just to make sure your Pytorch version matches the prebuilt detectron2

  • Install Detectron2 v0.2.1
python3 -m pip install detectron2 -f \
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.6/index.html
  • Install other requirements.
python3 -m pip install -r requirements.txt

Code Structure

  • configs: Configuration files
  • datasets: Dataset files (see Data Preparation for more details)
  • iFS-RCNN
    • checkpoint: Checkpoint code.
    • config: Configuration code and default configurations.
    • engine: Contains training and evaluation loops and hooks.
    • layers: Implementations of different layers used in models.
    • modeling: Code for models, including backbones, proposal networks, and prediction heads.
  • tools
    • train_net.py: Training script.
    • test_net.py: Testing script.
    • ckpt_surgery.py: Surgery on checkpoints.
    • run_experiments.py: Running experiments across many seeds.
    • aggregate_seeds.py: Aggregating results from many seeds.

Data Preparation

We evaluate our models on two datasets:

  • COCO: We use COCO 2014 and extract 5k images from the val set for evaluation and use the rest for training. We use the 20 object classes that are the same with PASCAL VOC as novel classes and use the rest as base classes.
  • LVIS: We treat the frequent and common classes as the base classes and the rare categories as the novel classes.

See datasets/README.md for more details.

Getting Started

Training & Evaluation in Command Line

  • To train a model on base classes, refer to the train.sh script

  • To fine-tune a model on novel classes, refer to the finetuning.sh script

  • To evaluate the trained models, refer to the test.sh script

Multiple Runs

ifs-rcnn's People

Contributors

ducminhkhoi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ifs-rcnn's Issues

pre-trained weights

Hello @ducminhkhoi,

Firstly, thank you for your great work!!

Could you you provide the pre-trained model(weights) for "configs/COCO-detection/mask_rcnn/mask_rcnn_R_50_FPN_base.yaml" as well??

I want to do only fine-tuning on my custom data (as novel classes) so it will be very helpful if you can provide pre-trained weights(probably, model_final.pth) which trained on COCO base classes.

Thank you in advance..

No such file

Hi @ducminhkhoi , It is a great contribution to few shot incremental object detection problem. I am trying to replicate the results that given in the paper. I am getting following issue.

  1. While running train.sh file, I am getting the following error: FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/trainval2014/COCO_train2014_000000089914.jpg' Could you please let me know why this is happening.

Thanks

Architecture of the model concern

Hi anh Khoi,

Em có một vài thắc mắc:

  1. Model này có phải training theo Meta learning không?

  2. Topic này bao gồm few-shot learning. Nếu vậy thì "coco_trainval_novel_1shot" có phải là support set, còn "coco_test_novel" thì là query set phải không anh?
    E.g: config file:

  TRAIN: ('coco_trainval_novel_1shot',)
  TEST: ('coco_test_novel',)
  1. Tại sao mình không sử dụng query set để train như trong bài này ạ? Feature Weighting and Boosting for Few-Shot Segmentation

Thanks anh.

About loss in Eq1

Hi @ducminhkhoi , can you please let me know where exactly the loss is calculated in Equation 1?. I am checking through file in (iFSCRCNN-> modeling -> roi_heads -> fastrcnn.py), but I didn't get any variance matrix for classifier weights that mentioned in equation.

base training

Hi @ducminhkhoi ,

In the base training stage of train.sh, there is no shot number. It is different in the paper's experiment, as I read there are 1,5,10 shots in the bases classes training (Table 2).
Do you train on 1,5,10 shots for bases classes, or you train without considering "shot" for base classes?

arch=50 
network=mask_rcnn 
num_gpus=8

dataset=coco
detection_folder=${dataset^^}-detection


# standard softmax Mask-RCNN
suffix=''
python3 -m tools.train_net --num-gpus $num_gpus --config-file configs/${detection_folder}/${network}/${network}_R_${arch}_FPN_base${suffix}.yaml

Screen Shot 2023-01-27 at 15 43 26

Thank you.

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.