Add model card for CoTAP: Semantic Concentration for Self-Supervised Dense Representations Learning

#6
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +164 -3
README.md CHANGED
@@ -1,3 +1,164 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: image-feature-extraction
4
+ library_name: pytorch
5
+ ---
6
+
7
+ # CoTAP: Semantic Concentration for Self-Supervised Dense Representations Learning
8
+
9
+ [![paper](https://img.shields.io/badge/arXiv-Paper-b31b1b.svg?style=flat)](https://arxiv.org/abs/2509.09429)
10
+ [![GitHub](https://img.shields.io/badge/GitHub-Code-blue.svg?logo=github)](https://github.com/KID-7391/CoTAP)
11
+ [![Project Page](https://img.shields.io/badge/Project_Page-Visit-purple)](https://kid-7391.github.io/)
12
+
13
+ ## About
14
+ This is the official code for the paper "[Semantic Concentration for Self-Supervised Dense Representations Learning](https://huggingface.co/papers/2509.09429)" accepted by IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI 2025).
15
+
16
+ ## Abstract
17
+ Recent advances in image-level self-supervised learning (SSL) have made significant progress, yet learning dense representations for patches remains challenging. Mainstream methods encounter an over-dispersion phenomenon that patches from the same instance/category scatter, harming downstream performance on dense tasks. This work reveals that image-level SSL avoids over-dispersion by involving implicit semantic concentration. Specifically, the non-strict spatial alignment ensures intra-instance consistency, while shared patterns, i.e., similar parts of within-class instances in the input space, ensure inter-image consistency. Unfortunately, these approaches are infeasible for dense SSL due to their spatial sensitivity and complicated scene-centric data. These observations motivate us to explore explicit semantic concentration for dense SSL. First, to break the strict spatial alignment, we propose to distill the patch correspondences. Facing noisy and imbalanced pseudo labels, we propose a noise-tolerant ranking loss. The core idea is extending the Average Precision (AP) loss to continuous targets, such that its decision-agnostic and adaptive focusing properties prevent the student model from being misled. Second, to discriminate the shared patterns from complicated scenes, we propose the object-aware filter to map the output space to an object-based space. Specifically, patches are represented by learnable prototypes of objects via cross-attention. Last but not least, empirical studies across various tasks soundly support the effectiveness of our method.
18
+
19
+ ## Overview
20
+ ![assets/pipeline.png](./overview-v2.png)
21
+
22
+ ## Checkpoints
23
+
24
+ | Method | Backbone | Linear Seg (mIoU) | kNN Cls (Acc) | Linear Cls (Acc) | Download |
25
+ | ------ | -------- | ----------------- | ------------- | ---------------- | -------- |
26
+ | DINO+CoTAP | VIT-S/16 | 50.5 | 78.0 | 79.1 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vits16/dino%2Bcotap.ckpt) |
27
+ | Leopart+CoTAP | VIT-S/16 | 50.4 | 77.3 | 78.6 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vits16/leopart%2Bcotap.ckpt) |
28
+ | iBOT+CoTAP | VIT-S/16 | 51.6 | 78.4 | 79.4 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vits16/ibot%2Bcotap.ckpt) |
29
+ | Mugs+CoTAP | VIT-S/16 | 51.6 | 78.9 | 79.4 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vits16/mugs%2Bcotap.ckpt) |
30
+ | DINO+CoTAP | VIT-B/16 | 52.2 | 79.2 | 80.2 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vitb16/dino%2Bcotap.ckpt) |
31
+ | iBOT+CoTAP | VIT-B/16 | 53.9 | 80.1 | 80.8 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vitb16/ibot%2Bcotap.ckpt) |
32
+ | Mugs+CoTAP | VIT-B/16 | 52.1 | 80.8 | 81.7 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vitb16/mugs%2Bcotap.ckpt) |
33
+ | DINO+CoTAP | VIT-B/8 | 54.7 | 81.6 | 82.1 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/ours/vitb8/dino%2Bcotap.ckpt) |
34
+
35
+ ## Environments
36
+
37
+ * **Ubuntu** 20.04
38
+ * **CUDA** 11.6
39
+ * **Python** 3.9.13
40
+ * **Pytorch** 1.13.1
41
+
42
+ See `requirement.txt` for others.
43
+
44
+ ## Installation
45
+
46
+ 1. Clone this repository
47
+
48
+ ```bash
49
+ git clone https://github.com/KID-7391/cotap.git
50
+ ```
51
+
52
+ 2. Create a virtual environment with Python 3.9 and install the dependencies
53
+
54
+ ```bash
55
+ conda create --name CoTAP python=3.9
56
+ conda activate CoTAP
57
+ ```
58
+
59
+ 3. Install the required libraries
60
+
61
+ ```bash
62
+ pip install -r requirements.txt
63
+ ```
64
+
65
+ ## Training
66
+
67
+ ### Dataset
68
+
69
+ 1. Download [ImageNet-1k](https://www.image-net.org/download.php), [COCO](https://cocodataset.org/#home), and [COCOStuff164k](https://www.robots.ox.ac.uk/~xuji/datasets/COCOStuff164kCurated.tar.gz).
70
+ 2. Download [NNS](https://huggingface.co/KID-7391/CoTAP/blob/main/nns.zip) (indices of the nearest neighbors).
71
+ 3. Place them in `data` with the following structure:
72
+ ```
73
+ CoTAP
74
+ └── data
75
+ β”œβ”€β”€ imagenet-1k
76
+ | β”œβ”€β”€ train
77
+ | | β”œβ”€β”€ n01440764
78
+ | | β”‚ │── n01440764_18.JPEG
79
+ | | β”‚ └── ...
80
+ | └── val
81
+ | └── n01440764
82
+ | β”œβ”€β”€ ILSVRC2012_val_00000293.JPEG
83
+ | └── ...
84
+ β”œβ”€β”€ coco
85
+ | β”œβ”€β”€ images
86
+ | | β”œβ”€β”€ train2017
87
+ | | β”‚ β”œβ”€β”€ 000000000009.jpg
88
+ | | β”‚ └── ...
89
+ | | └── val2017
90
+ | | β”œβ”€β”€ 000000000139.jpg
91
+ | | └── ...
92
+ | β”œβ”€β”€ annotations
93
+ | | β”œβ”€β”€ train2017
94
+ | | β”‚ β”œβ”€β”€ 000000000009.png
95
+ | | β”‚ └── ...
96
+ | | └── val2017
97
+ | | β”œβ”€β”€ 000000000139.png
98
+ | | └── ...
99
+ | └── curated
100
+ └── nns
101
+ β”œβ”€β”€ nns_vit_base_imagenet1k_train_None_224.npz
102
+ └── ...
103
+ ```
104
+
105
+ ### Initialization Checkpoints
106
+
107
+ Download one of the following checkpoints for initialization. DINO checkpoints will be automatically downloaded.
108
+
109
+ | Method | Backbone | Linear Seg (mIoU) | kNN Cls (Acc) | Linear Cls (Acc) | Download |
110
+ | ------ | -------- | ----------------- | ------------- | ---------------- | -------- |
111
+ | DINO | VIT-S/16 | 38.8 | 74.5 | 77.0 | - |
112
+ | Leopart | VIT-S/16 | 47.2 | 55.0 | 70.0 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/leopart.ckpt) |
113
+ | iBOT | VIT-S/16 | 45.8 | 75.2 | 77.9 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/ibot.ckpt) |
114
+ | Mugs | VIT-S/16 | 47.5 | 75.6 | 78.9 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/mugs.ckpt) |
115
+ | DINO | VIT-B/16 | 44.0 | 76.1 | 78.2 | - |
116
+ | iBOT | VIT-B/16 | 49.6 | 77.1 | 79.5 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vitb16/ibot.ckpt) |
117
+ | Mugs | VIT-B/16 | 49.6 | 78.0 | 80.6 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vitb16/mugs.ckpt) |
118
+ | DINO | VIT-B/8 | 45.9 | 77.4 | 80.1 | - |
119
+
120
+ ### Scripts
121
+
122
+ See `configs` and `scripts` for default hyperparameters. Run the following command for training.
123
+
124
+ ```bash
125
+ bash scripts/run_[backbone]_[init_method].sh
126
+ ```
127
+
128
+ For examples:
129
+ ```bash
130
+ bash scripts/run_vits16_dino.sh
131
+ ```
132
+
133
+ ## Evaluation
134
+
135
+ 1. Download the test datasets and place them into `data`: [COCOStuff27](https://www.robots.ox.ac.uk/~xuji/datasets/COCOStuff164kCurated.tar.gz), [PASCAL-VOC](http://host.robots.ox.ac.uk/pascal/VOC/), [ADE20k](https://github.com/CSAILVision/ADE20K?utm_source=chatgpt.com), and [Cityscapes](https://www.cityscapes-dataset.com/?utm_source=chatgpt.com).
136
+ 2. Modify `evaluate_group` in `scripts/test_seg.sh` to choose test settings; modify `model` in `scripts/test_seg.sh` and `scripts/test_in1k_knn.sh` to setup model paths.
137
+ 3. Run the following command for kNN classification and semantic segmentation:
138
+ ```bash
139
+ bash scripts/test_in1k_knn.sh
140
+ bash scripts/test_seg.sh
141
+ ```
142
+
143
+ ## Citation
144
+ If you find this repository useful in your research, please cite our paper:
145
+ ```bibtex
146
+ @misc{wen2025semantic,
147
+ title={Semantic Concentration for Self-Supervised Dense Representations Learning},
148
+ author={Peisong Wen and Qianqian Xu and Siran Dai and Runmin Cong and Qingming Huang},
149
+ year={2025},
150
+ journal={IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)},
151
+ eprint={2509.09429},
152
+ archivePrefix={arXiv},
153
+ primaryClass={cs.CV},
154
+ url={https://arxiv.org/abs/2509.09429},
155
+ }
156
+ ```
157
+
158
+ ## Contact us
159
+
160
+ If you have any detailed questions or suggestions, you can email us: wenpeisong@ucas.ac.cn. We will reply in 1-2 business days. Thanks for your interest in our work!
161
+
162
+ ## Acknowledgements
163
+
164
+ Our code is based on the official PyTorch implementation of [DINO](https://github.com/facebookresearch/dino), [Leopart](https://github.com/MkuuWaUjinga/leopart), and [STEGO](https://github.com/mhamilton723/STEGO).