feat: add zone_mode and fixed_zone fields to Job
This commit is contained in:
1 parent
ad3e7a7e9e
commit
7c91081ea8
1 file changed
+12
+12
@@ -13,6 +13,7 @@ from pathlib import Path
|
||||
|
||||
from src.model_registry import ModelConfig, find_truck_detector
|
||||
from src.pipeline import run_pipeline, run_merged_pipeline, PipelineResult, MergedPipelineResult
|
||||
from src.truck_roi import TruckROI
|
||||
|
||||
|
||||
class JobStatus(Enum):
|
||||
@@ -61,6 +62,9 @@ class Job:
|
||||
live_unloading: int = 0
|
||||
live_frame: int = 0
|
||||
preview_enabled: bool = True
|
||||
zone_mode: str = "dynamic"
|
||||
fixed_zone: TruckROI | None = None
|
||||
zone_preset: str = ""
|
||||
|
||||
|
||||
class JobQueue:
|
||||
@@ -78,6 +82,9 @@ class JobQueue:
|
||||
video_path: str,
|
||||
model_configs: list[ModelConfig],
|
||||
class_filters: dict[str, list[str] | None] | None = None,
|
||||
zone_mode: str = "dynamic",
|
||||
fixed_zone: TruckROI | None = None,
|
||||
zone_preset: str = "",
|
||||
) -> Job:
|
||||
"""Create a new job and enqueue it. Returns the Job (processing starts immediately)."""
|
||||
job_id = f"job-{uuid.uuid4().hex[:8]}"
|
||||
@@ -87,6 +94,9 @@ class JobQueue:
|
||||
model_configs=list(model_configs),
|
||||
class_filters=class_filters or {},
|
||||
output_dir=str(self._output_dir / job_id),
|
||||
zone_mode=zone_mode,
|
||||
fixed_zone=fixed_zone,
|
||||
zone_preset=zone_preset,
|
||||
)
|
||||
Path(job.output_dir).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -195,6 +205,7 @@ class JobQueue:
|
||||
output_path=output_path,
|
||||
class_filter=class_filter,
|
||||
truck_model_config=truck_model_config,
|
||||
fixed_zone=job.fixed_zone,
|
||||
preview_path=job.preview_path,
|
||||
preview_enabled=job.preview_enabled,
|
||||
preview_every_n=2,
|
||||
@@ -238,6 +249,7 @@ class JobQueue:
|
||||
output_path=output_path,
|
||||
class_filters=job.class_filters,
|
||||
truck_model_config=truck_model_config,
|
||||
fixed_zone=job.fixed_zone,
|
||||
preview_path=job.preview_path,
|
||||
preview_enabled=job.preview_enabled,
|
||||
preview_every_n=2,
|
||||
|
||||
Reference in new issue
Block a user