| 285 | |
| 286 | |
| 287 | def _to_assemblies( |
| 288 | data: dict[str, np.ndarray], |
| 289 | ground_truth: bool, |
| 290 | ) -> dict[str, list[inferenceutils.Assembly]]: |
| 291 | images = list(data.keys()) |
| 292 | raw_data = np.stack([data[i] for i in images], axis=0) |
| 293 | |
| 294 | # mask not visible entries |
| 295 | mask = raw_data[..., 2] <= 0 |
| 296 | raw_data[mask] = np.nan |
| 297 | |
| 298 | # set the "score" to 1 for ground truth |
| 299 | if ground_truth: |
| 300 | raw_data[~mask, 2] = 1 |
| 301 | |
| 302 | return {images[i]: assembly for i, assembly in inferenceutils._parse_ground_truth_data(raw_data).items()} |
| 303 | |
| 304 | |
| 305 | def _to_coco_ground_truth( |