Skip to content

lemieux-lab/Dabus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dabus

A Julia package for visualizing Flux.jl neural network architectures as GraphViz diagrams.

Dense network with relu and sigmoid activations


Installation

This package is registered in LabRegistry

# With LabRegistry added in julia registry
] add Dabus

# Otherwise
] add https://github.com/lemieux-lab/Dabus

Or for local development:

] dev path/to/Dabus

Usage

using Dabus, Flux
 
model = Chain(
    Dense(50, 10, relu),
    Dense(10, 1)
)
 
# Display the network (returns image bytes)
img = draw_network(model)
 
# Save directly to a file
draw_network(model, save_to="network.png")
 
# Export as SVG
draw_network(model, save_to="network.svg", output_type="svg")

Note: Dabus requires an internet connection. Diagrams are rendered via the QuickChart.io GraphViz API : no local GraphViz installation needed.


Supported Layer Types

Category Layers
Standard Dense, Embedding
Convolutional Conv, ConvTranspose, CrossCor
Pooling MaxPool, MeanPool, AdaptiveMaxPool, AdaptiveMeanPool, GlobalMeanPool
Attention MultiHeadAttention
Recurrent LSTM, GRU
Containers Chain, Parallel, Maxout, PairwiseFusion
Skip connections SkipConnection
Activations / misc Any callable (e.g. relu, softmax, Flux.flatten)

API Reference

draw_network(network; save_to=nothing, output_type="png")

Generates a diagram of a Flux neural network.

Arguments:

  • network : A Flux model (e.g. a Chain or any supported layer).
  • save_to : Optional file path. If provided, the image bytes are written to this path.
  • output_type : Output format: "png" (default) or "svg".

Returns: Vector{UInt8} : the raw image bytes.


Examples

Embedding + Dense

Embedding followed by a Dense layer with leakyrelu

Dense + softmax activation

Dense layers with an intermediate softmax node

Convolutional layers (Conv, ConvTranspose, CrossCor)

Conv, ConvTranspose, and CrossCor layers in sequence

Pooling layers

MaxPool, GlobalMeanPool, and AdaptiveMaxPool

Multi-head attention

Two MultiHeadAttention layers followed by a Dense layer

LSTM recurrent network

Dense → LSTM → Dense with leakyrelu

Complex parallel architecture

Parallel branches with Embedding and LSTM paths merged into Dense layers


Requirements

  • Julia ≥ 1.0
  • Flux.jl ≥ 0.16
  • HTTP.jl ≥ 1.0
  • Internet connection (diagrams are rendered via the QuickChart.io API)

About

Using Graphviz to automatically plot neural network architecture from Flux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages