reworked network arch diagrams

This commit is contained in:
Jan Kowalczyk
2025-09-01 18:53:01 +02:00
parent 5ff56994c0
commit 33de01b150
17 changed files with 156 additions and 36 deletions

Binary file not shown.

View File

@@ -1027,7 +1027,7 @@ The LeNet-inspired autoencoder can be split into an encoder network (figure~\ref
The LeNet-inspired encoder network (see figure~\ref{fig:setup_arch_lenet_encoder}) is a compact convolutional neural network that reduces image data into a lower-dimensional latent space. It consists of two stages of convolution, normalization, non-linear activation, and pooling, followed by a dense layer that defines the latent representation. Conceptually, the convolutional layers learn small filters that detect visual patterns in the input (such as edges or textures). Batch normalization ensures that these learned signals remain numerically stable during training, while a LeakyReLU activation introduces non-linearity, allowing the network to capture more complex relationships. Pooling operations then downsample the feature maps, which reduces the spatial size of the data and emphasizes the most important features. Finally, a dense layer transforms the extracted feature maps into the latent space, which serves as the datas' representation in the reduced dimensionality latent space. The LeNet-inspired encoder network (see figure~\ref{fig:setup_arch_lenet_encoder}) is a compact convolutional neural network that reduces image data into a lower-dimensional latent space. It consists of two stages of convolution, normalization, non-linear activation, and pooling, followed by a dense layer that defines the latent representation. Conceptually, the convolutional layers learn small filters that detect visual patterns in the input (such as edges or textures). Batch normalization ensures that these learned signals remain numerically stable during training, while a LeakyReLU activation introduces non-linearity, allowing the network to capture more complex relationships. Pooling operations then downsample the feature maps, which reduces the spatial size of the data and emphasizes the most important features. Finally, a dense layer transforms the extracted feature maps into the latent space, which serves as the datas' representation in the reduced dimensionality latent space.
Concretely, the first convolutional layer uses a $3\times 3$ kernel with 8 output channels, corresponding to 8 learnable filters. For input images of size $1\times 2048\times 32$, this produces an intermediate representation of shape $8\times 2048\times 32$, which is reduced to $8\times 1024\times 16$ by a $2\times 2$ pooling layer. The second convolutional layer again applies a $3\times 3$ kernel but outputs 4 channels, followed by another pooling step, resulting in a feature map of shape $4\times 512\times 8$. This feature map is flattened and passed into a fully connected layer. The dimensionality of the output of this layer corresponds to the latent space, whose size is a tunable hyperparameter chosen according to the needs of the application. %Concretely, the first convolutional layer uses a $5\times 5$ kernel with 8 output channels, corresponding to 8 learnable filters. For input images of size $1\times 2048\times 32$, this produces an intermediate representation of shape $8\times 2048\times 32$, which is reduced to $8\times 1024\times 16$ by a $2\times 2$ pooling layer. The second convolutional layer again applies a $5\times 5$ kernel but outputs 4 channels, followed by another pooling step, resulting in a feature map of shape $4\times 512\times 8$. This feature map is flattened and passed into a fully connected layer. The dimensionality of the output of this layer corresponds to the latent space, whose size is a tunable hyperparameter chosen according to the needs of the application.
% Its decoder network (see figure~\ref{fig:setup_arch_lenet_decoder}) is a mirrored version of the encoder, with a dense layer after the latent space and two pairs of 2x2 upsampling and transpose convolution layers which use 4 and 8 input channels respectively with the second one reducing its output to one channel resulting in the 2048x32x1 output dimensionality, equal to the input's, which is required for the autoencoding objective to be possible. % Its decoder network (see figure~\ref{fig:setup_arch_lenet_decoder}) is a mirrored version of the encoder, with a dense layer after the latent space and two pairs of 2x2 upsampling and transpose convolution layers which use 4 and 8 input channels respectively with the second one reducing its output to one channel resulting in the 2048x32x1 output dimensionality, equal to the input's, which is required for the autoencoding objective to be possible.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
# ====== CONFIG ====== # ====== CONFIG ======
# Add names (without extension). Example: NAMES = report thesis notes # Add names (without extension). Example: NAMES = report thesis notes
NAMES = subter_lenet_arch subter_ef_arch arch_ef_encoder arch_ef_decoder arch_lenet_encoder arch_lenet_decoder NAMES = arch_ef_encoder arch_ef_decoder arch_lenet_encoder arch_lenet_decoder
TEX = $(NAMES:%=%.tex) TEX = $(NAMES:%=%.tex)
PDF = $(NAMES:%=%.pdf) PDF = $(NAMES:%=%.pdf)
@@ -10,7 +10,7 @@ PDF = $(NAMES:%=%.pdf)
.PRECIOUS: %.tex .PRECIOUS: %.tex
# Default: build all PDFs # Default: build all PDFs
all: $(PDF) all: $(PDF) $(TEX)
# ====== Rules ====== # ====== Rules ======
# Generate {name}.tex from {name}.py # Generate {name}.tex from {name}.py

View File

@@ -38,6 +38,7 @@ arch = [
to_fc( to_fc(
"fc3", "fc3",
n_filer="{{8×128×8}}", n_filer="{{8×128×8}}",
zlabeloffset=0.5,
offset="(2,0,0)", offset="(2,0,0)",
to="(latent-east)", to="(latent-east)",
height=H1, height=H1,
@@ -47,20 +48,22 @@ arch = [
), ),
to_Conv( to_Conv(
"unsqueeze", "unsqueeze",
s_filer="", s_filer="{{128×8}}",
zlabeloffset=0.4,
n_filer=32, n_filer=32,
offset="(2,0,0)", offset="(2,0,0)",
to="(fc3-east)", to="(fc3-east)",
height=H8, height=H8,
depth=D128, depth=D128,
width=W32, width=W32,
caption="unsqueeze", caption="Unsqueeze",
), ),
# to_connection("latent", "fc3"), # to_connection("latent", "fc3"),
# Reshape to 4×8×512 # Reshape to 4×8×512
to_UnPool( to_UnPool(
"up1", "up1",
offset="(2,0,0)", offset="(2,0,0)",
n_filer=32,
to="(unsqueeze-east)", to="(unsqueeze-east)",
height=H16, height=H16,
depth=D256, depth=D256,
@@ -76,11 +79,12 @@ arch = [
height=H16, height=H16,
depth=D256, depth=D256,
width=W1, width=W1,
caption="deconv1", caption="Deconv1",
), ),
to_Conv( to_Conv(
"dwdeconv2", "dwdeconv2",
s_filer="{{256×16}}", s_filer="{{256×16}}",
zlabeloffset=0.4,
n_filer=32, n_filer=32,
offset="(0,0,0)", offset="(0,0,0)",
to="(dwdeconv1-east)", to="(dwdeconv1-east)",
@@ -93,6 +97,7 @@ arch = [
"up2", "up2",
offset="(2,0,0)", offset="(2,0,0)",
to="(dwdeconv2-east)", to="(dwdeconv2-east)",
n_filer=32,
height=H16, height=H16,
depth=D1024, depth=D1024,
width=W32, width=W32,
@@ -107,11 +112,12 @@ arch = [
height=H16, height=H16,
depth=D1024, depth=D1024,
width=W1, width=W1,
caption="deconv2", caption="Deconv2",
), ),
to_Conv( to_Conv(
"dwdeconv4", "dwdeconv4",
s_filer="{{1024×16}}", s_filer="{{1024×16}}",
zlabeloffset=0.17,
n_filer=16, n_filer=16,
offset="(0,0,0)", offset="(0,0,0)",
to="(dwdeconv3-east)", to="(dwdeconv3-east)",
@@ -123,6 +129,7 @@ arch = [
to_UnPool( to_UnPool(
"up3", "up3",
offset="(2,0,0)", offset="(2,0,0)",
n_filer=16,
to="(dwdeconv4-east)", to="(dwdeconv4-east)",
height=H32, height=H32,
depth=D2048, depth=D2048,
@@ -138,11 +145,12 @@ arch = [
height=H32, height=H32,
depth=D2048, depth=D2048,
width=W1, width=W1,
caption="deconv3", caption="Deconv3",
), ),
to_Conv( to_Conv(
"dwdeconv6", "dwdeconv6",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=8, n_filer=8,
offset="(0,0,0)", offset="(0,0,0)",
to="(dwdeconv5-east)", to="(dwdeconv5-east)",
@@ -154,26 +162,28 @@ arch = [
to_Conv( to_Conv(
"outconv", "outconv",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1, n_filer=1,
offset="(2,0,0)", offset="(2,0,0)",
to="(dwdeconv6-east)", to="(dwdeconv6-east)",
height=H32, height=H32,
depth=D2048, depth=D2048,
width=W1, width=W1,
caption="deconv4", caption="Deconv4",
), ),
# to_connection("up2", "deconv2"), # to_connection("up2", "deconv2"),
# Output # Output
to_Conv( to_Conv(
"out", "out",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1, n_filer=1,
offset="(2,0,0)", offset="(2,0,0)",
to="(outconv-east)", to="(outconv-east)",
height=H32, height=H32,
depth=D2048, depth=D2048,
width=W1, width=W1,
caption="output", caption="Output",
), ),
# to_connection("deconv2", "out"), # to_connection("deconv2", "out"),
to_end(), to_end(),

View File

@@ -29,6 +29,7 @@
name=latent, name=latent,
caption=Latent Space, caption=Latent Space,
xlabel={{, }}, xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim, zlabel=latent dim,
fill=\ConvColor, fill=\ConvColor,
height=19.200000000000003, height=19.200000000000003,
@@ -43,6 +44,7 @@
name=fc3, name=fc3,
caption=FC, caption=FC,
xlabel={{" ","dummy"}}, xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{8×128×8}}, zlabel={{8×128×8}},
fill=\FcColor, fill=\FcColor,
opacity=0.8, opacity=0.8,
@@ -56,9 +58,10 @@
\pic[shift={(2,0,0)}] at (fc3-east) \pic[shift={(2,0,0)}] at (fc3-east)
{Box={ {Box={
name=unsqueeze, name=unsqueeze,
caption=unsqueeze, caption=Unsqueeze,
xlabel={{32, }}, xlabel={{32, }},
zlabel=, zlabeloffset=0.4,
zlabel={{128×8}},
fill=\ConvColor, fill=\ConvColor,
height=12, height=12,
width=8, width=8,
@@ -73,6 +76,7 @@
caption=, caption=,
fill=\UnpoolColor, fill=\UnpoolColor,
opacity=0.5, opacity=0.5,
xlabel={{32, }},
height=18, height=18,
width=8, width=8,
depth=12 depth=12
@@ -83,8 +87,9 @@
\pic[shift={(0,0,0)}] at (up1-east) \pic[shift={(0,0,0)}] at (up1-east)
{Box={ {Box={
name=dwdeconv1, name=dwdeconv1,
caption=deconv1, caption=Deconv1,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.3,
zlabel=, zlabel=,
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
@@ -99,6 +104,7 @@
name=dwdeconv2, name=dwdeconv2,
caption=, caption=,
xlabel={{32, }}, xlabel={{32, }},
zlabeloffset=0.4,
zlabel={{256×16}}, zlabel={{256×16}},
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
@@ -114,6 +120,7 @@
caption=, caption=,
fill=\UnpoolColor, fill=\UnpoolColor,
opacity=0.5, opacity=0.5,
xlabel={{32, }},
height=18, height=18,
width=8, width=8,
depth=36 depth=36
@@ -124,8 +131,9 @@
\pic[shift={(0,0,0)}] at (up2-east) \pic[shift={(0,0,0)}] at (up2-east)
{Box={ {Box={
name=dwdeconv3, name=dwdeconv3,
caption=deconv2, caption=Deconv2,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.3,
zlabel=, zlabel=,
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
@@ -140,6 +148,7 @@
name=dwdeconv4, name=dwdeconv4,
caption=, caption=,
xlabel={{16, }}, xlabel={{16, }},
zlabeloffset=0.17,
zlabel={{1024×16}}, zlabel={{1024×16}},
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
@@ -155,6 +164,7 @@
caption=, caption=,
fill=\UnpoolColor, fill=\UnpoolColor,
opacity=0.5, opacity=0.5,
xlabel={{16, }},
height=26, height=26,
width=4, width=4,
depth=52 depth=52
@@ -165,8 +175,9 @@
\pic[shift={(0,0,0)}] at (up3-east) \pic[shift={(0,0,0)}] at (up3-east)
{Box={ {Box={
name=dwdeconv5, name=dwdeconv5,
caption=deconv3, caption=Deconv3,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.3,
zlabel=, zlabel=,
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -181,6 +192,7 @@
name=dwdeconv6, name=dwdeconv6,
caption=, caption=,
xlabel={{8, }}, xlabel={{8, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -193,8 +205,9 @@
\pic[shift={(2,0,0)}] at (dwdeconv6-east) \pic[shift={(2,0,0)}] at (dwdeconv6-east)
{Box={ {Box={
name=outconv, name=outconv,
caption=deconv4, caption=Deconv4,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -207,8 +220,9 @@
\pic[shift={(2,0,0)}] at (outconv-east) \pic[shift={(2,0,0)}] at (outconv-east)
{Box={ {Box={
name=out, name=out,
caption=output, caption=Output,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,

View File

@@ -25,6 +25,7 @@ arch = [
# Input 1×32×2048 (caption carries H×W; s_filer is numeric) # Input 1×32×2048 (caption carries H×W; s_filer is numeric)
to_Conv( to_Conv(
"input", "input",
zlabeloffset=0.2,
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
n_filer=1, n_filer=1,
offset="(0,0,0)", offset="(0,0,0)",
@@ -32,7 +33,7 @@ arch = [
height=H32, height=H32,
depth=D2048, depth=D2048,
width=W1, width=W1,
caption="input", caption="Input",
), ),
# Conv1 (5x5, same): 1->8, 32×2048 # Conv1 (5x5, same): 1->8, 32×2048
to_Conv( to_Conv(
@@ -48,20 +49,23 @@ arch = [
), ),
to_Conv( to_Conv(
"dwconv2", "dwconv2",
s_filer="", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=16, n_filer=16,
offset="(0,0,0)", offset="(0,0,0)",
to="(dwconv1-east)", to="(dwconv1-east)",
height=H32, height=H32,
depth=D2048, depth=D2048,
width=W16, width=W16,
caption="conv1", caption="Conv1",
), ),
# Pool1 2×2: 32×2048 -> 16×1024 # Pool1 2×2: 32×2048 -> 16×1024
# to_connection("input", "conv1"), # to_connection("input", "conv1"),
to_Pool( to_Pool(
"pool1", "pool1",
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.3,
s_filer="{{512×32}}",
to="(dwconv2-east)", to="(dwconv2-east)",
height=H32, height=H32,
depth=D512, depth=D512,
@@ -82,20 +86,23 @@ arch = [
), ),
to_Conv( to_Conv(
"dwconv4", "dwconv4",
s_filer="",
n_filer=32, n_filer=32,
zlabeloffset=0.3,
s_filer="{{512×32}}",
offset="(0,0,0)", offset="(0,0,0)",
to="(dwconv3-east)", to="(dwconv3-east)",
height=H32, height=H32,
depth=D512, depth=D512,
width=W32, width=W32,
caption="conv2", caption="Conv2",
), ),
# Pool2 2×2: 16×1024 -> 8×512 # Pool2 2×2: 16×1024 -> 8×512
# to_connection("pool1", "conv2"), # to_connection("pool1", "conv2"),
to_Pool( to_Pool(
"pool2", "pool2",
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.45,
s_filer="{{256×16}}",
to="(dwconv4-east)", to="(dwconv4-east)",
height=H16, height=H16,
depth=D256, depth=D256,
@@ -105,6 +112,8 @@ arch = [
to_Pool( to_Pool(
"pool3", "pool3",
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.45,
s_filer="{{128×8}}",
to="(pool2-east)", to="(pool2-east)",
height=H8, height=H8,
depth=D128, depth=D128,
@@ -113,19 +122,21 @@ arch = [
), ),
to_Conv( to_Conv(
"squeeze", "squeeze",
s_filer="",
n_filer=8, n_filer=8,
zlabeloffset=0.45,
s_filer="{{128×8}}",
offset="(2,0,0)", offset="(2,0,0)",
to="(pool3-east)", to="(pool3-east)",
height=H8, height=H8,
depth=D128, depth=D128,
width=W8, width=W8,
caption="squeeze", caption="Squeeze",
), ),
# FC -> rep_dim (use numeric n_filer) # FC -> rep_dim (use numeric n_filer)
to_fc( to_fc(
"fc1", "fc1",
n_filer="{{8×128×8}}", n_filer="{{8×128×8}}",
zlabeloffset=0.5,
offset="(2,0,0)", offset="(2,0,0)",
to="(squeeze-east)", to="(squeeze-east)",
height=H1, height=H1,

View File

@@ -27,8 +27,9 @@
\pic[shift={(0,0,0)}] at (0,0,0) \pic[shift={(0,0,0)}] at (0,0,0)
{Box={ {Box={
name=input, name=input,
caption=input, caption=Input,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.2,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -43,6 +44,7 @@
name=dwconv1, name=dwconv1,
caption=, caption=,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.3,
zlabel=, zlabel=,
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -55,9 +57,10 @@
\pic[shift={(0,0,0)}] at (dwconv1-east) \pic[shift={(0,0,0)}] at (dwconv1-east)
{Box={ {Box={
name=dwconv2, name=dwconv2,
caption=conv1, caption=Conv1,
xlabel={{16, }}, xlabel={{16, }},
zlabel=, zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
width=4, width=4,
@@ -69,6 +72,9 @@
\pic[shift={ (0,0,0) }] at (dwconv2-east) \pic[shift={ (0,0,0) }] at (dwconv2-east)
{Box={ {Box={
name=pool1, name=pool1,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{512×32}},
caption=, caption=,
fill=\PoolColor, fill=\PoolColor,
opacity=0.5, opacity=0.5,
@@ -84,6 +90,7 @@
name=dwconv3, name=dwconv3,
caption=, caption=,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.3,
zlabel=, zlabel=,
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -96,9 +103,10 @@
\pic[shift={(0,0,0)}] at (dwconv3-east) \pic[shift={(0,0,0)}] at (dwconv3-east)
{Box={ {Box={
name=dwconv4, name=dwconv4,
caption=conv2, caption=Conv2,
xlabel={{32, }}, xlabel={{32, }},
zlabel=, zlabeloffset=0.3,
zlabel={{512×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
width=8, width=8,
@@ -110,6 +118,9 @@
\pic[shift={ (0,0,0) }] at (dwconv4-east) \pic[shift={ (0,0,0) }] at (dwconv4-east)
{Box={ {Box={
name=pool2, name=pool2,
xlabel={{, }},
zlabeloffset=0.45,
zlabel={{256×16}},
caption=, caption=,
fill=\PoolColor, fill=\PoolColor,
opacity=0.5, opacity=0.5,
@@ -123,6 +134,9 @@
\pic[shift={ (0,0,0) }] at (pool2-east) \pic[shift={ (0,0,0) }] at (pool2-east)
{Box={ {Box={
name=pool3, name=pool3,
xlabel={{, }},
zlabeloffset=0.45,
zlabel={{128×8}},
caption=, caption=,
fill=\PoolColor, fill=\PoolColor,
opacity=0.5, opacity=0.5,
@@ -136,9 +150,10 @@
\pic[shift={(2,0,0)}] at (pool3-east) \pic[shift={(2,0,0)}] at (pool3-east)
{Box={ {Box={
name=squeeze, name=squeeze,
caption=squeeze, caption=Squeeze,
xlabel={{8, }}, xlabel={{8, }},
zlabel=, zlabeloffset=0.45,
zlabel={{128×8}},
fill=\ConvColor, fill=\ConvColor,
height=12, height=12,
width=2, width=2,
@@ -152,6 +167,7 @@
name=fc1, name=fc1,
caption=FC, caption=FC,
xlabel={{" ","dummy"}}, xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{8×128×8}}, zlabel={{8×128×8}},
fill=\FcColor, fill=\FcColor,
opacity=0.8, opacity=0.8,
@@ -167,6 +183,7 @@
name=latent, name=latent,
caption=Latent Space, caption=Latent Space,
xlabel={{, }}, xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim, zlabel=latent dim,
fill=\ConvColor, fill=\ConvColor,
height=19.200000000000003, height=19.200000000000003,

View File

@@ -38,6 +38,7 @@ arch = [
to_fc( to_fc(
"fc3", "fc3",
n_filer="{{4×512×8}}", n_filer="{{4×512×8}}",
zlabeloffset=0.35,
offset="(2,0,0)", offset="(2,0,0)",
to="(latent-east)", to="(latent-east)",
height=1.3, height=1.3,
@@ -49,6 +50,7 @@ arch = [
# Reshape to 4×8×512 # Reshape to 4×8×512
to_UnPool( to_UnPool(
"up1", "up1",
n_filer=4,
offset="(2,0,0)", offset="(2,0,0)",
to="(fc3-east)", to="(fc3-east)",
height=H16, height=H16,
@@ -61,6 +63,7 @@ arch = [
to_Conv( to_Conv(
"deconv1", "deconv1",
s_filer="{{1024×16}}", s_filer="{{1024×16}}",
zlabeloffset=0.2,
n_filer=8, n_filer=8,
offset="(0,0,0)", offset="(0,0,0)",
to="(up1-east)", to="(up1-east)",
@@ -74,6 +77,7 @@ arch = [
to_UnPool( to_UnPool(
"up2", "up2",
offset="(2,0,0)", offset="(2,0,0)",
n_filer=8,
to="(deconv1-east)", to="(deconv1-east)",
height=H32, height=H32,
depth=D2048, depth=D2048,
@@ -85,6 +89,7 @@ arch = [
to_Conv( to_Conv(
"deconv2", "deconv2",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1, n_filer=1,
offset="(0,0,0)", offset="(0,0,0)",
to="(up2-east)", to="(up2-east)",
@@ -98,6 +103,7 @@ arch = [
to_Conv( to_Conv(
"out", "out",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1, n_filer=1,
offset="(2,0,0)", offset="(2,0,0)",
to="(deconv2-east)", to="(deconv2-east)",

View File

@@ -29,6 +29,7 @@
name=latent, name=latent,
caption=Latent Space, caption=Latent Space,
xlabel={{, }}, xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim, zlabel=latent dim,
fill=\ConvColor, fill=\ConvColor,
height=19.200000000000003, height=19.200000000000003,
@@ -43,6 +44,7 @@
name=fc3, name=fc3,
caption=FC, caption=FC,
xlabel={{" ","dummy"}}, xlabel={{" ","dummy"}},
zlabeloffset=0.35,
zlabel={{4×512×8}}, zlabel={{4×512×8}},
fill=\FcColor, fill=\FcColor,
opacity=0.8, opacity=0.8,
@@ -59,6 +61,7 @@
caption=, caption=,
fill=\UnpoolColor, fill=\UnpoolColor,
opacity=0.5, opacity=0.5,
xlabel={{4, }},
height=18, height=18,
width=2, width=2,
depth=36 depth=36
@@ -71,6 +74,7 @@
name=deconv1, name=deconv1,
caption=Deconv1, caption=Deconv1,
xlabel={{8, }}, xlabel={{8, }},
zlabeloffset=0.2,
zlabel={{1024×16}}, zlabel={{1024×16}},
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
@@ -86,6 +90,7 @@
caption=, caption=,
fill=\UnpoolColor, fill=\UnpoolColor,
opacity=0.5, opacity=0.5,
xlabel={{8, }},
height=26, height=26,
width=4, width=4,
depth=52 depth=52
@@ -98,6 +103,7 @@
name=deconv2, name=deconv2,
caption=Deconv2, caption=Deconv2,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -112,6 +118,7 @@
name=out, name=out,
caption=Output, caption=Output,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,

View File

@@ -26,6 +26,7 @@ arch = [
to_Conv( to_Conv(
"input", "input",
s_filer="{{2048×32}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=1, n_filer=1,
offset="(0,0,0)", offset="(0,0,0)",
to="(0,0,0)", to="(0,0,0)",
@@ -37,7 +38,8 @@ arch = [
# Conv1 (5x5, same): 1->8, 32×2048 # Conv1 (5x5, same): 1->8, 32×2048
to_Conv( to_Conv(
"conv1", "conv1",
s_filer="{{1024×16}}", s_filer="{{2048×32}}",
zlabeloffset=0.15,
n_filer=8, n_filer=8,
offset="(2,0,0)", offset="(2,0,0)",
to="(input-east)", to="(input-east)",
@@ -51,6 +53,8 @@ arch = [
to_Pool( to_Pool(
"pool1", "pool1",
offset="(0,0,0)", offset="(0,0,0)",
s_filer="{{1024×16}}",
zlabeloffset=0.3,
to="(conv1-east)", to="(conv1-east)",
height=H16, height=H16,
depth=D1024, depth=D1024,
@@ -60,7 +64,8 @@ arch = [
# Conv2 (5x5, same): 8->4, stays 16×1024 # Conv2 (5x5, same): 8->4, stays 16×1024
to_Conv( to_Conv(
"conv2", "conv2",
s_filer="{{512×8}}", s_filer="{{1024×16\hspace{2.5em}512×8}}",
zlabeloffset=0.4,
n_filer=4, n_filer=4,
offset="(2,0,0)", offset="(2,0,0)",
to="(pool1-east)", to="(pool1-east)",
@@ -73,7 +78,9 @@ arch = [
# to_connection("pool1", "conv2"), # to_connection("pool1", "conv2"),
to_Pool( to_Pool(
"pool2", "pool2",
s_filer="{{}}",
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.3,
to="(conv2-east)", to="(conv2-east)",
height=H8, height=H8,
depth=D512, depth=D512,
@@ -85,6 +92,7 @@ arch = [
"fc1", "fc1",
n_filer="{{4×512×8}}", n_filer="{{4×512×8}}",
offset="(2,0,0)", offset="(2,0,0)",
zlabeloffset=0.5,
to="(pool2-east)", to="(pool2-east)",
height=1.3, height=1.3,
depth=D512, depth=D512,

View File

@@ -29,6 +29,7 @@
name=input, name=input,
caption=Input, caption=Input,
xlabel={{1, }}, xlabel={{1, }},
zlabeloffset=0.15,
zlabel={{2048×32}}, zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
@@ -43,7 +44,8 @@
name=conv1, name=conv1,
caption=Conv1, caption=Conv1,
xlabel={{8, }}, xlabel={{8, }},
zlabel={{1024×16}}, zlabeloffset=0.15,
zlabel={{2048×32}},
fill=\ConvColor, fill=\ConvColor,
height=26, height=26,
width=4, width=4,
@@ -55,6 +57,9 @@
\pic[shift={ (0,0,0) }] at (conv1-east) \pic[shift={ (0,0,0) }] at (conv1-east)
{Box={ {Box={
name=pool1, name=pool1,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{1024×16}},
caption=, caption=,
fill=\PoolColor, fill=\PoolColor,
opacity=0.5, opacity=0.5,
@@ -70,7 +75,8 @@
name=conv2, name=conv2,
caption=Conv2, caption=Conv2,
xlabel={{4, }}, xlabel={{4, }},
zlabel={{512×8}}, zlabeloffset=0.4,
zlabel={{1024×16\hspace{2.5em}512×8}},
fill=\ConvColor, fill=\ConvColor,
height=18, height=18,
width=2, width=2,
@@ -82,6 +88,9 @@
\pic[shift={ (0,0,0) }] at (conv2-east) \pic[shift={ (0,0,0) }] at (conv2-east)
{Box={ {Box={
name=pool2, name=pool2,
xlabel={{, }},
zlabeloffset=0.3,
zlabel={{}},
caption=, caption=,
fill=\PoolColor, fill=\PoolColor,
opacity=0.5, opacity=0.5,
@@ -97,6 +106,7 @@
name=fc1, name=fc1,
caption=FC, caption=FC,
xlabel={{" ","dummy"}}, xlabel={{" ","dummy"}},
zlabeloffset=0.5,
zlabel={{4×512×8}}, zlabel={{4×512×8}},
fill=\FcColor, fill=\FcColor,
opacity=0.8, opacity=0.8,
@@ -112,6 +122,7 @@
name=latent, name=latent,
caption=Latent Space, caption=Latent Space,
xlabel={{, }}, xlabel={{, }},
zlabeloffset=0.3,
zlabel=latent dim, zlabel=latent dim,
fill=\ConvColor, fill=\ConvColor,
height=19.200000000000003, height=19.200000000000003,

View File

@@ -42,7 +42,16 @@
\coordinate (a1) at (0 , \y/2 , \z/2); \coordinate (a1) at (0 , \y/2 , \z/2);
\coordinate (b1) at (0 ,-\y/2 , \z/2); \coordinate (b1) at (0 ,-\y/2 , \z/2);
\tikzstyle{depthlabel}=[pos=0.2,text width=14*\z,text centered,sloped]
\tikzset{depthlabel/.style={pos=\zlabeloffset, text width=14*\z, text centered, sloped}}
%\tikzstyle{depthlabel}=[pos=0.3,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel0}=[pos=0,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel1}=[pos=0.1,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel2}=[pos=0.2,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel3}=[pos=0.3,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel4}=[pos=0.4,text width=14*\z,text centered,sloped]
%\tikzstyle{depthlabel5}=[pos=0.5,text width=14*\z,text centered,sloped]
\path (c) edge ["\small\zlabel"',depthlabel](f); %depth label \path (c) edge ["\small\zlabel"',depthlabel](f); %depth label
\path (b1) edge ["\ylabel",midway] (a1); %height label \path (b1) edge ["\ylabel",midway] (a1); %height label
@@ -92,6 +101,7 @@ scale/.store in=\scale,
xlabel/.store in=\boxlabels, xlabel/.store in=\boxlabels,
ylabel/.store in=\ylabel, ylabel/.store in=\ylabel,
zlabel/.store in=\zlabel, zlabel/.store in=\zlabel,
zlabeloffset/.store in=\zlabeloffset,
caption/.store in=\caption, caption/.store in=\caption,
name/.store in=\name, name/.store in=\name,
fill/.store in=\fill, fill/.store in=\fill,
@@ -105,6 +115,7 @@ scale=.2,
xlabel={{"","","","","","","","","",""}}, xlabel={{"","","","","","","","","",""}},
ylabel=, ylabel=,
zlabel=, zlabel=,
zlabeloffset=0.3,
caption=, caption=,
name=, name=,
} }

View File

@@ -69,6 +69,7 @@ def to_Conv(
s_filer=256, s_filer=256,
n_filer=64, n_filer=64,
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.3,
to="(0,0,0)", to="(0,0,0)",
width=1, width=1,
height=40, height=40,
@@ -92,6 +93,9 @@ def to_Conv(
xlabel={{""" xlabel={{"""
+ str(n_filer) + str(n_filer)
+ """, }}, + """, }},
zlabeloffset="""
+ str(zlabeloffset)
+ """,
zlabel=""" zlabel="""
+ str(s_filer) + str(s_filer)
+ """, + """,
@@ -168,7 +172,10 @@ def to_ConvConvRelu(
# Pool # Pool
def to_Pool( def to_Pool(
name, name,
n_filer="",
s_filer="",
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.3,
to="(0,0,0)", to="(0,0,0)",
width=1, width=1,
height=32, height=32,
@@ -187,6 +194,15 @@ def to_Pool(
name=""" name="""
+ name + name
+ """, + """,
xlabel={{"""
+ str(n_filer)
+ """, }},
zlabeloffset="""
+ str(zlabeloffset)
+ """,
zlabel="""
+ str(s_filer)
+ """,
caption=""" caption="""
+ caption + caption
+ r""", + r""",
@@ -212,6 +228,7 @@ def to_Pool(
# unpool4, # unpool4,
def to_UnPool( def to_UnPool(
name, name,
n_filer="",
offset="(0,0,0)", offset="(0,0,0)",
to="(0,0,0)", to="(0,0,0)",
width=1, width=1,
@@ -238,6 +255,9 @@ def to_UnPool(
opacity=""" opacity="""
+ str(opacity) + str(opacity)
+ """, + """,
xlabel={{"""
+ str(n_filer)
+ """, }},
height=""" height="""
+ str(height) + str(height)
+ """, + """,
@@ -360,6 +380,7 @@ def to_SoftMax(
depth=25, depth=25,
opacity=0.8, opacity=0.8,
caption=" ", caption=" ",
z_label_offset=0,
): ):
return ( return (
r""" r"""
@@ -428,6 +449,7 @@ def to_fc(
name, name,
n_filer=120, n_filer=120,
offset="(0,0,0)", offset="(0,0,0)",
zlabeloffset=0.3,
to="(0,0,0)", to="(0,0,0)",
width=2, width=2,
height=2, height=2,
@@ -450,6 +472,9 @@ def to_fc(
+ caption + caption
+ """, + """,
xlabel={{" ","dummy"}}, xlabel={{" ","dummy"}},
zlabeloffset="""
+ str(zlabeloffset)
+ """,
zlabel=""" zlabel="""
+ str(n_filer) + str(n_filer)
+ """, + """,