Add comprehensive model card for CoTAP with pipeline tag, paper, and code links

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