Download src/schemas/segmentation.py from KalbeDigitalLab/cxr-report-generation: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/spaces/KalbeDigitalLab/cxr-report-generation/resolve/main/src/schemas/segmentation.py
- Command line
-
hf download hf://spaces/KalbeDigitalLab/cxr-report-generation/src/schemas/segmentation.py
-
curl -L -o segmentation.py https://huggingface.co/spaces/KalbeDigitalLab/cxr-report-generation/resolve/main/src/schemas/segmentation.py
760 Bytes
| from __future__ import annotations | |
| from typing import Any, Literal | |
| from pydantic import BaseModel, ConfigDict | |
| class MaskResult(BaseModel): | |
| """Segmentation output for a single finding on a single image view.""" | |
| model_config = ConfigDict(arbitrary_types_allowed=True) | |
| finding_label: str | |
| image_path: str | |
| image_index: int | |
| # [y0, x0, y1, x1] normalized to [0, 1000] – matches Stage 1 BBox.box_2d | |
| bbox_normalized: list[int] | |
| # H × W binary uint8 numpy array; None when status is "failed" | |
| mask: Any | None = None | |
| # Polygon contour as [[x, y], ...] in original image pixel coords; largest contour from mask | |
| polygon: list[list[int]] | None = None | |
| status: Literal["success", "failed"] | |
| error: str | None = None | |