(ImageNet pretrained models) The official pytorch implemention of the TPAMI paper "Res2Net: A New Multi-scale Backbone Architecture"

Overview

Res2Net

The official pytorch implemention of the paper "Res2Net: A New Multi-scale Backbone Architecture"

Our paper is accepted by IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI).

Update

Introduction

We propose a novel building block for CNNs, namely Res2Net, by constructing hierarchical residual-like connections within one single residual block. The Res2Net represents multi-scale features at a granular level and increases the range of receptive fields for each network layer. The proposed Res2Net block can be plugged into the state-of-the-art backbone CNN models, e.g. , ResNet, ResNeXt, BigLittleNet, and DLA. We evaluate the Res2Net block on all these models and demonstrate consistent performance gains over baseline models.

Sample

Res2Net module

Useage

Requirement

PyTorch>=0.4.1

Examples

git clone https://github.com/gasvn/Res2Net.git

from res2net import res2net50
model = res2net50(pretrained=True)

Input image should be normalized as follows:

normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                  std=[0.229, 0.224, 0.225])

(By default, the model will be downloaded automatically. If the default download link is not available, please refer to the Download Link listed on Pretrained models.)

Pretrained models

model #Params MACCs top-1 error top-5 error Link
Res2Net-50-48w-2s 25.29M 4.2 22.68 6.47 OneDrive
Res2Net-50-26w-4s 25.70M 4.2 22.01 6.15 OneDrive
Res2Net-50-14w-8s 25.06M 4.2 21.86 6.14 OneDrive
Res2Net-50-26w-6s 37.05M 6.3 21.42 5.87 OneDrive
Res2Net-50-26w-8s 48.40M 8.3 20.80 5.63 OneDrive
Res2Net-101-26w-4s 45.21M 8.1 20.81 5.57 OneDrive
Res2NeXt-50 24.67M 4.2 21.76 6.09 OneDrive
Res2Net-DLA-60 21.15M 4.2 21.53 5.80 OneDrive
Res2NeXt-DLA-60 17.33M 3.6 21.55 5.86 OneDrive
Res2Net-v1b-50 25.72M 4.5 19.73 4.96 Link
Res2Net-v1b-101 45.23M 8.3 18.77 4.64 Link
Res2Net-v1b-200-SSLD 76.21M 15.7 14.87 2.58 PaddlePaddleLink

News

  • Res2Net_v1b is now available.
  • You can load the pretrained model by using pretrained = True.

The download link from Baidu Disk is now available. (Baidu Disk password: vbix)

Applications

Other applications such as Classification, Instance segmentation, Object detection, Semantic segmentation, Salient object detection, Class activation map,Tumor segmentation on CT scans can be found on https://mmcheng.net/res2net/ .

Citation

If you find this work or code is helpful in your research, please cite:

@article{gao2019res2net,
  title={Res2Net: A New Multi-scale Backbone Architecture},
  author={Gao, Shang-Hua and Cheng, Ming-Ming and Zhao, Kai and Zhang, Xin-Yu and Yang, Ming-Hsuan and Torr, Philip},
  journal={IEEE TPAMI},
  year={2021},
  doi={10.1109/TPAMI.2019.2938758}, 
}

Contact

If you have any questions, feel free to E-mail me via: shgao(at)live.com

