psychofict commited on
Commit
f533276
·
verified ·
1 Parent(s): f549755

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +105 -0
README.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - semantic-segmentation
7
+ - semi-supervised-learning
8
+ - contrastive-learning
9
+ - dinov2
10
+ - pytorch
11
+ datasets:
12
+ - pascal-voc
13
+ ---
14
+
15
+ # PixCon: Clean-Positive Contrastive Learning for Foundation-Model Semi-Supervised Segmentation
16
+
17
+ [![arXiv](https://img.shields.io/badge/arXiv-2607.03068-b31b1b.svg)](https://arxiv.org/abs/2607.03068)
18
+
19
+ **TL;DR.** With a DINOv2 teacher, a strict confidence threshold already retains a *measured*
20
+ ~98%-clean pseudo-label set, so the accuracy that remains lives in how the embedding space is
21
+ *structured by class*, not in the filter. **PixCon** adds a single clean-positive pixel-contrastive
22
+ branch on top of a UniMatch V2 consistency backbone: a per-class memory bank that admits **only
23
+ labeled pixels the student already classifies correctly**, giving a contamination-free positive
24
+ set (ρ_F = 0) *by construction*, unlike prior contrastive SSSS banks (ReCo, U²PL) built from
25
+ confidence-filtered pseudo-labels. It adds **no inference-time parameters** and needs **no
26
+ bank-specific threshold**.
27
+
28
+ ## Method
29
+
30
+ | Component | Setting |
31
+ |---|---|
32
+ | Backbone | DINOv2-Base (ViT-B/14), fine-tuned end-to-end |
33
+ | Decoder | DPT-lite (4 ViT layers → coarse-to-fine pyramid) |
34
+ | Consistency | Two strong+CutMix views, complementary channel dropout (UniMatch V2) |
35
+ | Threshold | Fixed conf ≥ 0.95 |
36
+ | Auxiliary | **PixCon**: 1×1 projection head, per-class memory bank (256/class), clean-positive filter (labeled ∧ pred==GT), supervised InfoNCE (τ = 0.1) |
37
+ | Optimizer | AdamW, backbone LR 5e-6, decoder LR 2e-4, poly schedule |
38
+
39
+ The contribution is the **clean-positive bank**: every entry is a labeled pixel whose student
40
+ prediction already matches the ground truth. A first-order analysis of the supervised-InfoNCE
41
+ gradient shows the false-positive term scales as ρ_F/(1−ρ_F); we *measure* ρ_F (0.018 on Pascal,
42
+ 0.106 on ADE20K) rather than assume it.
43
+
44
+ ## Results (honest framing)
45
+
46
+ In a **compute-matched one-switch** comparison against a strong DINOv2 UniMatch V2 baseline across
47
+ Pascal VOC, Cityscapes, and ADE20K, PixCon **matches or improves** the baseline:
48
+
49
+ - **Pascal-1/8: improves every seed** (per-seed gain ~**+0.2 mIoU**, the correctness lever).
50
+ - Its **three-seed mean reaches 87.90 mIoU**, the published UniMatch V2-B figure. (The larger
51
+ 3-seed mean gap is driven substantially by variance reduction and is reported as suggestive,
52
+ not as a per-seed accuracy claim.)
53
+ - Because contamination is already rare under a foundation-model teacher, the **ρ_F = 0 guarantee
54
+ acts chiefly as robustness** as teachers weaken; the accuracy gain comes from *cleaner positive
55
+ supervision*.
56
+
57
+ > The released checkpoint is a **single representative seed** (88.00 mIoU, the seed closest to the
58
+ > reported mean), not a best-of-seeds pick. The headline number is the **three-seed mean 87.90**
59
+ > (per-seed: 87.60 / 88.00 / 88.10).
60
+
61
+ ## Usage
62
+
63
+ ```python
64
+ import torch
65
+ from torchvision import transforms as T
66
+ from PIL import Image
67
+
68
+ from model.segmentor import PixConSegmentor # from the PixCon code
69
+ from core.inference import whole_inference
70
+
71
+ # Build the architecture and load the released EMA-teacher weights.
72
+ model = PixConSegmentor(backbone='dinov2_vitb14', nclass=21, pretrained=False).eval()
73
+ sd = torch.load('pixcon_pascal_1_8.pth', map_location='cpu')
74
+ # strict=False: the contrastive proj_head is not in the eval path and is absent from the
75
+ # released weights; the backbone/decoder/segmentation head all load.
76
+ model.load_state_dict(sd, strict=False) # slim EMA-teacher state_dict
77
+
78
+ # ImageNet normalization (matches training).
79
+ norm = T.Compose([T.ToTensor(),
80
+ T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))])
81
+ img = norm(Image.open('example.jpg').convert('RGB')).unsqueeze(0)
82
+
83
+ with torch.no_grad():
84
+ logits = whole_inference(model, img) # [1, 21, H, W], pads to /14 internally
85
+ pred = logits.argmax(1) # [1, H, W] class indices (Pascal VOC, 21 classes)
86
+ ```
87
+
88
+ An interactive demo is available as a Hugging Face Space (see the paper page).
89
+
90
+ ## Citation
91
+
92
+ ```bibtex
93
+ @article{tarubinga2026pixcon,
94
+ title = {PixCon: Clean-Positive Contrastive Learning for Foundation-Model
95
+ Semi-Supervised Segmentation},
96
+ author = {Tarubinga, Ebenezer},
97
+ journal = {arXiv preprint arXiv:2607.03068},
98
+ year = {2026}
99
+ }
100
+ ```
101
+
102
+ ## License
103
+
104
+ Released under Apache-2.0 (confirm this is compatible with your DINOv2 / UniMatch V2 dependencies
105
+ before publishing). DINOv2 weights are loaded from `facebookresearch/dinov2` at build time.