File size: 5,049 Bytes
0c7d9c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# MediaEval Medico 2026 - CATA Multitask Final

## Team Info

- **Team name:** Sweet&Sour
- **Member:** Nguyα»…n Minh Quang
- **Email:** nmquang04072005@gmail.com
- **Country:** Vietnam

## Overview

This Hugging Face repository is the combined final submission package for:

- **Subtask 1:** GI visual question answering.
- **Subtask 2:** clinician-oriented multimodal explanations.

Both tasks use the same CATA model family:

```text
CATA-Final
Qwen2.5-3B-Instruct + LoRA r16/alpha32
+ pretrained frozen ViT/timm image encoder
+ prior-guided OT prefix fusion
+ lesion prior mask
+ global morphology/topology features
+ patch-level TDA features
+ TopoAdapter in the last 8 Qwen decoder layers
+ topo_mode=all
+ vision_pretrained=True
```

## Checkpoints

The repository expects the active checkpoint at:

```text
checkpoints/last.pt
```

Recommended naming in the report:

| Name | Use | Notes |
|---|---|---|
| **CATA-Clean** | clean reportable model | trained only on official training data |
| **CATA-Final** | final leaderboard model | initialized from CATA-Clean and fine-tuned for one additional epoch on the released test split under the organizers' permitted setting |

Current known scores on the official-template 1,500-sample public evaluation:

| Checkpoint | Test fine-tune | BLEU | ROUGE-1 | ROUGE-2 | ROUGE-L | METEOR |
|---|---:|---:|---:|---:|---:|---:|
| CATA-Clean | No | 0.4537 | 0.6975 | 0.5105 | 0.6711 | 0.6748 |
| CATA-Final | Yes | **0.4728** | **0.7185** | **0.5340** | **0.6913** | **0.6895** |

> **Note:** If `checkpoints/last.pt` is the test-set fine-tuned checkpoint, report
> it as CATA-Final and do not describe it as held-out validation performance.

## File Layout

```text
cata_multitask_final/
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ submission_task1.py              # Task 1 inference/validation script
β”œβ”€β”€ submission_task2.py              # Task 2 metadata
β”œβ”€β”€ generate_task2_cata_final.py     # Generates fresh Task 2 JSONL + visuals
β”œβ”€β”€ validate_task2_submission.py     # Validates Task 2 JSONL/schema/paths
β”œβ”€β”€ submission_task2.jsonl           # Final Task 2 output after generation
β”œβ”€β”€ visuals/                         # Task 2 heatmaps and evidence JSON
β”œβ”€β”€ checkpoints/
β”‚   └── last.pt
└── src/                             # Model/topology/alignment source code
```

## Task 1 Usage

From this folder:

```bash
python submission_task1.py
```

This writes:

```text
predictions_1.json
```

The Task 1 script loads:

```text
checkpoints/last.pt
```

and should print diagnostics similar to:

```text
Runtime config: topo_mode=all topo_dim=47 vision_pretrained=True use_patch_topo_loss=True
Installed 8 TopoAdapters / 36 decoder layers | hidden=2048 topo_dim=47
Loaded checkpoint successfully. Status: OK
```

## Task 2 Generation

Task 2 must use the organizer-defined validation subset:

```python
ds = load_dataset("SimulaMet/Kvasir-VQA-x1")["test"]
val_set_task2 = (
    ds.filter(lambda x: x["complexity"] == 1)
      .shuffle(seed=42)
      .select(range(1500))
      .add_column("val_id", list(range(1500)))
      .remove_columns(["complexity", "answer", "original", "question_class"])
      .cast_column("image", HfImage())
)
```

Generate a small smoke run first:

```bash
python generate_task2_cata_final.py \
  --output-jsonl debug_task2.jsonl \
  --visual-dir visuals_debug \
  --limit 2 \
  --batch-size 1
```

Generate the full Task 2 submission:

```bash
python generate_task2_cata_final.py \
  --output-jsonl submission_task2.jsonl \
  --visual-dir visuals \
  --batch-size 4 \
  --overwrite-visuals true
```

If VRAM is limited, use:

```bash
--batch-size 1
```

The generator recreates:

- CATA-Final primary answers,
- CATA-Final targeted self-probe answers,
- heatmap PNGs,
- evidence JSON files,
- clinician-oriented textual explanations,
- reliability-style confidence scores.

## Task 2 Validation

Validate the generated file:

```bash
python validate_task2_submission.py --submission submission_task2.jsonl
```

For a local-only structural/path check without loading the HF dataset:

```bash
python validate_task2_submission.py --submission submission_task2.jsonl --skip-dataset-check
```

If `predictions_1.json` is available and covers the same `img_id`/`question`
items, answer consistency can also be checked:

```bash
python validate_task2_submission.py \
  --submission submission_task2.jsonl \
  --task1-predictions predictions_1.json
```

## Task 2 Output Format

Each JSONL row contains:

```json
{
  "val_id": "0",
  "img_id": "...",
  "question": "...",
  "answer": "CATA-Final prediction",
  "textual_explanation": "Clinician-oriented explanation",
  "visual_explanation": [{
    "type": "heatmap",
    "data": "visuals/0000_heatmap.png",
    "description": "Fresh CATA-Final heatmap..."
  }],
  "confidence_score": 0.67
}
```

The confidence score is a reliability estimate, not a calibrated clinical
probability. Explanations are intended to support clinician review, not replace
clinical judgment.