fix: ignore empty string when parsing

This commit is contained in:
Dowon
2024-03-01 11:34:54 +09:00
parent aa9e4553e9
commit 55557c7959

View File

@@ -47,8 +47,9 @@ def ultralytics_predict(
def apply_classes(model: YOLO | YOLOWorld, model_path: str | Path, classes: str):
if not classes or "-world" not in Path(model_path).stem:
return
parsed = [c.strip() for c in classes.split(",")]
model.set_classes(parsed)
parsed = [c.strip() for c in classes.split(",") if c.strip()]
if parsed:
model.set_classes(parsed)
def mask_to_pil(masks: torch.Tensor, shape: tuple[int, int]) -> list[Image.Image]: