# holyjason/yolo11-seg architecture

> Architecture diagram of the GitHub repository holyjason/yolo11-seg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/holyjason/yolo11-seg
- Repository: https://github.com/holyjason/yolo11-seg

## Overview

This is a real-time YOLOv11 instance-segmentation application for RealSense depth cameras. Its workflow selects a model at startup, initializes the camera and segmentor, captures aligned color/depth frames, queues frames for inference, visualizes segmentation and depth, then displays interactive views and supports saving a frame. Camera capture and model inference run in separate threads; FPS counters provide a supporting metrics layer. The README documents D415/D455 support, but sampled camera code specifically implements D455. Edges reflect shown calls; external device and model-runtime details are represented only where evidenced.

Main entry points: [`app/instance_segmentation_app.py`](https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py) (Runtime controller), [`camera/realsense_d455.py`](https://github.com/holyjason/yolo11-seg/blob/main/camera/realsense_d455.py) (RealSense capture), [`main.py`](https://github.com/holyjason/yolo11-seg/blob/main/main.py) (Model selection), [`segmentation/yolov11_segmentation.py`](https://github.com/holyjason/yolo11-seg/blob/main/segmentation/yolov11_segmentation.py) (YOLOv11 inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_main["Model selection<br/>[main.py]"]
  node_app["Runtime controller"]
end

subgraph group_runtime["Live processing"]
  node_camera["RealSense capture<br/>[realsense_d455.py]"]
  node_frameq["Frame queue"]
  node_resultq["Result queue"]
  node_display["Interactive display"]
end

subgraph group_vision["Vision components"]
  node_model["YOLOv11 inference"]
  node_visualizer["Segmentation renderer"]
  node_depthview["Depth-map view"]
end

subgraph group_metrics["Performance metrics"]
  node_fps["FPS counters<br/>[fps_counter.py]"]
end

node_user(("Operator"))
node_realsense(("RealSense camera"))
node_modelruntime["Ultralytics runtime"]
node_saved["Saved image"]

node_user -->|"starts"| node_main
node_main -->|"creates and runs"| node_app
node_app -->|"initializes and captures"| node_camera
node_camera -->|"reads frames"| node_realsense
node_camera -->|"enqueues frames"| node_frameq
node_frameq -->|"provides frames"| node_app
node_app -->|"runs segmentation"| node_model
node_model -->|"invokes inference"| node_modelruntime
node_app -->|"renders results"| node_visualizer
node_app -->|"updates and reads"| node_fps
node_visualizer -->|"returns rendered frame"| node_resultq
node_app -->|"enqueues display data"| node_resultq
node_resultq -->|"provides results"| node_display
node_display -->|"creates depth view"| node_depthview
node_display -->|"shows modes"| node_user
node_display -->|"saves frame"| node_saved

click node_main "https://github.com/holyjason/yolo11-seg/blob/main/main.py"
click node_app "https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py"
click node_camera "https://github.com/holyjason/yolo11-seg/blob/main/camera/realsense_d455.py"
click node_frameq "https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py"
click node_resultq "https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py"
click node_model "https://github.com/holyjason/yolo11-seg/blob/main/segmentation/yolov11_segmentation.py"
click node_visualizer "https://github.com/holyjason/yolo11-seg/blob/main/segmentation/segmentation_visualizer.py"
click node_depthview "https://github.com/holyjason/yolo11-seg/blob/main/segmentation/segmentation_visualizer.py"
click node_fps "https://github.com/holyjason/yolo11-seg/blob/main/utils/fps_counter.py"
click node_display "https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app toneBlue
class node_camera,node_frameq,node_resultq,node_display toneAmber
class node_model,node_visualizer,node_depthview toneMint
class node_fps toneRose
class node_user,node_realsense,node_modelruntime,node_saved toneIndigo
```

## Components

### Application entry

- [Model selection](https://github.com/holyjason/yolo11-seg/blob/main/main.py): `main.py`
- [Runtime controller](https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py): `app/instance_segmentation_app.py`

### Live processing

- [RealSense capture](https://github.com/holyjason/yolo11-seg/blob/main/camera/realsense_d455.py): `camera/realsense_d455.py`
- [Frame queue](https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py): `app/instance_segmentation_app.py`
- [Result queue](https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py): `app/instance_segmentation_app.py`
- [Interactive display](https://github.com/holyjason/yolo11-seg/blob/main/app/instance_segmentation_app.py): `app/instance_segmentation_app.py`

### Vision components

- [YOLOv11 inference](https://github.com/holyjason/yolo11-seg/blob/main/segmentation/yolov11_segmentation.py): `segmentation/yolov11_segmentation.py`
- [Segmentation renderer](https://github.com/holyjason/yolo11-seg/blob/main/segmentation/segmentation_visualizer.py): `segmentation/segmentation_visualizer.py`
- [Depth-map view](https://github.com/holyjason/yolo11-seg/blob/main/segmentation/segmentation_visualizer.py): `segmentation/segmentation_visualizer.py`

### Performance metrics

- [FPS counters](https://github.com/holyjason/yolo11-seg/blob/main/utils/fps_counter.py): `utils/fps_counter.py`

### Other components

- **Operator**
- **RealSense camera**
- **Ultralytics runtime**
- **Saved image**

## Connections

- Operator → Model selection: starts (evidence: `README.md`)
- Model selection → Runtime controller: creates and runs (evidence: `main.py`)
- Runtime controller → RealSense capture: initializes and captures (evidence: `app/instance_segmentation_app.py`)
- RealSense capture → RealSense camera: reads frames (evidence: `camera/realsense_d455.py`)
- RealSense capture → Frame queue: enqueues frames (evidence: `app/instance_segmentation_app.py`)
- Frame queue → Runtime controller: provides frames (evidence: `app/instance_segmentation_app.py`)
- Runtime controller → YOLOv11 inference: runs segmentation (evidence: `app/instance_segmentation_app.py`)
- YOLOv11 inference → Ultralytics runtime: invokes inference (evidence: `segmentation/yolov11_segmentation.py`)
- Runtime controller → Segmentation renderer: renders results (evidence: `app/instance_segmentation_app.py`)
- Runtime controller → FPS counters: updates and reads (evidence: `app/instance_segmentation_app.py`)
- Segmentation renderer → Result queue: returns rendered frame (evidence: `app/instance_segmentation_app.py`)
- Runtime controller → Result queue: enqueues display data (evidence: `app/instance_segmentation_app.py`)
- Result queue → Interactive display: provides results (evidence: `app/instance_segmentation_app.py`)
- Interactive display → Depth-map view: creates depth view (evidence: `app/instance_segmentation_app.py`)
- Interactive display → Operator: shows modes (evidence: `app/instance_segmentation_app.py`)
- Interactive display → Saved image: saves frame (evidence: `app/instance_segmentation_app.py`)
