Update README.md
Browse files
README.md
CHANGED
@@ -4,7 +4,6 @@ license: mit
|
|
4 |
tags:
|
5 |
- image-classification
|
6 |
- timm
|
7 |
-
library_tag: timm
|
8 |
pipeline_tag: image-classification
|
9 |
---
|
10 |
|
@@ -14,6 +13,45 @@ Paper: https://arxiv.org/abs/2503.23135
|
|
14 |
|
15 |
Code: https://github.com/jameslahm/lsnet
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
```bibtex
|
18 |
@misc{wang2025lsnetlargefocussmall,
|
19 |
title={LSNet: See Large, Focus Small},
|
@@ -32,7 +70,7 @@ Code: https://github.com/jameslahm/lsnet
|
|
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>
|
@@ -103,9 +141,9 @@ model = timm.create_model(
|
|
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 |
|
@@ -113,19 +151,4 @@ Classification (ImageNet) code base is partly built with [EfficientViT](https://
|
|
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 |
-
```
|
|
|
4 |
tags:
|
5 |
- image-classification
|
6 |
- timm
|
|
|
7 |
pipeline_tag: image-classification
|
8 |
---
|
9 |
|
|
|
13 |
|
14 |
Code: https://github.com/jameslahm/lsnet
|
15 |
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
```python
|
19 |
+
import timm
|
20 |
+
import torch
|
21 |
+
from PIL import Image
|
22 |
+
import requests
|
23 |
+
from timm.data import resolve_data_config, create_transform
|
24 |
+
|
25 |
+
# Load the model
|
26 |
+
model = timm.create_model(
|
27 |
+
'hf_hub:jameslahm/lsnet_b',
|
28 |
+
pretrained=True
|
29 |
+
)
|
30 |
+
model.eval()
|
31 |
+
|
32 |
+
# Load and transform image
|
33 |
+
# Example using a URL:
|
34 |
+
url = 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
|
35 |
+
img = Image.open(requests.get(url, stream=True).raw)
|
36 |
+
|
37 |
+
config = resolve_data_config({}, model=model)
|
38 |
+
transform = create_transform(**config)
|
39 |
+
input_tensor = transform(img).unsqueeze(0) # transform and add batch dimension
|
40 |
+
|
41 |
+
# Make prediction
|
42 |
+
with torch.no_grad():
|
43 |
+
output = model(input_tensor)
|
44 |
+
probabilities = torch.nn.functional.softmax(output[0], dim=0)
|
45 |
+
|
46 |
+
# Get top 5 predictions
|
47 |
+
top5_prob, top5_catid = torch.topk(probabilities, 5)
|
48 |
+
# Assuming you have imagenet labels list 'imagenet_labels'
|
49 |
+
# for i in range(top5_prob.size(0)):
|
50 |
+
# print(imagenet_labels[top5_catid[i]], top5_prob[i].item())
|
51 |
+
```
|
52 |
+
|
53 |
+
## Citation
|
54 |
+
If our code or models help your work, please cite our paper:
|
55 |
```bibtex
|
56 |
@misc{wang2025lsnetlargefocussmall,
|
57 |
title={LSNet: See Large, Focus Small},
|
|
|
70 |
Official PyTorch implementation of **LSNet**. CVPR 2025.
|
71 |
|
72 |
<p align="center">
|
73 |
+
<img src="https://raw.githubusercontent.com/THU-MIG/lsnet/refs/heads/master/figures/throughput.svg" width=60%> <br>
|
74 |
Models are trained on ImageNet-1K and the throughput
|
75 |
is tested on a Nvidia RTX3090.
|
76 |
</p>
|
|
|
141 |
```
|
142 |
|
143 |
## Downstream Tasks
|
144 |
+
[Object Detection and Instance Segmentation](https://github.com/THU-MIG/lsnet/blob/master/detection/README.md)<br>
|
145 |
+
[Semantic Segmentation](https://github.com/THU-MIG/lsnet/blob/master/segmentation/README.md)<br>
|
146 |
+
[Robustness Evaluation](https://github.com/THU-MIG/lsnet/blob/master/README_robustness.md)
|
147 |
|
148 |
## Acknowledgement
|
149 |
|
|
|
151 |
|
152 |
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)).
|
153 |
|
154 |
+
Thanks for the great implementations!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|