Model visualization in Aidge#

Aidge offers powerful tools to help you visualize your AI models, making it easier to explore and debug them effectively.

Visualize your model with Mermaid#

Mermaid is a popular tool for creating diagrams and flowcharts using a simple markdown-like syntax. Aidge allows you to save your model’s graph as a .mmd file using the save function from GraphView.

To visualize these .mmd files, you have two options.

Python function#

This convenient function takes the path to your .mmd file and displays the generated image directly.

# function to visualize .mmd files

import base64
from IPython.display import Image, display

def visualize_mmd(path_to_mmd):
     with open(path_to_mmd, "r") as file_mmd:
         graph_mmd = file_mmd.read()

         graphbytes = graph_mmd.encode("utf-8")
         base64_bytes = base64.b64encode(graphbytes)
         base64_string = base64_bytes.decode("utf-8")
         display(Image(url=f"https://mermaid.ink/img/{base64_string}"))

     model.save("myModel")
     visualize_mmd("myModel.mmd")

Mermaid Live Editor#

Alternatively, you can directly copy and paste the content of your .mmd file into the online Mermaid Live Editor to visualize it.

Dive into your models interactively with Aidge Model Explorer#

The Aidge Model Explorer is a plugin based on the Google Model Explorer framework, designed specifically for visualizing Aidge graphs. For comprehensive details on using the Model Explorer, refer to its official documentation.

Here are some key features of the Aidge Model Explorer:

  • Instant visualization: quickly display graphs directly within Jupyter notebooks or your browser using simple one-liner methods.

  • Understand complex architectures: unpack complex models using Aidge’s unique hierarchical representation combined with nested layer views.

  • Track model evolution: easily compare and synchronize your models before and after any transformations.

  • Enhance debugging & profiling: add your own metadata and apply custom styling to tailor visualizations for debugging and profiling needs.

You can experiment with those with the tutorial Aidge model explorer.

To learn more, visit the Aidge Model Explorer GitLab page.