Feature Request: Configurable high-resolution and tiled inference for AI Port object detection

Open
#154 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
machine-learning, python

Research direction

Start by reviewing the existing AI Port detection and inference path, then examine the higher-resolution frame pipeline from PR #144 for a starting point. Identify where YOLOX inputs, tiled-region coordinates, deduplication, and tracker handoff would need to be integrated; run the existing detection and tracking tests. Done means configurable profiles work while Standard remains the default, tiled detections map back to original frames, and compatibility tests cover tracking, zones, and Protect events.

Written by the indexing model from the issue text.

Description

Background

Keystone's current AI Port object detection implementation uses fixed 640×640 YOLOX model inputs (416×416 for YOLOX-Tiny). While this provides excellent computational efficiency, it potentially sacrifices significant detection accuracy when processing high-resolution cameras, particularly for small or distant objects.

This limitation is especially pronounced with ultrawide and multisensor panoramic cameras. For example, a 4096×1536 panoramic stream becomes an effective 640×240 image within the detector's input tensor.

Increasing aiport.analyze_max_width does not resolve this limitation because the detector subsequently resizes the image to the model's fixed input dimensions.

Proposed Enhancement

Introduce configurable object detection quality profiles, ideally on a per-camera basis:

  • Standard: Retain the current full-frame inference implementation as the default.
  • High Resolution: Support larger model input dimensions where compatible ONNX models are available.
  • Tiled Inference: Divide higher-resolution frames into overlapping regions, perform inference on each region, translate bounding boxes back into the original image coordinates, and deduplicate overlapping detections before passing them to the tracker.

Tiled inference could potentially follow an approach similar to SAHI (Slicing Aided Hyper Inference), while retaining Keystone's existing Apache-licensed models and inference infrastructure.

Optional motion-directed regional inference could further reduce computational requirements.

Potential Implementation Opportunities

Several recent PRs appear to provide useful groundwork:

  • #144 — Synchronized higher-resolution frames for smart detection snapshots.
  • #127 — Camera-native ONVIF motion events to gate inference.
  • #148 — Improved object tracking and event continuity.
  • #80 and #93 — GPU-accelerated inference capabilities.

The higher-resolution frame pipeline introduced in #144 may provide a useful starting point for regional inference without requiring a separate video decoding pipeline.

The published YOLOX-M performance benchmarks in #80 also suggest that multiple inference passes per frame could be computationally practical, even on modern integrated GPUs.

Real-World Use Case

I am implementing a UniFi Protect deployment at a church with approximately 50–60 cameras, an Enterprise NVR, three physical AI Keys, and six physical AI Ports.

Two existing Hikvision dual-sensor 180-degree panoramic cameras are particularly interesting candidates for Keystone because Ubiquiti's physical AI Ports do not support these wide-aspect-ratio multisensor cameras.

Beyond panoramic camera compatibility, improved detection resolution would benefit conventional 4K cameras monitoring large outdoor spaces, parking lots, and other areas where distant object detection is important.

Desired Outcome

Allow users to trade additional computational resources for improved detection accuracy, without sacrificing compatibility with Protect's native detection events, zones, tracking, and recording functionality.

The existing low-compute implementation should remain available and continue to be the default.

I would be interested in helping test this functionality in a real-world deployment.

Is this something that would fit within Keystone's architectural direction?

Dominant language
Python
Stars
1k
Forks
114
Avg merge
1h
Merged PRs (30d)
115

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from seeARMS/keystone

All issues in seeARMS/keystone

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.