Skip to main content

Philotas object detection service

The vision half of the VISION panel: a small FastAPI service that runs object detection and image similarity for the Next.js app. The app reaches it through DETECTION_URL (default http://127.0.0.1:8770).

Engine selection

The detection engine is chosen by the DETECT_ENGINE environment variable:

  • auto (default) - uses AutoGluon when AG_MODEL_DIR points at a trained model directory. When AG_MODEL_DIR is unset, the service reports an error and asks you to point AG_MODEL_DIR at a model (or opt in to ultralytics explicitly).
  • autogluon - the AutoGluon ObjectDetector path (AG_MODEL_DIR).
  • ultralytics - explicit opt-in to ultralytics YOLO (YOLO_MODEL, default yolo11n.pt).

AutoGluon (supported default, Apache-2.0)

AutoGluon is the supported default engine. Install it and point AG_MODEL_DIR at a trained model directory:

python -m venv .venv
.venv\Scripts\activate          # Windows
pip install -r detect/requirements.txt
pip install autogluon.multimodal
python detect/train.py --data data/traffic/annotations.json --out models/traffic-v1
$env:AG_MODEL_DIR = 'models/traffic-v1'      # PowerShell
python detect/service.py

ultralytics YOLO (opt-in, AGPL-3.0)

ultralytics is AGPL-3.0 licensed. It is not installed by default and is only loaded when you explicitly set DETECT_ENGINE=ultralytics. Bring your own model weights (YOLO_MODEL, default yolo11n.pt) and review the license before operational use:

pip install ultralytics
$env:DETECT_ENGINE = 'ultralytics'           # PowerShell
python detect/service.py

Never commit .pt model-weight files to the repository.

If no engine loads, every endpoint answers 503 and /health says why, so the VISION panel degrades to a hint instead of an error.

Endpoints

GET  /health        engine, model, classes, video support
POST /detect        { image: <url | data URL> } or multipart file upload
POST /detect_video  { url, sample_every? }  -> { frames: [{t_ms, detections}] }
POST /similar       { query, bbox?, candidates: [{id, image}] } -> { matches }

Detection rows are { class, score, bbox:[x1,y1,x2,y2] } with bbox normalised to 0-1 fractions of the image, which is what the map overlay and the VISION panel expect.

Environment

DETECT_ENGINE         auto (default) | autogluon | ultralytics
AG_MODEL_DIR          trained AutoGluon ObjectDetector directory
YOLO_MODEL            ultralytics model (default yolo11n.pt)
DETECT_CONF           confidence threshold (default 0.25)
VIDEO_SAMPLE_EVERY    sample one frame every N (default 25)
VIDEO_MAX_FRAMES      frames sampled per video call (default 40)
DETECTION_PORT        port (default 8770)

Notes

  • /detect_video uses OpenCV's VideoCapture, which opens mp4 files and some streams directly. HLS (m3u8) and RTSP need a build of OpenCV with FFmpeg; opencv-python-headless usually has it on Windows.
  • 'Find other instances' uses AutoGluon's image_similarity predictor when AutoGluon is present; under YOLO it falls back to a class-profile heuristic and labels the result method: heuristic.
  • Train on the classes your workflows trigger on (person, bicycle, car...) so the built-in Traffic light accident watch fires on YOUR categories, not on COCO's 80.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philotas_detect-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philotas_detect-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file philotas_detect-0.1.0.tar.gz.

File metadata

  • Download URL: philotas_detect-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.13

File hashes

Hashes for philotas_detect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57dbbdac18d80c183c9bc29168671c083ecbe4fc238f471ec3c6fef06ebb8113
MD5 b6fd5c7fad43d4d19f5f416d5da7fabe
BLAKE2b-256 b4c5c995780f915e4e82827a6b09c3eb651a0f4522ae360a5296ac20d59c22f5

See more details on using hashes here.

File details

Details for the file philotas_detect-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for philotas_detect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 375a2217a378e2dc79cd5590c26b0743c46f5e2b8a53d0a135cc33d98f53f843
MD5 ebc66858493b3c0db6bec4ea33267431
BLAKE2b-256 20f1ba1ad7cebf27d91a78289dfbc4eea30627f324d2288b73757895328e6d57

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page