← 开源
microsoft

CSWin-Transformer

CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped, CVPR 2022

ModelsVision modelsPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
589
Star
81
Fork
+2
本周
4
贡献者
创建于 2021-07-02 · 更新于 2026-10-14 · 今日第 16476 名
主要开发者

microsoft/CSWin-Transformer 排名第 16,476,有 589 个星标。

同类别比较

microsoft/CSWin-Transformer 排名第 16,476,此处有 8 个同类条目;Shawn-IEITSystems/Yuan-1.0 排名第 16,485。

同类别比较
名称排名指标
IDKiro/DehazeFormer16,431
语言:
Python
星标数:
591
分叉数:
65
简介:
Vision Transformers for Single Image Dehazing
TencentARC/ToonComposer16,434
语言:
Python
星标数:
591
分叉数:
63
简介:
[ICLR 2026] Streamlining Cartoon Production with Generative Post-Keyframing
fe1ixxu/ALMA16,438
语言:
Ruby
星标数:
591
分叉数:
44
简介:
State-of-the-art LLM-based translation models.
wzzheng/OccWorld16,447
语言:
Python
星标数:
591
分叉数:
44
简介:
[ECCV 2024] 3D World Model for Autonomous Driving
Shawn-IEITSystems/Yuan-1.016,485
语言:
Python
星标数:
588
分叉数:
109
简介:
Yuan 1.0 Large pretrained LM
ByteDance-Seed/TraceAnything16,497
语言:
Python
星标数:
587
分叉数:
25
简介:
[ICLR 2026] Trace Anything: Representing Any Video in 4D via Trajectory Fields
FoundationVision/Groma16,498
语言:
Python
星标数:
587
分叉数:
44
简介:
[ECCV2024] Grounded Multimodal Large Language Model with Localized Visual Tokenization
pesser/pytorch_diffusion16,511
语言:
Python
星标数:
587
分叉数:
51
简介:
PyTorch reimplementation of Diffusion Models
关键参数与规格
关键参数与规格
参数值
语言Python
类别Models
子类别Vision models
关键词Benchmarks, Model architecture
星标数589
分叉数81
贡献者4
创建日期2021-07-02
更新日期2026-10-14
1 天星标数0
7 天星标数2
排名16,476
上次排名16,265
排名变化-211
7 天星标排名8,763
上次 7 天星标排名8,822
7 天星标排名变化59
总星标排名17,019
上次总星标排名16,995
总星标排名变化-24
国家USA
README 摘录

CSWin-Transformer, CVPR 2022 This repo is the official implementation of "CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows". Introduction **CSWin Transformer** (the name stands for **C**ross-**S**haped **Win**dow) is introduced in arxiv, which is a new general-purpose backbone for computer vision. It is a hierarchical Transformer and replaces the traditional full attention with our newly proposed cross-shaped window self-attention. The cross-shaped window self-attention mechanism computes self-attention in

the horizontal and vertical stripes in parallel that from a cross-shaped window, with each stripe obtained by splitting the input feature into stripes of equal width. With CSWin, we could realize global attention with a limited computation cost. CSWin Transformer achieves strong performance on ImageNet classification (87. 5 on val with only 97G flops) and ADE20K semantic segmentation ( on val), surpassing previous models by a large margin. 3G | - | model | | CSWin-S | ImageNet-1k | 224x224 | 83. 9G | - | model | | CSWin-B

| ImageNet-1k | 224x224 | 84. 0G | - | model | | CSWin-B | ImageNet-1k | 384x384 | 85. 0G | - | model | | CSWin-L | ImageNet-22k | 224x224 | 86. 5G | model | model | | CSWin-L | ImageNet-22k | 384x384 | 87. 6 | 42M | 279G | | CSwin-S | Mask R-CNN | ImageNet-1K | 3x | 50. 5 | 54M | 342G | | CSwin-B | Mask R-CNN | ImageNet-1K | 3x | 50. 9 | 97M | 526G | | CSwin-T | Cascade Mask R-CNN | ImageNet-1K | 3x | 52. 3 | 80M | 757G | | CSwin-S | Cascade Mask R-CNN | ImageNet-1K | 3x | 53. 4