Comments
  • Res2NeXt on Cifar100

    Res2NeXt on Cifar100

    Hi @gasvn ,

    Thanks for the brilliant work!

    I have a couple of simple questions regarding Res2NeXt on Cifar100.

    1. The implementation for ImageNet used the block without hierarchical addition for downsampling, but the code you mentioned in other issue threads (https://gist.github.com/gasvn/cd7653ef93fb147be05f1ae4abad6589) used group convolutions as the first block at each stage for downsampling instead. I wonder which one is the correct one?
    2. Did you use batch size 256 or 128 for the training? I saw your init LR was set to 0.05, which was used by ResNeXt for batch size 256.

    Best wishes,

    Qiang

    opened by qiangwang57 13
  • Loading State Dict

    Loading State Dict

    Hello, I am trying to load in the state dict provided in the OneDrive link, but ran into issues due to there being differences between the expected state_dict and the given one. Specifically, the res2net101 checkpoint is failing for me.

    opened by vatsalag99 10
  • load model issue

    load model issue

    Thank you for your excellent work. Just like issue 5, I ran into the same problem and added "strict = False" to the solution you gave, but the problem still hasn't been solved and the same error still occurs. I tried to load res2net-50-26w-4s. Look forward to your reply. cuda:8.0 python:3.6 pytorch:0.4.0 torchvision:0.1.18

    opened by XiaoHao-Chen 7
  • 数组越界

    数组越界

    Traceback (most recent call last): File "train.py", line 160, in main() File "train.py", line 66, in main train(train_loader, model, optimizer, epoch) File "train.py", line 94, in train output = model(image) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/net.py", line 28, in forward x_block1, x_block2, x_block3, x_block4 = self.E(x) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/modules.py", line 62, in forward x_block1 = self.layer1(x) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 67, in forward input = module(input) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in call result = self.forward(*input, **kwargs) File "/root/Revisiting_Single_Depth_Estimation-master/models/resnet.py", line 162, in forward sp = self.relu(self.bnsi) File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 101, in getitem raise IndexError('index {} is out of range'.format(idx)) IndexError: index 2 is out of range

    opened by shezhi 6
  • Squeeze excite module?

    Squeeze excite module?

    The original paper makes use of squeeze and excite modules(se modules). Certain alternative implementations(https://github.com/4uiiurz1/pytorch-res2net) include them too.

    However this repo does not. Are there any plans to release official code with the se modules included?

    opened by VRandme 6
  • res2net50移植到faster-rcnn网络中,检测结果不好

    res2net50移植到faster-rcnn网络中,检测结果不好

    作者你好,非常感谢你的代码,我将pytorch-faster-rcnn的特征提取网络换成了res2net50_26w_4s,在VOC2007上训练和测试,最终的测试结果mAP = 71.05%,没有得到你论文中的mAP=74.4%,请问是什么原因呢?我将res2net50_26w_4s的block1设置为不参加训练,block4设置stype = 'normal',使得在block4中的stride=1,请问我有哪些需要注意的地方吗?我用的faster-rcnn源代码是pytorch-faster-rcnn,期待你的回复

    opened by StrongBirds 6
  • In mmdetection,applying DCNv2 in the Res2Net code will cause errors, while DCN will not?

    In mmdetection,applying DCNv2 in the Res2Net code will cause errors, while DCN will not?

    File "/data/xmy/mmdet_new/mmdetection/mmdet/models/backbones/res2net.py", line 211, in forward out = _inner_forward(x) File "/data/xmy/mmdet_new/mmdetection/mmdet/models/backbones/res2net.py", line 181, in _inner_forward main() sp = self.convsi File "/home/l547/anaconda3/envs/MMDET_xmy1/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call

    File "./tools/train.py", line 138, in main meta=meta) File "/data/xmy/mmdet_new/mmdetection/mmdet/apis/train.py", line 102, in train_detector result = self.forward(*input, **kwargs) File "/data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv.py", line 403, in forward meta=meta) File "/data/xmy/mmdet_new/mmdetection/mmdet/apis/train.py", line 177, in _dist_train self.groups, self.deformable_groups) File "/data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv.py", line 148, in forward ctx.groups, ctx.deformable_groups, ctx.with_bias)

    RuntimeErrorrunner.run(data_loaders, cfg.workflow, cfg.total_epochs): 
    

    input tensor has to be contiguous (modulated_deform_conv_cuda_forward at mmdet/ops/dcn/src/deform_conv_cuda.cpp:497) frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x6d (0x7ff852af333d in /home/l547/anaconda3/envs/MMDET_xmy1/lib/python3.7/site-packages/torch/lib/libc10.so) frame #1: modulated_deform_conv_cuda_forward(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, bool) + 0x1285 (0x7ff81a84ceb5 in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so) frame #2: + 0x26fed (0x7ff81a85cfed in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so) frame #3: + 0x2722e (0x7ff81a85d22e in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so) frame #4: + 0x22f9c (0x7ff81a858f9c in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so) .......

    opened by Taylor-X76 5
  • load pretrain model issue

    load pretrain model issue

    RuntimeError: Error(s) in loading state_dict for Res2Net: size mismatch for layer1.0.downsample.1.weight: copying a param of torch.Size([256]) from checkpoint, where the shape is torch.Size([256, 64, 1, 1]) in current model. size mismatch for layer2.0.downsample.1.weight: copying a param of torch.Size([512]) from checkpoint, where the shape is torch.Size([512, 256, 1, 1]) in current model. size mismatch for layer3.0.downsample.1.weight: copying a param of torch.Size([1024]) from checkpoint, where the shape is torch.Size([1024, 512, 1, 1]) in current model.

    when i load res2net50_v1b.pth, i meet this problem, but i can load res2net50_26w_4s.pth pretrain model to train my network. i guess there is a problem between pytorch version?

    pytorch: 0.4.1; torchvision: 0.2.1 python: 3.6

    opened by zzzmm1 5
  • [state_dict] HTTP Error 403: Forbidden

    [state_dict] HTTP Error 403: Forbidden

    Hey there,

    Thanks a lot for your implementation! I tweaked it a bit for my personal need but it definitely helped me a lot.

    Initially, when I checked, none of the links provided for res2net or res2next were working. So I used links to OneDrive you provided in the Readme.

    Unfortunately, OneDrive seems to regenerate download links regularly, meaning that I cannot use any static link for wget-like instructions. So I checked again and the links in your python files were working again.

    Today I checked:

    wget http://mc.nankai.edu.cn/projects/res2net/pretrainmodels/res2net50_26w_4s-06e79181.pth
    

    and I received again the following error:

    --2019-09-29 12:50:09--  http://mc.nankai.edu.cn/projects/res2net/pretrainmodels/res2net50_26w_4s-06e79181.pth
    Resolving mc.nankai.edu.cn (mc.nankai.edu.cn)... 222.30.45.190
    Connecting to mc.nankai.edu.cn (mc.nankai.edu.cn)|222.30.45.190|:80... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2019-09-29 12:50:11 ERROR 403: Forbidden.
    

    Am I doing anything wrong? Could you let us know about the best way / fixed URLs to get the weights please?

    Cheers

    opened by frgfm 5
  • load model issue

    load model issue

    when I load the model in distributed mode,there exists the issue as follows. The first node cost the sum memory of the all memory. But when I load the resnet models in the same way ,the issues disappear.Could you tell me the reason? Thanks a lot.

    opened by runzeer 5
  • difference between res2net and res2net_v1b

    difference between res2net and res2net_v1b

    thank your amazing work. compared with original version of Res2Net, res2net_v1b make two difference: 1.replace conv 7*7 with this 2.downsample replace conv(stride=2) with avgpool2d this

    after changing these, Res2Net_v1b has more than 2% improvement on ImageNet top1 acc. compared with original version of Res2Net am I right? thank your reply

    opened by junliang230 4
  • About SSLD pretrained model

    About SSLD pretrained model

    Hi, I am the author of SSLD. I noticed that the weight of SSLD has been added to your repo, but here it should be Res2Net-D instead of ResNet-B. I hope you can confirm it at your convenience.

    opened by cuicheng01 3
  • 26是否可以替换成其他更小数值

    26是否可以替换成其他更小数值

    看res2net的layer1部分:26*4 = 104 ==conv1x1==> 256 想减小通道数,把256 改成 64 请问,可以把26改成13,或者更小吗?会有什么不好的影响吗

    比如下面: ① 134 = 52 ==conv1x1==> 64 ② 74 = 28 ==conv1x1==> 64 谢谢

    opened by laocan 2
