--- license: apache-2.0 library_name: pytorch tags: - self-supervised - dino - vision-transformer - region-dino - rats - segmentation --- # REGION-DINO — teacher checkpoints (RATS) Self-supervised **REGION-DINO** backbones whose register tokens latch onto coherent image regions, enabling **RATS** (recursive register decomposition + grouping) for label-free, part-to-whole segmentation. 🔬 **Demo:** https://huggingface.co/spaces/TimingYang/RATS These are **teacher-only** weights, saved **every 20 epochs** plus the final epoch. ## Models | variant | arch | embed | register tokens | regs/head | epochs | per-ckpt | |---------|------|-------|-----------------|-----------|--------|----------| | **base** | `region_vit_base` | 768 | 192 | 16 | 400 (final 388) | ~436 MB | | **small** | `region_vit_small` | 384 | 96 | 16 | 300 | ~176 MB | Both use patch size 16, cross-attention, `num_reg_for_loss_per_head=16`. ## Files ``` base/ checkpoint_teacher_ep0020.pth … ep0380.pth, ep0388.pth (20 ckpts) small/ checkpoint_teacher_ep0020.pth … ep0300.pth (15 ckpts) ``` Each file is a dict `{"teacher": state_dict}` (the EMA teacher backbone + head). ## Usage ```python import torch from huggingface_hub import hf_hub_download import vision_transformer as vits # from the RATS repo / Space ckpt = hf_hub_download("TimingYang/RATS", "base/checkpoint_teacher_ep0388.pth") state = torch.load(ckpt, map_location="cpu")["teacher"] state = {k.replace("module.", "").replace("backbone.", ""): v for k, v in state.items()} model = vits.region_vit_base(patch_size=16, num_register_tokens=192, use_cross_attn=True, num_reg_for_loss_per_head=16) model.load_state_dict(state, strict=False) # head.* keys are unused for features model.eval() ``` For `small`, use `vits.region_vit_small(num_register_tokens=96, ...)`. ## License Apache-2.0. Built on [facebookresearch/dino](https://github.com/facebookresearch/dino).