A usefull CNN/DenseNet visualization tool
Project description
neural-network-renderer
This repository contains everything necessary to generated neural network visualisation.
The code generating the image is writen in Python. This code generates .tex
file that is directly compiled and deleted once the results are available.
Example
Here is an example of the code to generate a simple convolutionnal-network representation:
from pathlib import Path
import sys
from network_layer.architecture import Architecture
from network_layer.layers import Input, Pool, Conv, Softmax, Dense, Spacer
def main():
arch = Architecture(2 / 32)
# input
arch.add(Input("assets/input_def_crop.png", shape=[64, 64]))
# first layer
arch.add(Conv([64, 64, 32], s_filter=64, n_filter=32, to="(4,0,0)"))
arch.add(Conv([62, 62, 32], s_filter=62, n_filter=32))
arch.add(Pool([31, 31, 32]))
arch.add(Spacer())
# second layer
arch.add(Conv([31, 31, 64], s_filter=31, n_filter=64))
arch.add(Conv([29, 29, 64], s_filter=29, n_filter=64))
arch.add(Pool([14, 14, 64]))
arch.add(Spacer())
# third layer
arch.add(Conv([13, 13, 64], s_filter=14, n_filter=64))
arch.add(Conv([12, 12, 64], s_filter=12, n_filter=64))
arch.add(Pool([6, 6, 64]))
arch.add(Spacer())
# flatten
arch.add(Dense(64, 64))
# output
arch.add(Spacer())
arch.add(Softmax(5, 5))
arch.generate(f"{Path(sys.argv[0]).stem}.tex")
if __name__ == "__main__":
main()
The rendering is started with this command:
bash to_pdf.sh main
where main
is the name of the python file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file neural_network_renderer-0.2-py3-none-any.whl
.
File metadata
- Download URL: neural_network_renderer-0.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a39f58ddc54b99e1e90ad6fe16cb02c8db2ebed5dc03b9c8378bc60ff0ef3f3 |
|
MD5 | 086be0917470fbe62a020bb980f0992f |
|
BLAKE2b-256 | e1fbccc98a7131a0575f4e0eeba74a04fdf48f6c2bb31b3dc9c6c2ad46a4bbc6 |