File size: 10,619 Bytes
10511a5
efad2cc
 
 
 
 
 
 
 
 
 
 
 
 
 
10511a5
efad2cc
 
 
 
 
 
 
 
 
10511a5
efad2cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
---
license: apache-2.0
pretty_name: CardiacUDC
task_categories:
  - image-segmentation
tags:
  - medical-imaging
  - echocardiography
  - ultrasound
  - cardiac
  - four-chamber
  - 2d-echo
  - video-segmentation
size_categories:
  - 10K<n<100K
configs:
  - config_name: annotated
    default: true
    data_files:
      - split: train
        path: annotated/train-*
  - config_name: full_video
    data_files:
      - split: train
        path: full_video/train-*
---

# CardiacUDC — apical four-chamber echocardiography video segmentation

2D transthoracic echocardiography from two hospitals ("Site G" and "Site R"),
annotated for the four cardiac chambers. Introduced as **CardiacUDA** in
[GraphEcho (ICCV 2023)](https://arxiv.org/abs/2309.11145); the Kaggle release
spells it *cardiacUDC*. Converted from the official Kaggle release — see
[Provenance](#provenance).

This is a **video** dataset: 364 recordings, 38,619 frames, one row per frame.

## Configs

| Config | Rows | Contents | Mask |
|---|---|---|---|
| **`annotated`** *(default)* | **2,257** | every frame that carries ground truth | always present |
| `full_video` | **38,619** | every frame of all 364 videos | present on 2,257, `null` elsewhere |

`annotated` is exactly `full_video[has_mask == True]` — same schema, same rows.
Use `annotated` for scoring; use `full_video` for temporal propagation, ordering
by `frame_index` and grouping by `video_id`.

## Classes

| Value | Structure |
|---|---|
| 0 | background |
| 1 | LV — left ventricle |
| 2 | LA — left atrium |
| 3 | RA — right atrium |
| 4 | RV — right ventricle |

**Value 2 is the left atrium, not the right ventricle; RV is 4.** The numbering
walks the heart in a loop. This matches the authors' own loader
([`datasets/cardiac_uda.py`](https://github.com/xmed-lab/GraphEcho/blob/main/datasets/cardiac_uda.py),
view `'4'` branch). Figure 2 of the paper labels the left atrium "(RA)" and lists
a fifth structure, "epicardium of left ventricle", which does not exist in this
release.

## Composition

Seven source folders. No train/val/test directories ship.

| Folder | Videos | With GT | Site |
|---|---|---|---|
| Site_G_100 | 97 | 97 | G |
| Site_G_29 | 29 | 29 | G |
| Site_G_20 | 21 | 21 | G |
| Site_R_126 | 85 | 84 | R |
| Site_R_52 | 52 | 52 | R |
| Site_R_73 | 70 | **0** | R |
| label_all_frame | 10 | 10 | mixed |
| **Total** | **364** | **293** | |

Folder-name numbers do not match their contents (`Site_G_100` holds 97,
`Site_R_126` holds 85). Frame counts range 41–284 (mean 106). Three
resolutions ship — 800×600 (335 videos), 1024×768 (24), 640×480 (5) — not the
two the source description states.

### Two annotation regimes

- **`Site_*` folders — sparse.** 5–8 frames annotated per video (mean 5.9), out
  of ~106. This is the paper's *training* annotation budget.
- **`label_all_frame` — dense.** Every frame annotated, 548 frames over 10
  videos. The paper's val/test analogue.

`gt_dense` distinguishes them; `gt_source` records which pipeline produced each
mask.

## ⚠️ `label_all_frame` overlaps `Site_R_126` — do not split them apart

Eight of the ten `label_all_frame` videos are **the same recordings** as videos
in `Site_R_126`: same subject id, identical frame count, ~88% bit-identical
pixels (mean absolute difference ≈4.5/255, correlation 0.70–0.94). They are a
dense re-annotation of footage that also ships sparsely annotated, not new
material. The remaining two have no `Site_*` counterpart.

Putting `label_all_frame` in a test split and `Site_*` in train therefore leaks
8 of 10 test videos into training. **`group_id` ties each twin pair together** —
split on `group_id`, never on `video_id` or `subject`.

## Splits

**A single `train` split ships.** The paper's 8:1:1 division is not distributed,
and the near-duplication above makes any naive split leak. Downstream consumers
should construct their own split, grouping on `group_id`.

## Subject ids are not unique

85 subject names occur in more than one folder, and those collisions are
**different recordings** (0 of 85 are byte-identical). `video_id` is
`{folder}/{subject}` and is the only safe key. Grouping on bare `subject` will
silently merge unrelated patients.

## What this release changes from source

Every modification below is deliberate and reversible from the original Kaggle
archive; nothing else is altered.

1. **Contour masks filled.** `label_all_frame` ships hollow ~1px contour
   *outlines*, whereas `Site_*` ships filled regions. Scoring a raw outline
   measures the rim, not the chamber. Outlines are filled per class with
   `scipy.ndimage.binary_fill_holes` (with a 1–3 iteration `binary_closing`
   fallback for open contours). Validated: post-fill area/bbox ratio is
   **0.689**, against **0.68** for the natively-filled `Site_*` masks. Two class
   instances out of ~2,150 could not be closed and were dropped rather than
   shipped as rings. `mask_filled_from_contour` flags affected rows.

   The authors' `contour_to_mask` was **not** used: it selects classes by rank
   within `set(unique_values)`, so on a volume with a missing class it silently
   renumbers the remaining ones.

2. **Stray label values remapped.** Two `label_all_frame` volumes encode two of
   the chambers as 5 and 6 instead of 1 and 4. Verified spatially against the
   eight consistent volumes — the stray values sit at the class centroids of 1
   and 4 (normalised distance 0.013–0.078, every value matching exactly one
   class) — and remapped `{5→1, 6→4}`. `label_remapped` flags affected rows.

3. **One truncated source file salvaged.** One `Site_R_126` label volume is a
   truncated gzip **in the source archive** — the enclosing zip's CRC verifies,
   so this is not a transfer defect. Its 42 intact frames (7 annotated) are
   kept; the remaining 21 frames carry no ground truth. `video_truncated` flags
   the video.

4. **Orientation normalised.** Source arrays are `(W, H, T)`; each frame is
   transposed and rotated 180° into the orientation in which the scanner's
   on-screen text reads correctly. Applied identically to images and masks.

5. **De-identification band.** The top `max(45, ceil(0.075 × H))` rows of every
   frame of every video are zeroed — 45 rows at 480px and 600px, 58 at 768px.
   Some source videos retained scanner header text containing patient
   identifiers; the band is applied **uniformly to all 364 videos** rather than
   selectively, so the redaction does not itself indicate which files were
   affected. **This is a MedOtter modification — upstream is unmodified in this
   respect.**

   The band costs no annotation. Over all 294 label volumes / 2,257 annotated
   frames at native resolution, the topmost mask row is 81 (480px), 83 (600px)
   and 144 (768px), against a maximum blank of 58. The build re-checks this per
   frame and refuses to write a row whose mask intersects the band.
   `deid_blanked_rows` records the band height applied to each row.

## Known limitations of the source release

- **Only the A4C view ships.** The paper describes 992 videos across four views
  (LVLA, PALA, LVSA, A4C); the public release is view 4 only, 364 videos. The
  other three views and the pulmonary-artery class were announced for late 2024
  and have not appeared — Kaggle remains at version 1 (2023-10-30).
- **70 videos in `Site_R_73` have no labels at all**, and one `Site_R_126` label
  volume is present but entirely empty. Both are shipped in `full_video` as
  image-only rows and excluded from `annotated`.
- Third-party catalogues describing this dataset as "5 structures (LV, RV, MYO,
  LA, RA)" or "29,283 slices" do not match the public release.

## Schema

| Column | Type | Notes |
|---|---|---|
| `image` | Image | PNG, grayscale, de-identification band applied |
| `mask` | Image | PNG, values 0–4; `null` where no GT |
| `video_id` | string | `{folder}/{subject}` — the only unique key |
| `folder`, `site`, `subject` | string | `site` is `G`, `R`, or `unknown` |
| `view` | string | `A4C` throughout |
| `frame_index`, `n_frames` | int32 | order within the recording |
| `height`, `width` | int32 | native resolution |
| `has_mask`, `gt_dense` | bool | GT presence / dense-annotation regime |
| `gt_source` | string | `site_sparse`, `label_all_frame_filled`, `none` |
| `mask_filled_from_contour` | bool | mask was reconstructed from an outline |
| `label_remapped` | bool | `{5→1, 6→4}` applied |
| `video_truncated` | bool | source label volume was truncated |
| `group_id` | string | **split on this** — ties near-duplicate videos |
| `deid_blanked_rows` | int32 | height of the zeroed header band |
| `split` | string | `train` (single split) |

## Provenance

Retrieved from Kaggle `xiaoweixumedicalai/cardiacudc-dataset` (version 1,
2023-10-30), 7-part split zip, 4,515,920,293 bytes, extracting to 658 NIfTI
files / 4,547,904,911 bytes. Archive CRC verified before conversion.

## Licence and attribution

Released under the **Apache License, Version 2.0**, as declared by the dataset
authors on the source Kaggle record. (The GraphEcho *code* repository is
MIT-licensed — a separate grant covering the code, not this data.)

```
This dataset is a re-hosted and reprocessed copy of "cardiacUDC_dataset"
(a.k.a. CardiacUDA), created by Xiaowei Xu et al., originally released at
https://www.kaggle.com/datasets/xiaoweixumedicalai/cardiacudc-dataset

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, the dataset is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.

Modifications by MedOtter, per Apache-2.0 section 4(b): conversion from NIfTI to
per-frame PNG in parquet; contour masks polygon-filled; two volumes' stray label
values remapped; one truncated source volume partially salvaged; frame
orientation normalised; a fixed-height header band zeroed on every frame.
See "What this release changes from source" above.
```

Please cite:

```bibtex
@inproceedings{yang2023graphecho,
  title     = {GraphEcho: Graph-Driven Unsupervised Domain Adaptation for
               Echocardiogram Video Segmentation},
  author    = {Yang, Jiewen and Ding, Xinpeng and Zheng, Ziyang and
               Xu, Xiaowei and Li, Xiaomeng},
  booktitle = {Proceedings of the IEEE/CVF International Conference on
               Computer Vision (ICCV)},
  pages     = {11878--11887},
  year      = {2023}
}
```