File size: 3,757 Bytes
f6d7c55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
license: apache-2.0
tags:
- semantic-segmentation
- knowledge-distillation
- multimodal
- model-compression
- pytorch
---

<a id="top"></a>
<div align="center">
  <h1>πŸš€ HMKD-ICMR: Heterogeneous Model Knowledge Distillation via Dual Alignment for Semantic Segmentation</h1>

  <p>
    <b>Mingzhu Xu</b><sup>1</sup>&nbsp;
    <b>Jing Wang</b><sup>1</sup>&nbsp;
    <b>Mingcai Wang</b><sup>1</sup>&nbsp;
    <b>Yiping Li</b><sup>1</sup>&nbsp;
    <b>Yupeng Hu</b><sup>1βœ‰</sup>&nbsp;
    <b>Xuemeng Song</b><sup>1</sup>&nbsp;
    <b>Weili Guan</b><sup>1</sup>
  </p>

  <p>
    <sup>1</sup>Affiliation (Please update if needed)
  </p>
</div>

Official implementation of **HMKD**, a Heterogeneous Model Knowledge Distillation framework with Dual Alignment for Semantic Segmentation.

πŸ”— **Conference:** ICMR 2025  
πŸ”— **Task:** Semantic Segmentation  
πŸ”— **Framework:** PyTorch  

---

## πŸ“Œ Model Information

### 1. Model Name
**HMKD** (Heterogeneous Model Knowledge Distillation)

---

### 2. Task Type & Applicable Tasks
- **Task Type:** Semantic Segmentation / Model Compression  
- **Core Task:** Knowledge Distillation for segmentation  
- **Applicable Scenarios:**
  - Lightweight model deployment  
  - Cross-architecture distillation  
  - Efficient semantic understanding  

---

### 3. Project Introduction

Semantic segmentation models often rely on heavy architectures, limiting their deployment in resource-constrained environments. Knowledge distillation (KD) provides a promising solution by transferring knowledge from a large teacher model to a compact student model.

**HMKD** introduces a **Dual Alignment Distillation Framework**, which:

- Aligns heterogeneous architectures between teacher and student models  
- Performs **feature-level and prediction-level alignment**  
- Bridges the representation gap across different model families  
- Improves segmentation accuracy while maintaining efficiency  

---

### 4. Training Data Source

Supported datasets:

- **Cityscapes**
- **CamVid**

| Dataset | Train | Val | Test | Classes |
|--------|------|-----|------|--------|
| Cityscapes | 2975 | 500 | 1525 | 19 |
| CamVid | 367 | 101 | 233 | 11 |

---

## πŸš€ Environment Setup

- Ubuntu 20.04.4 LTS  
- Python 3.8.10 (Anaconda recommended)  
- CUDA 11.3  
- PyTorch 1.11.0  
- NCCL 2.10.3  

### Install dependencies:

```bash
pip install timm==0.3.2
pip install mmcv-full==1.2.7
pip install opencv-python==4.5.1.48
```

---

## βš™οΈ Pre-trained Weights

### Initialization Weights

- ResNet-18  
- ResNet-101  
- SegFormer-B0  
- SegFormer-B4  

(Download from official PyTorch and Google Drive links)

---

### Trained Weights

Download trained HMKD models:

- Baidu Cloud: https://pan.baidu.com/s/1xw_6ts5VNV73vXeOLAokwQ?pwd=jvx8  

---

## πŸš€ Training

1. Download datasets and pre-trained weights  
2. Generate dataset path lists (.txt files)  
3. Update dataset paths in the code  

### Run training:

```bash
CUDA_VISIBLE_DEVICES=0,1 nohup python -m torch.distributed.launch --nproc_per_node=2 train_NEW_AEU_kd.py > train.log 2>&1 &

CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train_NEW_AEU_kd.py
```

---

## ⚠️ Notes

- Designed for research purposes  
- Performance depends on teacher-student architecture pairing  
- Multi-GPU training is recommended  

---

## πŸ“ Citation

```bibtex
@ARTICLE{HMKD,
  author={Xu, Mingzhu and Wang, Jing and Wang, Mingcai and Li, Yiping and Hu, Yupeng and Song, Xuemeng and Guan, Weili},
  journal={ICMR}, 
  title={Heterogeneous Model Knowledge Distillation via Dual Alignment for Semantic Segmentation}, 
  year={2025}
}
```

---

## πŸ“¬ Contact

For questions or collaboration, please contact the corresponding author.

---