Multimodel Demo
This project demonstrates how to use the SiMa PePPi API to create a multi-model pipeline combining segmentation, detection, and anomaly analysis. It uses a combination of YOLO, Teacher-Student distillation, and AutoEncoder networks to identify and evaluate regions of interest from a local folder of input samples.
Purpose
The pipeline performs the following:
Loads video frames from a local directory using
filesrc
.Uses a YOLO model to perform segmentation and detect objects of interest.
Processes the detected regions using Teacher, Student, and AutoEncoder models.
Calculates anomaly maps via mean squared error between Teacher-Student and AutoEncoder outputs.
Combines these maps to generate predictions.
Writes annotated results via UDP stream for visualization.
Configuration Overview
All runtime settings are managed through project.yaml
. Below are the parameters grouped by function.
Input/Output Configuration
Parameter |
Description |
Example |
---|---|---|
|
Input type; here using local image files |
|
|
Folder path containing input samples |
|
|
Host IP to stream annotated output |
|
|
UDP port for the output stream |
|
|
Inference pipeline used |
|
Model Configuration (Models[]
)
YOLO Model (Index 0)
Parameter |
Description |
Value |
---|---|---|
|
Model name |
|
|
Path to model archive |
|
|
Whether to normalize input |
|
|
Input mean values |
|
|
Input stddev values |
|
|
Padding method |
|
|
Maintain aspect ratio |
|
|
Maximum number of detections |
|
|
Detection score threshold |
|
|
Label map file path |
|
|
Image color format |
|
Teacher / Student / AutoEncoder Models (Index 1–3)
Parameter |
Description |
Value (same across all) |
---|---|---|
|
Model name |
|
|
Model archive |
|
|
Enable input normalization |
|
|
Input mean |
|
|
Input stddev |
|
|
Input format |
|
Main Python Script
The script performs the following:
Initializes four SiMa MLSoC sessions for the YOLO, Teacher, Student, and AutoEncoder models.
Loads and loops through input frames using
filesrc
.Runs the YOLO segmentation model to isolate regions of interest.
Passes the segmented region through the Teacher, Student, and AutoEncoder networks.
Computes two anomaly maps (Teacher vs. Student, AutoEncoder vs. Student).
Normalizes and combines these maps to highlight regions of potential anomaly.
Post-processes the combined map and generates a final prediction.
Converts and streams the result via UDP using
VideoWriter
.
Model Details
Download bundled models from here.
Unzip the package by running
tar -xvf STAnomalyDet.tar.gz
.