From 7c7bfc9d3d52d2f3375f98c5481fc1d09caf6b0d Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Thu, 21 Feb 2019 14:48:53 +0100 Subject: [PATCH 1/5] Create apt.txt adding texlive --- binder/apt.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 binder/apt.txt diff --git a/binder/apt.txt b/binder/apt.txt new file mode 100644 index 0000000..0d0331b --- /dev/null +++ b/binder/apt.txt @@ -0,0 +1 @@ +texlive-full From 4c0f8efcb8a479c6691babceaba6de9333cf41a6 Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Thu, 21 Feb 2019 14:49:07 +0100 Subject: [PATCH 2/5] Delete __init__.pyc --- pycore/__init__.pyc | Bin 106 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pycore/__init__.pyc diff --git a/pycore/__init__.pyc b/pycore/__init__.pyc deleted file mode 100644 index e9f05b6d19cfdbf93a518bcf3c516d26dac10980..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 106 zcmZSn%*&-$kr$K900oRd+5w1*S%5?e14FO|NW@PANHCxg#lk=_Jw5&8{GwF-`1s7c d%#!$cy@JXT4xqSAZhlH>PO2S9cQFt%008&L5QhK& From 93dfb6a4ee8571f8fed86f5673d0a09cb51dcddf Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Thu, 21 Feb 2019 14:49:14 +0100 Subject: [PATCH 3/5] Delete tikzeng.pyc --- pycore/tikzeng.pyc | Bin 7118 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 pycore/tikzeng.pyc diff --git a/pycore/tikzeng.pyc b/pycore/tikzeng.pyc deleted file mode 100644 index ed1ff6e9abfb52ced60c36ed3b58ba634cd68bb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7118 zcmds6&2JmW6(5q4CDD>U6g#r>;f&NcrEQA-iV>qKD*P@pK?X9<7dhV_F{ujOW+#Y&MfA8(=E~$u?-PS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] Update README.md adding binder link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9481c92..e5cd147 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # PlotNeuralNet -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2526396.svg)](https://doi.org/10.5281/zenodo.2526396) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2526396.svg)](https://doi.org/10.5281/zenodo.2526396) [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/HarisIqbal88/PlotNeuralNet/master) Latex code for drawing neural networks for reports and presentation. Have a look into examples to see how they are made. Additionally, lets consolidate any improvements that you make and fix any bugs to help more people with this code. ## TODO -- [X] Python interfaz +- [X] Python interface - [ ] Add easy legend functionality - [ ] Add more layer shapes like TruncatedPyramid, 2DSheet etc - [ ] Add examples for RNN and likes. From 229096ec167e4207c355e0592d7aa13b83d61cca Mon Sep 17 00:00:00 2001 From: Kevin Mader Date: Thu, 21 Feb 2019 17:21:27 +0100 Subject: [PATCH 5/5] Add files via upload adding UNet notebook --- pyexamples/UNetNotebook.ipynb | 118 ++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 pyexamples/UNetNotebook.ipynb diff --git a/pyexamples/UNetNotebook.ipynb b/pyexamples/UNetNotebook.ipynb new file mode 100644 index 0000000..25c04bd --- /dev/null +++ b/pyexamples/UNetNotebook.ipynb @@ -0,0 +1,118 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import sys, os\n", + "PLOTNN_DIR = os.path.join('..')\n", + "sys.path.append(PLOTNN_DIR)\n", + "from pycore.tikzeng import *\n", + "from pycore.blocks import *\n", + "from IPython.display import display_pdf, FileLink" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "arch = [ \n", + " to_head(PLOTNN_DIR), \n", + " to_cor(),\n", + " to_begin(),\n", + " \n", + " #input\n", + " to_input( os.path.join(PLOTNN_DIR, 'examples/fcn8s/cats.jpg') ),\n", + "\n", + " #block-001\n", + " to_ConvConvRelu( name='ccr_b1', s_filer=500, n_filer=(64,64), offset=\"(0,0,0)\", to=\"(0,0,0)\", width=(2,2), height=40, depth=40 ),\n", + " to_Pool(name=\"pool_b1\", offset=\"(0,0,0)\", to=\"(ccr_b1-east)\", width=1, height=32, depth=32, opacity=0.5),\n", + " \n", + " *block_2ConvPool( name='b2', botton='pool_b1', top='pool_b2', s_filer=256, n_filer=128, offset=\"(1,0,0)\", size=(32,32,3.5), opacity=0.5 ),\n", + " *block_2ConvPool( name='b3', botton='pool_b2', top='pool_b3', s_filer=128, n_filer=256, offset=\"(1,0,0)\", size=(25,25,4.5), opacity=0.5 ),\n", + " *block_2ConvPool( name='b4', botton='pool_b3', top='pool_b4', s_filer=64, n_filer=512, offset=\"(1,0,0)\", size=(16,16,5.5), opacity=0.5 ),\n", + "\n", + " #Bottleneck\n", + " #block-005\n", + " to_ConvConvRelu( name='ccr_b5', s_filer=32, n_filer=(1024,1024), offset=\"(2,0,0)\", to=\"(pool_b4-east)\", width=(8,8), height=8, depth=8, caption=\"Bottleneck\" ),\n", + " to_connection( \"pool_b4\", \"ccr_b5\"),\n", + "\n", + " #Decoder\n", + " *block_Unconv( name=\"b6\", botton=\"ccr_b5\", top='end_b6', s_filer=64, n_filer=512, offset=\"(2.1,0,0)\", size=(16,16,5.0), opacity=0.5 ),\n", + " to_skip( of='ccr_b4', to='ccr_res_b6', pos=1.25),\n", + " *block_Unconv( name=\"b7\", botton=\"end_b6\", top='end_b7', s_filer=128, n_filer=256, offset=\"(2.1,0,0)\", size=(25,25,4.5), opacity=0.5 ),\n", + " to_skip( of='ccr_b3', to='ccr_res_b7', pos=1.25), \n", + " *block_Unconv( name=\"b8\", botton=\"end_b7\", top='end_b8', s_filer=256, n_filer=128, offset=\"(2.1,0,0)\", size=(32,32,3.5), opacity=0.5 ),\n", + " to_skip( of='ccr_b2', to='ccr_res_b8', pos=1.25), \n", + " \n", + " *block_Unconv( name=\"b9\", botton=\"end_b8\", top='end_b9', s_filer=512, n_filer=64, offset=\"(2.1,0,0)\", size=(40,40,2.5), opacity=0.5 ),\n", + " to_skip( of='ccr_b1', to='ccr_res_b9', pos=1.25),\n", + " \n", + " to_ConvSoftMax( name=\"soft1\", s_filer=512, offset=\"(0.75,0,0)\", to=\"(end_b9-east)\", width=1, height=40, depth=40, caption=\"SOFT\" ),\n", + " to_connection( \"end_b9\", \"soft1\"),\n", + " \n", + " to_end() \n", + " ]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "to_generate(arch, os.path.join(PLOTNN_DIR, 'u_out.tex'))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!pdflatex {os.path.join(PLOTNN_DIR, 'u_out.tex')}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "FileLink('u_out.pdf')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.7" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}