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.
Installation#
Clone the project and install its PyYAML dependency:
git clone https://github.com/WangQvQ/YAML2ModelGraph.git
cd YAML2ModelGraph
pip install pyyamlUsage#
Generate a diagram from the included YOLO26 example:
python main.py examples/yolo26.yaml output.svgUse --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_rybAvailable 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.