Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- ILSVRC/imagenet-1k
|
| 4 |
+
metrics:
|
| 5 |
+
- accuracy
|
| 6 |
+
---
|
| 7 |
+
CSATv2
|
| 8 |
+
|
| 9 |
+
CSATv2 is a lightweight high-resolution vision backbone designed to maximize throughput at 512×512 resolution. By applying frequency-domain projection at the input stage, the model suppresses redundant spatial information and achieves extremely fast inference with only 11M parameters.
|
| 10 |
+
|
| 11 |
+
Model description
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
This model is designed primarily for image classification tasks and can also serve as a high-throughput backbone for object detection.
|
| 16 |
+
```python
|
| 17 |
+
import torch
|
| 18 |
+
from datasets import load_dataset
|
| 19 |
+
from transformers import AutoImageProcessor, AutoModelForImageClassification
|
| 20 |
+
|
| 21 |
+
# 예시 데이터: 고양이 이미지
|
| 22 |
+
dataset = load_dataset("huggingface/cats-image")
|
| 23 |
+
image = dataset["test"]["image"][0]
|
| 24 |
+
|
| 25 |
+
# 👉 CSATv2 모델로 교체
|
| 26 |
+
model_name = "Hyunil/CSATv2"
|
| 27 |
+
|
| 28 |
+
# Preprocessor + Model 로드
|
| 29 |
+
processor = AutoImageProcessor.from_pretrained(model_name, trust_remote_code=True)
|
| 30 |
+
model = AutoModelForImageClassification.from_pretrained(model_name, trust_remote_code=True)
|
| 31 |
+
|
| 32 |
+
# 전처리
|
| 33 |
+
inputs = processor(image, return_tensors="pt")
|
| 34 |
+
|
| 35 |
+
# 추론
|
| 36 |
+
with torch.no_grad():
|
| 37 |
+
logits = model(**inputs).logits
|
| 38 |
+
|
| 39 |
+
pred = logits.argmax(-1).item()
|
| 40 |
+
print("Predicted label:", model.config.id2label[pred])
|
| 41 |
+
```
|