dl4jgrapher

Generates Graphviz DOT files from DL4J MultiLayerNetworks and ComputationGraphs

License

License

Categories

Categories

Deeplearning4j Business Logic Libraries Machine Learning
GroupId

GroupId

com.drissoft
ArtifactId

ArtifactId

dl4jgrapher_2.13
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

dl4jgrapher
Generates Graphviz DOT files from DL4J MultiLayerNetworks and ComputationGraphs
Project URL

Project URL

https://github.com/Dris101/dl4jgrapher
Project Organization

Project Organization

drissoft
Source Code Management

Source Code Management

https://github.com/Dris101/dl4jgrapher

Download dl4jgrapher_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/com.drissoft/dl4jgrapher_2.13/ -->
<dependency>
    <groupId>com.drissoft</groupId>
    <artifactId>dl4jgrapher_2.13</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.drissoft/dl4jgrapher_2.13/
implementation 'com.drissoft:dl4jgrapher_2.13:0.1.0'
// https://jarcasting.com/artifacts/com.drissoft/dl4jgrapher_2.13/
implementation ("com.drissoft:dl4jgrapher_2.13:0.1.0")
'com.drissoft:dl4jgrapher_2.13:jar:0.1.0'
<dependency org="com.drissoft" name="dl4jgrapher_2.13" rev="0.1.0">
  <artifact name="dl4jgrapher_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.drissoft', module='dl4jgrapher_2.13', version='0.1.0')
)
libraryDependencies += "com.drissoft" % "dl4jgrapher_2.13" % "0.1.0"
[com.drissoft/dl4jgrapher_2.13 "0.1.0"]

Dependencies

compile (7)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.1
org.deeplearning4j : deeplearning4j-core jar 1.0.0-beta7
org.nd4j : nd4j-native jar 1.0.0-beta7
io.circe : circe-core_2.13 jar 0.13.0
io.circe : circe-generic_2.13 jar 0.13.0
io.circe : circe-parser_2.13 jar 0.13.0
io.circe : circe-optics_2.13 jar 0.13.0

test (2)

Group / Artifact Type Version
org.scalatest : scalatest_2.13 jar 3.1.1
org.deeplearning4j : deeplearning4j-zoo jar 1.0.0-beta7

Project Modules

There are no modules declared in this project.

dl4jgrapher

Classes to generate Graphviz DOT files from DL4J MultiLayerNetworks and ComputationGraphs

For prototyping for example, with VS Code as your IDE, you can use João Pinto's excellent Graphviz (dot) language support extension (https://github.com/joaompinto/vscode-graphviz) to preview the generated DOT file alongside the dl4j code. You can also use Graphviz tools (https://graphviz.org/) to generate files in formats such as pdf, png, svg etc. from the DOT file for display / publication purposes.

Installation

SBT

In build.sbt:

libraryDependencies += "com.drissoft" %% "dl4jgrapher" % "0.1.0"

Scala Examples

AlexNet

ResNet50

InceptionResNetV1

MultiLayerNetwork

AlexNet

import org.deeplearning4j.zoo.model.AlexNet
import com.drissoft.dl4jgrapher._

val h = 224
val w = 224
val c = 3
val inputType = new InputType.InputTypeConvolutional(h, w, c)

// Build AlexNet
val net = AlexNet
  .builder()
  .numClasses(10)
  .build()
  .init()

val input   = Nd4j.rand(1, c, h, w)
val grapher = new MultiLayerNetworkGrapher(net).getGrapher(input, inputType)

// Output the DOT file
grapher.writeDotFile(java.nio.file.Paths.get("alexnet.dot"))

Graphviz

<Graphviz Dir>\bin\dot.exe -Tsvg alexnet.dot -o alexnet.svg

AlexNet Output

AlexNet

ComputationGraph

ResNet50

import org.deeplearning4j.zoo.model.ResNet50
import com.drissoft.dl4jgrapher._

val h = 224
val w = 200
val c = 3
val inputTypes = List(new InputType.InputTypeConvolutional(h, w, c))

// Build ResNet50
val net = ResNet50
  .builder()
  .numClasses(10)
  .build()
  .init()

val input   = Nd4j.rand(1, c, h, w)
val grapher = new ComputationGraphGrapher(net).getGrapher(Array(input), inputTypes)

// Output the DOT file
grapher.writeDotFile(java.nio.file.Paths.get("resnet.dot"))

ResNet50 Output

ResNet50

InceptionResNetV1 Output

InceptionResNetV1

Versions

Version
0.1.0