YOLOv7 Inference over PCIe

This project demonstrates how to use the SiMa PePPi API to perform object detection with the YOLOv7 model on a PCIe-connected video stream. It showcases hardware-accelerated inference using SiMa’s MLSoC platform, optimized for integration with PCIe video sources.

Purpose

This pipeline is designed to:

  • Ingest video input over PCIe from a host or connected capture device.

  • Run YOLOv7-based object detection on each frame.

  • Annotate frames with bounding boxes and labels.

  • Stream the output back to the host or a connected interface (e.g., display, recording module).

This setup targets integration and benchmarking scenarios for PCIe-connected systems.

Configuration Overview

The runtime parameters are defined in project.yaml. The following tables provide a detailed breakdown of the configuration.

Input Configuration

Parameter

Description

Example

source.name

Input type used

"pcie"

source.value

Identifier string for PCIe input

"PCIE"

udp_host

Not used for PCIe setup

""

port

Not used for PCIe setup

""

pipeline

Inference pipeline identifier

"YoloV7-Pcie"

Model Configuration (Models[0])

Parameter

Description

Value

name

Model identifier

"yolov7"

targz

Path to the YOLOv7 model archive

"<targz filepath>"

label_file

Path to the label file

"labels.txt"

normalize

Enable input normalization

true

channel_mean

Per-channel mean values

[0.0, 0.0, 0.0]

channel_stddev

Per-channel stddev values

[1.0, 1.0, 1.0]

padding_type

Padding strategy during preprocessing

"CENTER"

aspect_ratio

Preserve input aspect ratio

true

topk

Maximum number of detections per frame

10

detection_threshold

Confidence threshold for object detection

0.7

decode_type

Postprocessing decode strategy

"yolo"

Main Python Script

The main script performs the following:

  1. Loads the configuration from project.yaml.

  2. Initializes the PCIe VideoReader and VideoWriter.

  3. Sets the expected input and output resolution to 1280×720.

  4. Loads and configures the YOLOv7 model session on SiMa’s MLSoC.

  5. Continuously:

    • Reads frames from PCIe input

    • Runs detection inference

    • Annotates the output frame

    • Writes the result using PCIe streaming with metadata passthrough

⚠️ Make sure the PCIe input source delivers frames at 1280x720 resolution, or update the script accordingly.

Model Details

  • Download from here.

  • Model: YOLOv7

  • Normalization: Yes (mean: [0.0, 0.0, 0.0], stddev: [1.0, 1.0, 1.0])

  • Detection Threshold: 0.7

  • Output: Top 10 detections per frame

  • Decoding Strategy: YOLO