Skip to main content

A usefull CNN/DenseNet visualization tool

Project description

neural-network-renderer

The code generating the image is writen in Python. This code generates .tex and .sty files that are directly compiled and deleted once the resulting PDF is available.

Example

Here is an example of the code to generate a simple convolutionnal-network representation:

from neural_network_renderer.architecture import Architecture
from neural_network_renderer.colors import Colors
from neural_network_renderer.layers import Conv, ConvConvRelu, Dense, DottedLines, Input, Pool, Softmax, Spacer

def main():
    Colors.Dense("lightgray")
    Colors.Softmax("lightgray")

    arch = Architecture(4 / 32)
    # first layer
    arch.add(ConvConvRelu(s_filter=64, n_filter=[32, 32], to="(5,0,0)"))
    arch.add(Pool([32, 32, 32]))
    arch.add(Spacer(width=20))

    # second layer
    arch.add(ConvConvRelu(s_filter=32, n_filter=[64, 64]))
    arch.add(Pool([16, 16, 64]))

    arch.add(Spacer())

    # third layer
    arch.add(ConvConvRelu(s_filter=16, n_filter=[64, 64]))
    arch.add(Pool([8, 8, 64], name="last_pool"))
    arch.add(Spacer())

    # GPA
    arch.add(Conv(s_filter=8, n_filter=1, name="gpa", caption="GPA"))

    # flatten
    arch.add(Dense(64, name="flatten", offset="(4,0,0)", caption="Hidden Layer"))
    arch.add(Softmax(5, 5, name="output", caption="Output", offset="(4,0,0)"))

    arch.add(DottedLines("gpa", "flatten"))
    arch.add(DottedLines("flatten", "output"))

    arch.to_pdf("output_file")


if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neural_network_renderer-0.2.3.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file neural_network_renderer-0.2.3.tar.gz.

File metadata

  • Download URL: neural_network_renderer-0.2.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

File hashes

Hashes for neural_network_renderer-0.2.3.tar.gz
Algorithm Hash digest
SHA256 592ef7cbcc8b22172e1d21ff34885599614634eb8eb243ef31dc1e12966d1c6c
MD5 8f439b936c544fc5c791cb3d5c8b01b7
BLAKE2b-256 7d9b03625ee80789f42f01fdcbaf10f74ffaed7974b9d626b928e90417647c51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page