Owner
Res2Net Applications
Applications of the multi-scale backbone Res2Net (TPAMI 2020)
Res2Net Applications
Official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels".

WarPI The official PyTorch implemention of our paper "Learning to Rectify for Robust Learning with Noisy Labels". Run python main.py --corruption_type

Haoliang Sun 3 Sep 3, 2022
DenseNet Implementation in Keras with ImageNet Pretrained Models

DenseNet-Keras with ImageNet Pretrained Models This is an Keras implementation of DenseNet with ImageNet pretrained weights. The weights are converted

Felix Yu 568 Oct 31, 2022
PyTorch implemention of ICCV'21 paper SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation

SGPA: Structure-Guided Prior Adaptation for Category-Level 6D Object Pose Estimation This is the PyTorch implemention of ICCV'21 paper SGPA: Structure

Chen Kai 24 Dec 5, 2022
An official implementation of "SFNet: Learning Object-aware Semantic Correspondence" (CVPR 2019, TPAMI 2020) in PyTorch.

PyTorch implementation of SFNet This is the implementation of the paper "SFNet: Learning Object-aware Semantic Correspondence". For more information,

CV Lab @ Yonsei University 87 Dec 30, 2022
Official PyTorch implementation and pretrained models of the paper Self-Supervised Classification Network

