Add comprehensive model card for CoTAP

#3
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +167 -3
README.md CHANGED
@@ -1,3 +1,167 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: image-feature-extraction
4
+ library_name: pytorch
5
+ ---
6
+
7
+ # Semantic Concentration for Self-Supervised Dense Representations Learning (CoTAP)
8
+
9
+ This is the official model repository 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).
10
+
11
+ [πŸ“– Paper](https://huggingface.co/papers/2509.09429) [🏠 Project Page](https://kid-7391.github.io/) [πŸ’» Code](https://github.com/KID-7391/CoTAP)
12
+
13
+ **Semantic Concentration for Self-Supervised Dense Representations Learning**
14
+
15
+ **Authors: [Peisong Wen](https://kid-7391.github.io/), [Qianqian Xu*](https://qianqianxu010.github.io/), [Siran Dai](https://scholar.google.com.hk/citations?user=_6gw9FQAAAAJ&hl=zh-CN&oi=ao), [Runmin Cong](https://rmcong.github.io/), [Qingming Huang*](https://people.ucas.ac.cn/~qmhuang)**
16
+
17
+ ![assets/pipeline.png](./overview-v2.png)
18
+
19
+ ## Abstract
20
+
21
+ 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.
22
+
23
+ ## 🚩 Checkpoints
24
+
25
+ | Method | Backbone | Linear Seg (mIoU) | kNN Cls (Acc) | Linear Cls (Acc) | Download |
26
+ | ------ | -------- | ----------------- | ------------- | ---------------- | -------- |
27
+ | 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) |
28
+ | 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) |
29
+ | 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) |
30
+ | 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) |
31
+ | 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) |
32
+ | 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) |
33
+ | 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) |
34
+ | 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) |
35
+
36
+ ## πŸ’» Environments
37
+
38
+ * **Ubuntu** 20.04
39
+ * **CUDA** 11.6
40
+ * **Python** 3.9.13
41
+ * **Pytorch** 1.13.1
42
+
43
+ See `requirement.txt` for others.
44
+
45
+ ## πŸ”§ Installation
46
+
47
+ 1. Clone this repository
48
+
49
+ ```bash
50
+ git clone https://github.com/KID-7391/cotap.git
51
+ ```
52
+
53
+ 2. Create a virtual environment with Python 3.9 and install the dependencies
54
+
55
+ ```bash
56
+ conda create --name CoTAP python=3.9
57
+ conda activate CoTAP
58
+ ```
59
+
60
+ 3. Install the required libraries
61
+
62
+ ```bash
63
+ pip install -r requirements.txt
64
+ ```
65
+
66
+ ## πŸš€ Training
67
+
68
+ ### Dataset
69
+
70
+ 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).
71
+ 2. Download [NNS](https://huggingface.co/KID-7391/CoTAP/blob/main/nns.zip) (indices of the nearest neighbors).
72
+ 3. Place them in `data` with the following structure:
73
+ ```
74
+ CoTAP
75
+ └── data
76
+ β”œβ”€β”€ imagenet-1k
77
+ | β”œβ”€οΏ½οΏ½ train
78
+ | | β”œβ”€β”€ n01440764
79
+ | | β”‚ β”œβ”€β”€ n01440764_18.JPEG
80
+ | | β”‚ └── ...
81
+ | └── val
82
+ | └── n01440764
83
+ | β”œβ”€β”€ ILSVRC2012_val_00000293.JPEG
84
+ | └── ...
85
+ β”œβ”€β”€ coco
86
+ | β”œβ”€β”€ images
87
+ | | β”œβ”€β”€ train2017
88
+ | | β”‚ β”œβ”€β”€ 000000000009.jpg
89
+ | | β”‚ └── ...
90
+ | | └── val2017
91
+ | | β”œβ”€β”€ 000000000139.jpg
92
+ | | └── ...
93
+ | β”œβ”€β”€ annotations
94
+ | | β”œβ”€β”€ train2017
95
+ | | β”‚ β”œβ”€β”€ 000000000009.png
96
+ | | β”‚ └── ...
97
+ | | └── val2017
98
+ | | β”œβ”€β”€ 000000000139.png
99
+ | | └── ...
100
+ | └── curated
101
+ └── nns
102
+ β”œβ”€β”€ nns_vit_base_imagenet1k_train_None_224.npz
103
+ └── ...
104
+ ```
105
+
106
+ ### Initialization Checkpoints
107
+
108
+ Download one of the following checkpoints for initialization. DINO checkpoints will be automatically downloaded.
109
+
110
+ | Method | Backbone | Linear Seg (mIoU) | kNN Cls (Acc) | Linear Cls (Acc) | Download |
111
+ | ------ | -------- | ----------------- | ------------- | ---------------- | -------- |
112
+ | DINO | VIT-S/16 | 38.8 | 74.5 | 77.0 | - |
113
+ | Leopart | VIT-S/16 | 47.2 | 55.0 | 70.0 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/leopart.ckpt) |
114
+ | iBOT | VIT-S/16 | 45.8 | 75.2 | 77.9 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/ibot.ckpt) |
115
+ | Mugs | VIT-S/16 | 47.5 | 75.6 | 78.9 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vits16/mugs.ckpt) |
116
+ | DINO | VIT-B/16 | 44.0 | 76.1 | 78.2 | - |
117
+ | iBOT | VIT-B/16 | 49.6 | 77.1 | 79.5 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vitb16/ibot.ckpt) |
118
+ | Mugs | VIT-B/16 | 49.6 | 78.0 | 80.6 | [link](https://huggingface.co/KID-7391/CoTAP/blob/main/checkpoints/competitor/vitb16/mugs.ckpt) |
119
+ | DINO | VIT-B/8 | 45.9 | 77.4 | 80.1 | - |
120
+
121
+ ### Scripts
122
+
123
+ See `configs` and `scripts` for default hyperparameters. Run the following command for training.
124
+
125
+ ```bash
126
+ bash scripts/run_[backbone]_[init_method].sh
127
+ ```
128
+
129
+ For examples:
130
+ ```bash
131
+ bash scripts/run_vits16_dino.sh
132
+ ```
133
+
134
+ ## πŸ“Š Evaluation
135
+
136
+ 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), and [Cityscapes](https://www.cityscapes-dataset.com/).
137
+ 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.
138
+ 3. Run the following command for kNN classification and semantic segmentation:
139
+ ```bash
140
+ bash scripts/test_in1k_knn.sh
141
+ bash scripts/test_seg.sh
142
+ ```
143
+
144
+ ## πŸ“§ Contact us
145
+
146
+ 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!
147
+
148
+ ## 🌟 Acknowledgements
149
+
150
+ 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).
151
+
152
+ ## πŸ“ Citation
153
+
154
+ If you find this repository useful in your research, please cite the following paper:
155
+
156
+ ```bibtex
157
+ @article{wen2025semantic,
158
+ title={Semantic Concentration for Self-Supervised Dense Representations Learning},
159
+ author={Wen, Peisong and Xu, Qianqian and Dai, Siran and Cong, Runmin and Huang, Qingming},
160
+ journal={IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)},
161
+ year={2025},
162
+ eprint={2509.09429},
163
+ archivePrefix={arXiv},
164
+ primaryClass={cs.CV},
165
+ url={https://arxiv.org/abs/2509.09429},
166
+ }
167
+ ```