Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #88

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/
run/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Dockerfile

run/gan/*
run/compose/*
Expand Down
34 changes: 11 additions & 23 deletions 02_01_deep_learning_deep_neural_network.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"from keras.layers import Input, Flatten, Dense, Conv2D\n",
"from keras.models import Model\n",
"from keras.optimizers import Adam\n",
"from keras.utils import to_categorical\n",
"from tensorflow.keras.layers import Input, Flatten, Dense, Conv2D\n",
"from tensorflow.keras.models import Model\n",
"from tensorflow.keras.optimizers import Adam\n",
"from tensorflow.keras.utils import to_categorical\n",
"\n",
"from keras.datasets import cifar10"
"from tensorflow.keras.datasets import cifar10"
]
},
{
Expand Down Expand Up @@ -100,15 +100,8 @@
"\n",
"output_layer = Dense(NUM_CLASSES, activation = 'softmax')(x)\n",
"\n",
"model = Model(input_layer, output_layer)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model = Model(input_layer, output_layer)\n",
"\n",
"model.summary()"
]
},
Expand Down Expand Up @@ -174,7 +167,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"\n",
Expand All @@ -192,13 +187,6 @@
" ax.text(0.5, -0.7, 'act = ' + str(actual_single[idx]), fontsize=10, ha='center', transform=ax.transAxes)\n",
" ax.imshow(img)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -217,7 +205,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.5"
}
},
"nbformat": 4,
Expand Down
9 changes: 1 addition & 8 deletions 02_02_deep_learning_convolutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,6 @@
"plt.axis('off')\n",
"plt.imshow(new_image, cmap='Greys');"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -244,7 +237,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.5"
}
},
"nbformat": 4,
Expand Down
232 changes: 28 additions & 204 deletions 02_03_deep_learning_conv_neural_network.ipynb

Large diffs are not rendered by default.

20 changes: 3 additions & 17 deletions 03_01_autoencoder_train.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,13 @@
" , initial_epoch = INITIAL_EPOCH\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "gdl_code",
"display_name": "gdl_code_2",
"language": "python",
"name": "gdl_code"
"name": "gdl_code_2"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -185,7 +171,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion 03_02_autoencoder_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.5"
}
},
"nbformat": 4,
Expand Down
24 changes: 18 additions & 6 deletions 03_03_vae_digits_train.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
"## imports"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -86,6 +96,7 @@
" , decoder_conv_t_kernel_size = [3,3,3,3]\n",
" , decoder_conv_t_strides = [1,2,2,1]\n",
" , z_dim = 2\n",
" , r_loss_factor = 1000\n",
")\n",
"\n",
"if mode == 'build':\n",
Expand Down Expand Up @@ -125,8 +136,7 @@
"metadata": {},
"outputs": [],
"source": [
"LEARNING_RATE = 0.0005\n",
"R_LOSS_FACTOR = 1000"
"LEARNING_RATE = 0.0005"
]
},
{
Expand All @@ -135,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"vae.compile(LEARNING_RATE, R_LOSS_FACTOR)"
"vae.compile(LEARNING_RATE)"
]
},
{
Expand All @@ -153,7 +163,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"vae.train( \n",
Expand Down Expand Up @@ -190,9 +202,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
20 changes: 15 additions & 5 deletions 03_04_vae_digits_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
"## imports"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -93,7 +103,7 @@
"example_idx = np.random.choice(range(len(x_test)), n_to_show)\n",
"example_images = x_test[example_idx]\n",
"\n",
"z_points = vae.encoder.predict(example_images)\n",
"_,_,z_points = vae.encoder.predict(example_images)\n",
"\n",
"reconst_images = vae.decoder.predict(z_points)\n",
"\n",
Expand Down Expand Up @@ -135,7 +145,7 @@
"example_images = x_test[example_idx]\n",
"example_labels = y_test[example_idx]\n",
"\n",
"z_points = vae.encoder.predict(example_images)\n",
"_,_,z_points = vae.encoder.predict(example_images)\n",
"\n",
"min_x = min(z_points[:, 0])\n",
"max_x = max(z_points[:, 0])\n",
Expand Down Expand Up @@ -204,7 +214,7 @@
"example_images = x_test[example_idx]\n",
"example_labels = y_test[example_idx]\n",
"\n",
"z_points = vae.encoder.predict(example_images)\n",
"_,_,z_points = vae.encoder.predict(example_images)\n",
"p_points = norm.cdf(z_points)\n",
"\n",
"fig = plt.figure(figsize=(fig_width, fig_height))\n",
Expand Down Expand Up @@ -237,7 +247,7 @@
"example_images = x_test[example_idx]\n",
"example_labels = y_test[example_idx]\n",
"\n",
"z_points = vae.encoder.predict(example_images)\n",
"_,_,z_points = vae.encoder.predict(example_images)\n",
"\n",
"plt.figure(figsize=(5, 5))\n",
"plt.scatter(z_points[:, 0] , z_points[:, 1] , cmap='rainbow' , c= example_labels\n",
Expand Down Expand Up @@ -287,7 +297,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.7.5"
}
},
"nbformat": 4,
Expand Down
Loading