swin-tiny / README.md
ChanLumerico's picture
Fix usage example: import weights enum from lucid.models.weights
3382b71 verified
metadata
library_name: lucid
license: mit
tags:
  - image-classification
  - swin
  - lucid
datasets:
  - imagenet-1k
pipeline_tag: image-classification
model-index:
  - name: swin-tiny
    results:
      - task:
          type: image-classification
        dataset:
          name: ImageNet-1K
          type: imagenet-1k
        metrics:
          - type: acc@1
            value: 81.474
          - type: acc@5
            value: 95.776

Swin-Tiny

Liu et al., 2021 — Swin Transformer: Hierarchical Vision Transformer using Shifted Windows (arXiv:2103.14030)

Lucid port of torchvision/Swin_T_Weights.IMAGENET1K_V1, converted to Lucid-native safetensors.

Available weights

Tag acc@1 acc@5 Params GFLOPs Size Source
IMAGENET1K_V1 (default) 81.474 95.776 28.3M 4.491 107.93 MB torchvision

Usage

import lucid.models as models
from lucid.models.weights import SwinTinyWeights

# default tag
model = models.swin_tiny_cls(pretrained=True)

# explicit tag (enum or string)
model = models.swin_tiny_cls(weights=SwinTinyWeights.IMAGENET1K_V1)
model = models.swin_tiny_cls(pretrained="IMAGENET1K_V1")

# preprocessing travels with the weights
weights = SwinTinyWeights.IMAGENET1K_V1
preprocess = weights.transforms()
logits = model(preprocess(image)[None]).logits

Conversion

Converted from torchvision/Swin_T_Weights.IMAGENET1K_V1 via python -m tools.convert_weights swin_tiny --tag IMAGENET1K_V1. Key mapping + numerical parity verified against the source.

License

mit — inherited from the original weights.

Citation

@inproceedings{liu2021swin,
  title={Swin Transformer: Hierarchical Vision Transformer using Shifted Windows},
  author={Liu, Ze and Lin, Yutong and Cao, Yue and Hu, Han and Wei, Yixuan and Zhang, Zheng and Lin, Stephen and Guo, Baining},
  booktitle={ICCV}, year={2021}
}