| 92M | 820G | | CSwin-B | Cascade Mask R-CNN | ImageNet-1K | 3x | 53. 2 | - | 26M | 202G | | CSwin-S | Semantic FPN | ImageNet-1K | 512x512 | 80K | 49. 2 | - | 39M | 271G | | CSwin-B | Semantic FPN | ImageNet-1K | 512x512 | 80K | 49. 9 | - | 81M | 464G | | CSwin-T | UPerNet | ImageNet-1K | 512x512 | 160K | 49. 7 | 60M | 959G | | CSwin-S | UperNet | ImageNet-1K | 512x512 | 160K | 50. 5 | 65M | 1027G | | CSwin-B | UperNet | ImageNet-1K | 512x512 | 160K | 51. 2 | 109M | 1222G | | CSwin-B | UPerNet | ImageNet-22K | 640x640 | 160K | 51

. 6 | 109M | 1941G | | CSwin-L | UperNet | ImageNet-22K | 640x640 | 160K | 53. 7 | 208M | 2745G | pretrained models and code could be found at Requirements timm==0. , run: Apex for mixed precision training is used for finetuning. To install apex, run: Data prepare: ImageNet with the following folder structure, you can extract imagenet by this script. Cite CSWin Transformer Acknowledgement This repository is built using the timm library and the DeiT repository. License This project is licensed under the license found in

the LICENSE file in the root directory of this source tree. Microsoft Open Source Code of Conduct Contact Information For help or issues using CSWin Transformer, please submit a GitHub issue. For other communications related to CSWin Transformer, please contact Jianmin Bao ( ), Dong Chen ( ).

常见问题

记录了多少星标和分叉?

microsoft/CSWin-Transformer 有 589 个星标和 81 个分叉。

仓库排名是多少?

microsoft/CSWin-Transformer 排名第 16,476。

记录的语言和类别是什么?

microsoft/CSWin-Transformer 有 589 个星标,语言为 Python,类别为 Models。

哪个仓库排名最接近?

microsoft/CSWin-Transformer 与 Shawn-IEITSystems/Yuan-1.0 比较,后者排名第 16,485,有 588 个星标。

README

CSWin-Transformer, CVPR 2022

This repo is the official implementation of "CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows".

Introduction

CSWin Transformer (the name CSWin stands for Cross-Shaped Window) is introduced in arxiv, which is a new general-purpose backbone for computer vision. It is a hierarchical Transformer and replaces the traditional full attention with our newly proposed cross-shaped window self-attention. The cross-shaped window self-attention mechanism computes self-attention in the horizontal and vertical stripes in parallel that from a cross-shaped window, with each stripe obtained by splitting the input feature into stripes of equal width. With CSWin, we could realize global attention with a limited computation cost.

CSWin Transformer achieves strong performance on ImageNet classification (87.5 on val with only 97G flops) and ADE20K semantic segmentation (55.7 mIoU on val), surpassing previous models by a large margin.

Main Results on ImageNet

model pretrain resolution acc@1 #params FLOPs 22K model 1K model
CSWin-T ImageNet-1K 224x224 82.8 23M 4.3G - model
CSWin-S ImageNet-1k 224x224 83.6 35M 6.9G - model
CSWin-B ImageNet-1k 224x224 84.2 78M 15.0G - model
CSWin-B ImageNet-1k 384x384 85.5 78M 47.0G - model
CSWin-L ImageNet-22k 224x224 86.5 173M 31.5G model model
CSWin-L ImageNet-22k 384x384 87.5 173M 96.8G - model

Main Results on Downstream Tasks

COCO Object Detection

backbone Method pretrain lr Schd box mAP mask mAP #params FLOPS
CSwin-T Mask R-CNN ImageNet-1K 3x 49.0 43.6 42M 279G
CSwin-S Mask R-CNN ImageNet-1K 3x 50.0 44.5 54M 342G
CSwin-B Mask R-CNN ImageNet-1K 3x 50.8 44.9 97M 526G
CSwin-T Cascade Mask R-CNN ImageNet-1K 3x 52.5 45.3 80M 757G
CSwin-S Cascade Mask R-CNN ImageNet-1K 3x 53.7 46.4 92M 820G
CSwin-B Cascade Mask R-CNN ImageNet-1K 3x 53.9 46.4 135M 1004G

ADE20K Semantic Segmentation (val)