Self-Classifier: Self-Supervised Classification Network Official PyTorch implementation and pretrained models of the paper Self-Supervised Classificat

Elad Amrani 24 Dec 21, 2022
The PyTorch improved version of TPAMI 2017 paper: Face Alignment in Full Pose Range: A 3D Total Solution.

Face Alignment in Full Pose Range: A 3D Total Solution By Jianzhu Guo. [Updates] 2020.8.30: The pre-trained model and code of ECCV-20 are made public

Jianzhu Guo 3.4k Jan 2, 2023
This is the pytorch implementation for the paper: *Learning Accurate Performance Predictors for Ultrafast Automated Model Compression*, which is in submission to TPAMI

SeerNet This is the pytorch implementation for the paper: Learning Accurate Performance Predictors for Ultrafast Automated Model Compression, which is

null 3 May 1, 2022
Official Pytorch Implementation of: "ImageNet-21K Pretraining for the Masses"(2021) paper

ImageNet-21K Pretraining for the Masses Paper | Pretrained models Official PyTorch Implementation Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, Lihi Zelni

null 574 Jan 2, 2023
The implemention of Video Depth Estimation by Fusing Flow-to-Depth Proposals

Flow-to-depth (FDNet) video-depth-estimation This is the implementation of paper Video Depth Estimation by Fusing Flow-to-Depth Proposals Jiaxin Xie,

null 32 Jun 14, 2022
Super Pix Adv - Offical implemention of Robust Superpixel-Guided Attentional Adversarial Attack (CVPR2020)

Super_Pix_Adv Offical implemention of Robust Superpixel-Guided Attentional Adver

DLight 8 Oct 26, 2022
Facebook Research 605 Jan 2, 2023
Official PyTorch implementation of N-ImageNet: Towards Robust, Fine-Grained Object Recognition with Event Cameras (ICCV 2021)

N-ImageNet: Towards Robust, Fine-Grained Object Recognition with Event Cameras Official PyTorch implementation of N-ImageNet: Towards Robust, Fine-Gra

null 32 Dec 26, 2022
Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch

Pytorch Lightning 1.4k Jan 1, 2023
A PyTorch re-implementation of the paper 'Exploring Simple Siamese Representation Learning'. Reproduced the 67.8% Top1 Acc on ImageNet.

Exploring simple siamese representation learning This is a PyTorch re-implementation of the SimSiam paper on ImageNet dataset. The results match that

Taojiannan Yang 72 Nov 9, 2022
PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization using Augmented-Self Reference and Dense Semantic Correspondence) and pre-trained model on ImageNet dataset

Reference-Based-Sketch-Image-Colorization-ImageNet This is a PyTorch implementation of CVPR 2020 paper (Reference-Based Sketch Image Colorization usin

Yuzhi ZHAO 11 Jul 28, 2022
DVG-Face: Dual Variational Generation for Heterogeneous Face Recognition, TPAMI 2021

DVG-Face: Dual Variational Generation for HFR This repo is a PyTorch implementation of DVG-Face: Dual Variational Generation for Heterogeneous Face Re

null 52 Dec 30, 2022
Deep Learning for 3D Point Clouds: A Survey (IEEE TPAMI, 2020)

??Deep Learning for 3D Point Clouds (IEEE TPAMI, 2020)

Qingyong 1.4k Jan 8, 2023
PFENet: Prior Guided Feature Enrichment Network for Few-shot Segmentation (TPAMI).

PFENet This is the implementation of our paper PFENet: Prior Guided Feature Enrichment Network for Few-shot Segmentation that has been accepted to IEE

DV Lab 230 Dec 31, 2022
[TPAMI 2021] iOD: Incremental Object Detection via Meta-Learning

Incremental Object Detection via Meta-Learning To appear in an upcoming issue of the IEEE Transactions on Pattern Analysis and Machine Intelligence (T

Joseph K J 66 Jan 4, 2023