imlk0 / netron-export

Python module to export graphs generated by netron as png or svg files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Netron Export

alt text

netron is a nice viewer for machine learning models. It is however written in Javscript and does not expose its export to PNG/SVG functionalities in its Python interface or as a command line.

This script aims at enabling an automated saving of the graph as PNG or SVG file. In a nutshell, it works by opening a browser and simulating user interactions (opening the menu, clicking on the right link that will download the model) and then moving the downloaded file to the target location.

Requirements

This script is mostly based on the netron and playwright packages. Since it relies on the name of HTML elements that might change in the future, we fix the netron version.

To install the required packages, execute:

git clone https://github.com/raphael-prevost/netron-export.git
pip install ./netron-export

Alternatively, you can directly install from GitHub with

pip install git+https://github.com/raphael-prevost/netron-export

Playwright might also need to install dependencies separately, you can do it via:

playwright install --with-deps chromium

Usage

To execute the script, simply run

netron_export --output ./output.svg ./my_model.onnx

More generally, you can run

netron_export -h

to see help on all available parameters.

Contact

This work was supported by ImFusion GmbH (Munich, Germany).

Website | LinkedIn | X (formerly Twitter)

About

Python module to export graphs generated by netron as png or svg files

License:MIT License


Languages

Language:Python 100.0%