Ultralytics YOLO27:

Visualize YOLO Architectures with YAML2ModelGraph#

YAML2ModelGraph is a community tool that converts Ultralytics YOLO model YAML files into SVG architecture diagrams. It can help document custom models or inspect their backbone, neck, and head structure.

Single-head YOLO architecture rendered by YAML2ModelGraph Multi-head YOLO architecture rendered by YAML2ModelGraph

Installation#

Clone the project and install its PyYAML dependency:

git clone https://github.com/WangQvQ/YAML2ModelGraph.git
cd YAML2ModelGraph
pip install pyyaml

Usage#

Generate a diagram from the included YOLO26 example:

python main.py examples/yolo26.yaml output.svg

Use --head multi to draw separate scale-specific head nodes, or select one of the included themes:

python main.py examples/yolo26.yaml output.svg --head multi --theme paper_ryb

Available themes include paper, paper_ryb, candy, dark, ocean, retro, blueprint, forest, and journal. The generated SVG requires no Graphviz installation.

Node Metadata#

Edit DISPLAY_CONFIG in YAML2ModelGraph's main.py to choose which details appear in each node:

DISPLAY_CONFIG = {
    "show_channels": True,
    "show_repeats": True,
    "show_stride": True,
    "show_args": False,
}

Custom YAML module names are rendered automatically. Theme colors, shapes, and typography are configured in the tool's themes.py.

Limitations#

YAML2ModelGraph specially aligns standard Detect heads. Other task heads such as OBB, Pose, and Segment are currently rendered as generic neck-lane nodes. See the YAML2ModelGraph repository for current support and usage details.

FAQ#

  • Yes. Any Ultralytics model YAML that follows the [from, repeats, module, args] layer format renders, and custom module names are drawn as generic nodes. See the model YAML configuration guide for the format.

  • No. The tool writes SVG directly and depends only on PyYAML.

  • Only standard Detect heads. OBB, Pose, and Segment heads are drawn as generic neck-lane nodes; check the YAML2ModelGraph repository for current support.

Comments