forked from zakaria/chicken-counting-sukawarna-det
Remove shared tracker between cameras, fix task warning, add export script
- Remove shared DetectionTracker across cameras to prevent state leakage - Add task="detect" to YOLO constructor to suppress warning - Add export_engine.py script for .pt to .engine conversion - Regenerate ONNX and TensorRT engine with latest settings
This commit is contained in:
1 parent
af4e514357
commit
d31ad05f0a
5 files changed
+80
-18
No files matched your search
@@ -10,7 +10,6 @@ from chicken_counter.compress import compress_video_to_target
|
||||
from chicken_counter.config import BatchSettings, build_camera_config_from_batch
|
||||
from chicken_counter.pipeline import run_pipeline
|
||||
from chicken_counter.report import build_batch_report, persist_batch_reports
|
||||
from chicken_counter.tracking import DetectionTracker
|
||||
from chicken_counter.types import CameraBatchResult
|
||||
|
||||
|
||||
@@ -29,20 +28,6 @@ def run_daily_batch(settings: BatchSettings, date: str | None = None, *, verbose
|
||||
discovery = discover_camera_videos(day_dir, settings)
|
||||
camera_order = sorted(settings.cameras.items(), key=lambda item: item[1].camera_num)
|
||||
|
||||
first_camera_id = next(
|
||||
camera_id for camera_id, _preset in camera_order if camera_id in discovery.found
|
||||
)
|
||||
first_source = discovery.found[first_camera_id]
|
||||
init_output_path = output_dir / f"{first_camera_id}_vis.mp4" if not no_video else None
|
||||
init_config = build_camera_config_from_batch(
|
||||
settings,
|
||||
first_camera_id,
|
||||
source=first_source,
|
||||
output_path=init_output_path,
|
||||
checkpoint_dir=output_dir / "checkpoints" / first_camera_id,
|
||||
)
|
||||
shared_tracker = DetectionTracker(init_config)
|
||||
|
||||
camera_results: list[CameraBatchResult] = []
|
||||
report_path = output_dir / f"counts_{run_date}.json"
|
||||
|
||||
@@ -73,7 +58,7 @@ def run_daily_batch(settings: BatchSettings, date: str | None = None, *, verbose
|
||||
checkpoint_dir=checkpoint_dir,
|
||||
)
|
||||
camera_config.performance.verbose = verbose
|
||||
pipeline_result = run_pipeline(camera_config, tracker=shared_tracker, show_progress=show_progress)
|
||||
pipeline_result = run_pipeline(camera_config, show_progress=show_progress)
|
||||
camera_results.append(
|
||||
CameraBatchResult(
|
||||
camera_id=camera_id,
|
||||
|
||||
@@ -17,7 +17,7 @@ class DetectionTracker:
|
||||
self.config = config
|
||||
model_path = Path(config.detection.model_path)
|
||||
self.model_kind = model_path.suffix.lower().lstrip(".") or "unknown"
|
||||
self.model = YOLO(config.detection.model_path)
|
||||
self.model = YOLO(config.detection.model_path, task="detect")
|
||||
self.tracker_config_path = str(Path(config.tracker.tracker_config_path))
|
||||
self.verbose = config.performance.verbose
|
||||
self._infer_count = 0
|
||||
@@ -47,7 +47,6 @@ class DetectionTracker:
|
||||
offset_x, offset_y = x1, y1
|
||||
|
||||
track_kwargs: dict = {
|
||||
"task": "detect",
|
||||
"source": source,
|
||||
"persist": self.config.tracker.persist,
|
||||
"tracker": self.tracker_config_path,
|
||||
|
||||
Reference in new issue
Block a user