Skip to content

[Feature]: Implement smart automatic fallback routing layer in Detector #159

Description

@Deepthit-23

Problem Statement

The smart automatic fallback routing layer described in docs/tensorrt_conversion.md is currently missing from the Detector class. This causes all unit tests in tests/test_tensorrt_routing.py to fail with AttributeError (as self.model_path is not set on the Detector object), and prevents the system from automatically utilizing optimized .engine formats or falling back gracefully to .pt formats when CUDA is unavailable or when running on CPU.

Proposed Solution

Add fallback routing logic, file path existence checks, and exception handling inside Detector.__init__ in services/detection/detection.py. When initializing, the detector should check if an engine model exists and can be loaded. If not, it should log a warning and fall back to the baseline .pt model, setting self.model_path correctly.

Affected Component

Detection (YOLOv8/v9 — services/detection/)

Estimated Difficulty

🟡 Intermediate — Requires understanding of one service

Alternatives Considered

No response

Additional Context

No response

Contribution

  • I would like to implement this feature and submit a PR.

Checklist

  • I have searched existing issues and this is not a duplicate.
  • I have read the CONTRIBUTING.md guidelines.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions