Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 2.29 KB

File metadata and controls

60 lines (44 loc) · 2.29 KB

YOLOv11 + SAHI Tiled Inference on MemryX MXA

This application runs YOLOv11 object detection on webcam or video-file input using the MemryX MXA accelerator. Each high-resolution frame is split into overlapping SAHI tiles, each tile is processed with MxAccl, and the tile-local detections are shifted back into full-frame coordinates and merged into one annotated output stream.

Features

  • YOLOv11 detection accelerated on MemryX MXA
  • SAHI tiled inference for high-resolution video frames
  • Duplicate detection merging across overlapping tiles
  • Live OpenCV display with FPS, detection count, and tile count overlay
  • Optional annotated output video writing

Note: You'll likely need to tune the options to suit your input resolution, model, and performance requirements. See the Common Options.

Requirements

  • MemryX MXA hardware and runtime/SDK
  • A compiled YOLOv11 DFP file, for example YOLO11 nano
  • Python dependencies, installed with:
pip install --upgrade pip wheel
pip install -r requirements.txt

Usage

Run live webcam inference:

python run.py \
  --video_path /dev/video0 \
  -d YOLO11_nano_MXA_Optimized_640_640_3_onnx.dfp

Run on a video file and write an annotated output video while displaying live results:

python run.py \
  --video_path input.mp4 \
  --output_video output_sahi.mp4 \
  -d YOLO11_nano_MXA_Optimized_640_640_3_onnx.dfp

Press q in the display window to quit.

Common Options

--slice_width 640              # SAHI tile width
--slice_height 640             # SAHI tile height
--overlap_width_ratio 0.2      # Horizontal tile overlap
--overlap_height_ratio 0.2     # Vertical tile overlap
--no_full_frame                # Disable extra full-frame inference
--sahi_postprocess_type NMM    # GREEDYNMM, NMM, NMS, or LSNMS
--conf 0.4                     # Per-tile confidence threshold
--iou 0.6                      # Per-tile IoU threshold

Larger tiles can improve context for large objects, while smaller tiles can improve small-object detection on very high-resolution input. Increasing overlap can reduce missed detections near tile boundaries, at the cost of more MXA inference work per frame.