nielsr HF Staff commited on
Commit
b23a02d
·
verified ·
1 Parent(s): 6817854

Update code link and add Github README content

Browse files

This PR corrects the code link to the official repository (https://github.com/jameslahm/lsnet) and incorporates the content from the Github README to provide more comprehensive information about the model, training, and usage.

Files changed (1) hide show
  1. README.md +109 -3
README.md CHANGED
@@ -1,16 +1,18 @@
1
  ---
 
 
2
  tags:
3
  - image-classification
4
  - timm
5
  library_tag: timm
6
- license: mit
7
- library_name: timm
8
  ---
 
9
  # LSNet: See Large, Focus Small
10
 
11
  Paper: https://arxiv.org/abs/2503.23135
12
 
13
- Code: https://github.com/THU-MIG/lsnet
14
 
15
  ```bibtex
16
  @misc{wang2025lsnetlargefocussmall,
@@ -22,4 +24,108 @@ Code: https://github.com/THU-MIG/lsnet
22
  primaryClass={cs.CV},
23
  url={https://arxiv.org/abs/2503.23135},
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  ```
 
1
  ---
2
+ library_name: timm
3
+ license: mit
4
  tags:
5
  - image-classification
6
  - timm
7
  library_tag: timm
8
+ pipeline_tag: image-classification
 
9
  ---
10
+
11
  # LSNet: See Large, Focus Small
12
 
13
  Paper: https://arxiv.org/abs/2503.23135
14
 
15
+ Code: https://github.com/jameslahm/lsnet
16
 
17
  ```bibtex
18
  @misc{wang2025lsnetlargefocussmall,
 
24
  primaryClass={cs.CV},
25
  url={https://arxiv.org/abs/2503.23135},
26
  }
27
+ ```
28
+
29
+ # [LSNet: See Large, Focus Small](https://arxiv.org/abs/2503.23135)
30
+
31
+
32
+ Official PyTorch implementation of **LSNet**. CVPR 2025.
33
+
34
+ <p align="center">
35
+ <img src="figures/throughput.svg" width=60%> <br>
36
+ Models are trained on ImageNet-1K and the throughput
37
+ is tested on a Nvidia RTX3090.
38
+ </p>
39
+
40
+ [LSNet: See Large, Focus Small](https://arxiv.org/abs/2503.23135).\
41
+ Ao Wang, Hui Chen, Zijia Lin, Jungong Han, and Guiguang Ding\
42
+ [![arXiv](https://img.shields.io/badge/arXiv-2503.23135-b31b1b.svg)](https://arxiv.org/abs/2503.23135) [![Hugging Face Models](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Models-blue)](https://huggingface.co/jameslahm/lsnet/tree/main) [![Hugging Face Collection](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Collection-blue)](https://huggingface.co/collections/jameslahm/lsnet-67ebec0ab4e220e7918d9565)
43
+
44
+ We introduce LSNet, a new family of lightweight vision models inspired by dynamic heteroscale capability of the human visual system, i.e., "See Large, Focus Small". LSNet achieves state-of-the-art performance and efficiency trade-offs across various vision tasks.
45
+
46
+ <details>
47
+ <summary>
48
+ <font size="+1">Abstract</font>
49
+ </summary>
50
+ Vision network designs, including Convolutional Neural Networks and Vision Transformers, have significantly advanced the field of computer vision. Yet, their complex computations pose challenges for practical deployments, particularly in real-time applications. To tackle this issue, researchers have explored various lightweight and efficient network designs. However, existing lightweight models predominantly leverage self-attention mechanisms and convolutions for token mixing. This dependence brings limitations in effectiveness and efficiency in the perception and aggregation processes of lightweight networks, hindering the balance between performance and efficiency under limited computational budgets. In this paper, we draw inspiration from the dynamic heteroscale vision ability inherent in the efficient human vision system and propose a "See Large, Focus Small" strategy for lightweight vision network design. We introduce LS (<b>L</b>arge-<b>S</b>mall) convolution, which combines large-kernel perception and small-kernel aggregation. It can efficiently capture a wide range of perceptual information and achieve precise feature aggregation for dynamic and complex visual representations, thus enabling proficient processing of visual information. Based on LS convolution, we present LSNet, a new family of lightweight models. Extensive experiments demonstrate that LSNet achieves superior performance and efficiency over existing lightweight networks in various vision tasks.
51
+ </details>
52
+
53
+ ## Classification on ImageNet-1K
54
+
55
+ ### Models
56
+ - \* denotes the results with distillation.
57
+ - The throughput is tested on a Nvidia RTX3090 using [speed.py](./speed.py).
58
+
59
+ | Model | Top-1 | Params | FLOPs | Throughput | Ckpt | Log |
60
+ |:-:|:-:|:-:|:-:|:-:|:-:|:-:|
61
+ | LSNet-T | 74.9 / 76.1* | 11.4M | 0.3G | 14708 | [T](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_t.pth) / [T*](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_t_distill.pth) | [T](logs/lsnet_t.log) / [T*](logs/lsnet_t_distill.log) |
62
+ | LSNet-S | 77.8 / 79.0* | 16.1M | 0.5G | 9023 | [S](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_s.pth) / [S*](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_s_distill.pth) | [S](logs/lsnet_s.log) / [S*](logs/lsnet_s_distill.log) |
63
+ | LSNet-B | 80.3 / 81.6* | 23.2M | 1.3G | 3996 | [B](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_b.pth) / [B*](https://huggingface.co/jameslahm/lsnet/blob/main/lsnet_b_distill.pth) | [B](logs/lsnet_b.log) / [B*](logs/lsnet_b_distill.log) |
64
+
65
+ ## ImageNet
66
+
67
+ ### Prerequisites
68
+ `conda` virtual environment is recommended.
69
+ ```bash
70
+ conda create -n lsnet python=3.8
71
+ pip install -r requirements.txt
72
+ ```
73
+
74
+ ### Data preparation
75
+
76
+ Download and extract ImageNet train and val images from http://image-net.org/. The training and validation data are expected to be in the `train` folder and `val` folder respectively:
77
+ ```
78
+ |-- /path/to/imagenet/
79
+ |-- train
80
+ |-- val
81
+ ```
82
+
83
+ ### Training
84
+ To train LSNet-T on an 8-GPU machine:
85
+ ```bash
86
+ python -m torch.distributed.launch --nproc_per_node=8 --master_port 12345 --use_env main.py --model lsnet_t --data-path ~/imagenet --dist-eval
87
+ # For training with distillation, please add `--distillation-type hard`
88
+ # For LSNet-B, please add `--weight-decay 0.05`
89
+ ```
90
+
91
+ ### Testing
92
+ ```bash
93
+ python main.py --eval --model lsnet_t --resume ./pretrain/lsnet_t.pth --data-path ~/imagenet
94
+ ```
95
+ Models can also be automatically downloaded from 🤗 like below.
96
+ ```python
97
+ import timm
98
+
99
+ model = timm.create_model(
100
+ f'hf_hub:jameslahm/lsnet_{t/t_distill/s/s_distill/b/b_distill}',
101
+ pretrained=True
102
+ )
103
+ ```
104
+
105
+ ## Downstream Tasks
106
+ [Object Detection and Instance Segmentation](detection/README.md)<br>
107
+ [Semantic Segmentation](segmentation/README.md)<br>
108
+ [Robustness Evaluation](README_robustness.md)
109
+
110
+ ## Acknowledgement
111
+
112
+ Classification (ImageNet) code base is partly built with [EfficientViT](https://github.com/microsoft/Cream/tree/main/EfficientViT), [LeViT](https://github.com/facebookresearch/LeViT), [PoolFormer](https://github.com/sail-sg/poolformer) and [EfficientFormer](https://github.com/snap-research/EfficientFormer).
113
+
114
+ The detection and segmentation pipeline is from [MMCV](https://github.com/open-mmlab/mmcv) ([MMDetection](https://github.com/open-mmlab/mmdetection) and [MMSegmentation](https://github.com/open-mmlab/mmsegmentation)).
115
+
116
+ Thanks for the great implementations!
117
+
118
+ ## Citation
119
+
120
+ If our code or models help your work, please cite our paper:
121
+ ```BibTeX
122
+ @misc{wang2025lsnetlargefocussmall,
123
+ title={LSNet: See Large, Focus Small},
124
+ author={Ao Wang and Hui Chen and Zijia Lin and Jungong Han and Guiguang Ding},
125
+ year={2025},
126
+ eprint={2503.23135},
127
+ archivePrefix={arXiv},
128
+ primaryClass={cs.CV},
129
+ url={https://arxiv.org/abs/2503.23135},
130
+ }
131
  ```