Backbone Method pretrain Crop Size Lr Schd mIoU mIoU (ms+flip) #params FLOPs
CSwin-T Semantic FPN ImageNet-1K 512x512 80K 48.2 - 26M 202G
CSwin-S Semantic FPN ImageNet-1K 512x512 80K 49.2 - 39M 271G
CSwin-B Semantic FPN ImageNet-1K 512x512 80K 49.9 - 81M 464G
CSwin-T UPerNet ImageNet-1K 512x512 160K 49.3 50.7 60M 959G
CSwin-S UperNet ImageNet-1K 512x512 160K 50.4 51.5 65M 1027G
CSwin-B UperNet ImageNet-1K 512x512 160K 51.1 52.2 109M 1222G
CSwin-B UPerNet ImageNet-22K 640x640 160K 51.8 52.6 109M 1941G
CSwin-L UperNet ImageNet-22K 640x640 160K 53.4 55.7 208M 2745G

pretrained models and code could be found at segmentation

Requirements

timm==0.3.4, pytorch>=1.4, opencv, ... , run:

bash install_req.sh

Apex for mixed precision training is used for finetuning. To install apex, run:

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./

Data prepare: ImageNet with the following folder structure, you can extract imagenet by this script.

│imagenet/
├──train/
│  ├── n01440764
│  │   ├── n01440764_10026.JPEG
│  │   ├── n01440764_10027.JPEG
│  │   ├── ......
│  ├── ......
├──val/
│  ├── n01440764
│  │   ├── ILSVRC2012_val_00000293.JPEG
│  │   ├── ILSVRC2012_val_00002138.JPEG
│  │   ├── ......
│  ├── ......

Train

Train the three lite variants: CSWin-Tiny, CSWin-Small and CSWin-Base:

bash train.sh 8 --data  --model CSWin_64_12211_tiny_224 -b 256 --lr 2e-3 --weight-decay .05 --amp --img-size 224 --warmup-epochs 20 --model-ema-decay 0.99984 --drop-path 0.2
bash train.sh 8 --data  --model CSWin_64_24322_small_224 -b 256 --lr 2e-3 --weight-decay .05 --amp --img-size 224 --warmup-epochs 20 --model-ema-decay 0.99984 --drop-path 0.4
bash train.sh 8 --data  --model CSWin_96_24322_base_224 -b 128 --lr 1e-3 --weight-decay .1 --amp --img-size 224 --warmup-epochs 20 --model-ema-decay 0.99992 --drop-path 0.5

If you want to train our CSWin on images with 384x384 resolution, please use '--img-size 384'.

If the GPU memory is not enough, please use '-b 128 --lr 1e-3 --model-ema-decay 0.99992' or use checkpoint '--use-chk'.

Finetune

Finetune CSWin-Base with 384x384 resolution:

bash finetune.sh 8 --data  --model CSWin_96_24322_base_384 -b 32 --lr 5e-6 --min-lr 5e-7 --weight-decay 1e-8 --amp --img-size 384 --warmup-epochs 0 --model-ema-decay 0.9998 --finetune  --epochs 20 --mixup 0.1 --cooldown-epochs 10 --drop-path 0.7 --ema-finetune --lr-scale 1 --cutmix 0.1

Finetune ImageNet-22K pretrained CSWin-Large with 224x224 resolution:

bash finetune.sh 8 --data  --model CSWin_144_24322_large_224 -b 64 --lr 2.5e-4 --min-lr 5e-7 --weight-decay 1e-8 --amp --img-size 224 --warmup-epochs 0 --model-ema-decay 0.9996 --finetune <22k-pretrained model> --epochs 30 --mixup 0.01 --cooldown-epochs 10 --interpolation bicubic  --lr-scale 0.05 --drop-path 0.2 --cutmix 0.3 --use-chk --fine-22k --ema-finetune

If the GPU memory is not enough, please use checkpoint '--use-chk'.

Cite CSWin Transformer

@misc{dong2021cswin,
      title={CSWin Transformer: A General Vision Transformer Backbone with Cross-Shaped Windows}, 
        author={Xiaoyi Dong and Jianmin Bao and Dongdong Chen and Weiming Zhang and Nenghai Yu and Lu Yuan and Dong Chen and Baining Guo},
        year={2021},
        eprint={2107.00652},
        archivePrefix={arXiv},
        primaryClass={cs.CV}
}

Acknowledgement

This repository is built using the timm library and the DeiT repository.

License

This project is licensed under the license found in the LICENSE file in the root directory of this source tree.

Microsoft Open Source Code of Conduct

Contact Information

For help or issues using CSWin Transformer, please submit a GitHub issue.

For other communications related to CSWin Transformer, please contact Jianmin Bao (jianbao@microsoft.com), Dong Chen (doch@microsoft.com).

排名相邻
同类项目