detrium.utils.plotting
Visualization utilities and Annotator for all 6 Detrium vision tasks.
class Colors
Deterministic class-ID to RGB color lookup.
__call__(self, class_id: int, *, bgr: bool=False) -> Tuple[int, int, int]
| 名称 | 类型 | 默认值 |
|---|
class_id | int | — |
bgr | bool | False |
class Annotator
Clean image annotator supporting RGB numpy arrays (uses OpenCV when available, PIL fallback).
| 名称 | 类型 | 默认值 |
|---|
image_rgb | np.ndarray | — |
line_width | Optional[int] | None |
box_label(self, box: Sequence[float], label: str='', color: Tuple[int, int, int]=(255, 56, 56), txt_color: Tuple[int, int, int]=(255, 255, 255)) -> None
| 名称 | 类型 | 默认值 |
|---|
box | Sequence[float] | — |
label | str | '' |
color | Tuple[int, int, int] | (255, 56, 56) |
txt_color | Tuple[int, int, int] | (255, 255, 255) |
mask_overlay(self, mask: np.ndarray, color: Tuple[int, int, int], alpha: float=0.45) -> None
| 名称 | 类型 | 默认值 |
|---|
mask | np.ndarray | — |
color | Tuple[int, int, int] | — |
alpha | float | 0.45 |
semseg_overlay(self, class_map: np.ndarray, alpha: float=0.5) -> None
| 名称 | 类型 | 默认值 |
|---|
class_map | np.ndarray | — |
alpha | float | 0.5 |
keypoints(self, kpts_xy: np.ndarray, kpts_conf: Optional[np.ndarray]=None, conf_thr: float=0.25) -> None
| 名称 | 类型 | 默认值 |
|---|
kpts_xy | np.ndarray | — |
kpts_conf | Optional[np.ndarray] | None |
conf_thr | float | 0.25 |
obb_label(self, corners: np.ndarray, label: str='', color: Tuple[int, int, int]=(255, 56, 56)) -> None
| 名称 | 类型 | 默认值 |
|---|
corners | np.ndarray | — |
label | str | '' |
color | Tuple[int, int, int] | (255, 56, 56) |
classify_label(self, text: str) -> None
result(self) -> np.ndarray
plot_training_curves(csv_path: Path, out_path: Optional[Path]=None) -> Optional[Path]
Generate a summary `results.png` chart from `results.csv` if matplotlib is installed.
| 名称 | 类型 | 默认值 |
|---|
csv_path | Path | — |
out_path | Optional[Path] | None |