Git Product home page Git Product logo

rest's Introduction

Updates

  • (2022/05/10) Code of ResTV2 is released! ResTv2 simplifies the EMSA structure in ResTv1 (i.e., eliminating the multi-head interaction part) and employs an upsample operation to reconstruct the lost medium- and high-frequency information caused by the downsampling operation.

Official PyTorch implementation of ResTv1 and ResTv2, from the following paper:

ResT: An Efficient Transformer for Visual Recognition. NeurIPS 2021.
ResT V2: Simpler, Faster and Stronger. NeurIPS 2022.
By Qing-Long Zhang and Yu-Bin Yang
State Key Laboratory for Novel Software Technology at Nanjing University


ResTv1 is initially described in arxiv, which capably serves as a general-purpose backbone for computer vision. It can tackle input images with arbitrary size. Besides, ResT compressed the memory of standard MSA and model the interaction between multi-heads while keeping the diversity ability.

Catalog

  • ImageNet-1K Training Code
  • ImageNet-1K Fine-tuning Code
  • Downstream Transfer (Detection, Segmentation) Code

Results and Pre-trained Models

ImageNet-1K trained models

name resolution acc@1 #params FLOPs Throughput model
ResTv1-Lite 224x224 77.2 11M 1.4G 1246 baidu
ResTv1-S 224x224 79.6 14M 1.9G 1043 baidu
ResTv1-B 224x224 81.6 30M 4.3G 673 baidu
ResTv1-L 224x224 83.6 52M 7.9G 429 baidu
ResTv2-T 224x224 82.3 30M 4.1G 826 baidu
ResTv2-T 384x384 83.7 30M 12.7G 319 baidu
ResTv2-S 224x224 83.2 41M 6.0G 687 baidu
ResTv2-S 384x384 84.5 41M 18.4G 256 baidu
ResTv2-B 224x224 83.7 56M 7.9G 582 baidu
ResTv2-B 384x384 85.1 56M 24.3G 210 baidu
ResTv2-L 224x224 84.2 87M 13.8G 415 baidu
ResTv2-L 384x384 85.4 87M 42.4G 141 baidu

Note: Access code for baidu is rest. Pretrained models of ResTv1 is now available in google drive.

Installation

Please check INSTALL.md for installation instructions.

Evaluation

We give an example evaluation command for a ImageNet-1K pre-trained, then ImageNet-1K fine-tuned ResTv2-T:

Single-GPU

python main.py --model restv2_tiny --eval true \
--resume restv2_tiny_384.pth \
--input_size 384 --drop_path 0.1 \
--data_path /path/to/imagenet-1k

This should give

* Acc@1 83.708 Acc@5 96.524 loss 0.777
  • For evaluating other model variants, change --model, --resume, --input_size accordingly. You can get the url to pre-trained models from the tables above.
  • Setting model-specific --drop_path is not strictly required in evaluation, as the DropPath module in timm behaves the same during evaluation; but it is required in training. See TRAINING.md or our paper for the values used for different models.

Training

See TRAINING.md for training and fine-tuning instructions.

Acknowledgement

This repository is built using the timm library.

License

This project is released under the Apache License 2.0. Please see the LICENSE file for more information.

Citation

If you find this repository helpful, please consider citing:

ResTv1

@inproceedings{zhang2021rest,
  title={ResT: An Efficient Transformer for Visual Recognition},
  author={Qinglong Zhang and Yu-bin Yang},
  booktitle={Advances in Neural Information Processing Systems},
  year={2021},
  url={https://openreview.net/forum?id=6Ab68Ip4Mu}
}

ResTv2

@article{zhang2022rest,
  title={ResT V2: Simpler, Faster and Stronger},
  author={Zhang, Qing-Long and Yang, Yu-Bin},
  journal={arXiv preprint arXiv:2204.07366},
  year={2022}

Third-party Implementation

[2022/05/26] ResT and ResT v2 have been integrated into PaddleViT, checkout here for the 3rd party implementation on Paddle framework!

rest's People

Contributors

wofmanaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rest's Issues

How to train resT, not resT-v2

Hello. I want to train resT on my own dataset.
Therefore, I tried to write the model name 'rest_base' on args.model since this name exists in rest.py file.
However the error 'unrecognized arguments: -model rest_base' occured.

So which commands can I enter into args.model in order to train resT v1?

Performance in MVS

Hi~
Thanks for your excellent work! I see this words in your code:
x = self.avg_pool(x).flatten(1) # if use in MVS, should abandon this part
x = self.head(x) # if use in MVS, should abandon this part
It seems you have tried Rest in MVS task, I'm wandering what the perfomance of Rest in MVS, and what experiment you have tried.
Looking forward to your reply! Thanks!

关于类PA的作用

你好 很感谢你的工作。有一个问题想请教下:代码中class PA ()的作用是什么?感觉与论文2.4 Position Encoding不对应。因为代码中PA调用是在class PatchEmbed (认为与论文2.3 Patch Embedding相关)class BasicStem (the first patch embedding module)。综上 class PA ()与论文2.3 Patch Embedding相关,不与2.4 Position Encoding相关,但是论文2.4 Position Encoding中公式(8)描述了PA的Conv2d()和Sigmoid() 。
再次谢谢

数据集

你好,我想请问一下您训练的数据集是ImageNet-1K的哪一个呢

rest.py

Hello, if I want to try your backborn on other visual tasks, can I call rest.py directly?

ResT分类模型如何从断点resume继续训练

您好,我训练ResT-large到100多个epochs断了,输出文件有个checkpoint.pth.tar,我通过解压这个tar文件得到data.pkl和data,请问一下如果想获得pth权重文件,是解压data.pkl文件么

About finetune

Hello,when I use your ResT_base weight to my fine-frained image classification task, I use the "--finetune",but i got a mistake . in 264 line(main.py) :
**UnboundLocalError: local variable 'model_without_ddp' referenced before assignment.**how can i fix it?

by the way, in line 431 in main.py: n_parameters is not define,can you give the definition?

How to use ResT as my own backbone network

Hi, thanks for your great work. Now I want to use your Rest as my backbone network for visual target tracking. How do I implement this operation? Can I directly download your pre-trained model for loading?

KeyError: 'Non-existent config key: MODEL.REST'

你好,我安装了detectron2,直接在d2文件夹下,运行./train_net.py --num-gpus 1
--config-file ./configs/COCO-InstanceSegmentation/mask_rcnn_rest_base_FPN_1x.yaml
SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025。
然后报错:KeyError: 'Non-existent config key: MODEL.REST'。
请问可以麻烦教一下,怎么运行成功在的detectron2中运行ResT么

EMSA

大佬们江湖救急,我是新手想问一下ResT中的EMSA自注意力的泛化能力怎么样?能不能在别的transformer网络中替换MSA?EMSA的代码是rest.py中48-67行定义的Attention这个类吗?求告知,谢谢!

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.