Git Product home page Git Product logo

openbct's Introduction

OpenBCT

Introduction

OpenBCT is a Non Official Reimplementation for Towards Backward-Compatible Representation Learning (CVPR 2020 oral), which aims at achieving compatibility across different models.

Feature List

  • Baselines for Backward Compatible Training
  • Influence Loss with old classifier
  • Pseudo old classifier generation

Requirements

  • Python >= 3.6
  • Pytorch >= 1.2.0
  • torchvision == 0.2.1
  • numpy
  • sklearn
  • easydict

Datasets

This code conducts training and evaluation on ImageNet LSVRC 2012 and Places365(easy directory structure) datasets. Please be noticed that, due to the privacy issue, this code will NOT provide the train and test code for face datasets in our CVPR 2020 paper.

After you download these two datasets, extract them and make sure there are ./train and ./val folders inside. You can find the training image lists we use from Google Drive Link or Weiyun Link.

Train

For training an old model without any regularization,

python main.py your_dataset_dir --train-img-list imgnet_train_img_list_for_old.txt -a resnet18 

For training a new model with infulence loss (old classifier regularization),

python main.py your_dataset_dir --train-img-list imgnet_train_img_list_for_new.txt -a resnet50 --old-fc your_old_fc_weights_dir --n2o-map ./imgnet_new2old_map.npy

For training a new model with L2 regression loss (one of the compared baseline),

python main.py your_dataset_dir --train-img-list imgnet_train_img_list_for_new.txt -a resnet50 --old-arch resnet18 --old-checkpoint your_old_model_dir --old-fc your_old_fc_weights_dir --l2 --use-feat

Test

For cross test between two models,

python main.py your_dataset_dir -a resnet50 --pretrained --checkpoint your_new_model_dir --use-feat -e --cross-eval --old-arch resnet18 --old-checkpoint your_old_model_dir

For self test with single model,

python main.py your_dataset_dir -a resnet50 --pretrained --checkpoint your_model_dir --use-feat -e

Results

Influence loss results on ImagNet are listed as below. More results are on the way.

Old Model New Model Val Set Top-1 Acc Top-5 Acc
resnet18 (100%) resnet18 (100%) ImageNet Val 52.4% 74.4%
resnet18 (100%) resnet50-BCT (100%) ImageNet Val 55.5% 78.0%
resnet50 (100%) resnet50 (100%) ImageNet Val 62.0% 80.7%

(x% denotes the training data usage amount)

Acknowledgement

The code is based on Open-ReID and Pytorch-ImageNet-Example. Thank these researchers for sharing their great code!

Citation

If this code helps your research or project, please cite

@inproceedings{shen2020towards,
  title={Towards backward-compatible representation learning},
  author={Shen, Yantao and Xiong, Yuanjun and Xia, Wei and Soatto, Stefano},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={6368--6377},
  year={2020}
}

Contact

If you have any question, please feel free to contact

Yantao Shen: [email protected]

openbct's People

Contributors

yantaoshen 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.