diff --git a/AE/01-Prepare-MNIST-dataset.ipynb b/AE/01-Prepare-MNIST-dataset.ipynb index 5d4a658bb18b1b4ecf6b35d295d04c306b73433d..15917f6a88677d08b0f164f30f210a851796a420 100644 --- a/AE/01-Prepare-MNIST-dataset.ipynb +++ b/AE/01-Prepare-MNIST-dataset.ipynb @@ -57,7 +57,7 @@ "### 1.2 - Parameters\n", "`prepared_dataset` : Filename of the future prepared dataset (example : ./data/mnist-noisy.h5)\\\n", "`scale` : Dataset scale. 1 mean 100% of the dataset - set 0.1 for tests\\\n", - "`progress_verbosity`: Verbosity of progress bar: 0=no progress, 1: progress bar, 2: One line" + "`progress_verbosity`: Verbosity of progress bar: 0=silent, 1=progress bar, 2=One line" ] }, { @@ -68,7 +68,7 @@ "source": [ "prepared_dataset = './data/mnist-noisy.h5'\n", "scale = 1\n", - "progress_verbosity = 2" + "progress_verbosity = 1" ] }, { diff --git a/AE/02-AE-with-MNIST.ipynb b/AE/02-AE-with-MNIST.ipynb index 8d9eed3b099b84f4bf8c28c19353417df5d8802b..894707f8fbdfa0362c7cd2c5c2ea1dd355db7205 100644 --- a/AE/02-AE-with-MNIST.ipynb +++ b/AE/02-AE-with-MNIST.ipynb @@ -61,11 +61,10 @@ "from modules.MNIST import MNIST\n", "from modules.ImagesCallback import ImagesCallback\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/AE2'\n", - "run_id, run_dir, datasets_dir = fidle.init('AE2', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('AE2')" ] }, { @@ -92,7 +91,7 @@ "prepared_dataset = './data/mnist-noisy.h5'\n", "dataset_seed = 123\n", "\n", - "scale = 1\n", + "scale = .1\n", "\n", "latent_dim = 10\n", "\n", @@ -116,7 +115,7 @@ "outputs": [], "source": [ "fidle.override('prepared_dataset', 'dataset_seed', 'scale', 'latent_dim')\n", - "fidle.override('train_prop', 'batch_size', 'epochs')" + "fidle.override('train_prop', 'batch_size', 'epochs', 'fit_verbosity')" ] }, { @@ -410,11 +409,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -427,7 +424,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/AE/03-AE-with-MNIST-post.ipynb b/AE/03-AE-with-MNIST-post.ipynb index 2be5ab0bf7c3b08a9ed0db05222b2fcc1a9a56ca..e75e4138199257b6622b9b8c9f568bce36b099c6 100644 --- a/AE/03-AE-with-MNIST-post.ipynb +++ b/AE/03-AE-with-MNIST-post.ipynb @@ -50,11 +50,10 @@ "\n", "from modules.MNIST import MNIST\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/AE2'\n", - "run_id, run_dir, datasets_dir = fidle.init('AE3', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('AE3')" ] }, { @@ -76,6 +75,7 @@ "outputs": [], "source": [ "prepared_dataset = './data/mnist-noisy.h5'\n", + "saved_models = './run/AE2/models'\n", "dataset_seed = 123\n", "scale = 1\n", "train_prop = .8" @@ -139,7 +139,7 @@ "metadata": {}, "outputs": [], "source": [ - "model = keras.models.load_model(f'{run_dir}/models/best_model.h5')" + "model = keras.models.load_model(f'{saved_models}/best_model.h5')" ] }, { @@ -155,7 +155,10 @@ "metadata": {}, "outputs": [], "source": [ - "denoised_test = model.predict(noisy_test)\n", + "from tabnanny import verbose\n", + "\n", + "\n", + "denoised_test = model.predict(noisy_test,verbose=0)\n", "\n", "print('Denoised images (denoised_test) shape : ',denoised_test.shape)" ] @@ -276,7 +279,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -290,7 +293,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.9" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/AE/04-ExtAE-with-MNIST.ipynb b/AE/04-ExtAE-with-MNIST.ipynb index fe23ccc5bf64e63d635892e727f57fd36a2249ca..86c2c217b3e46617dd91c07e38d81d6f19414b22 100644 --- a/AE/04-ExtAE-with-MNIST.ipynb +++ b/AE/04-ExtAE-with-MNIST.ipynb @@ -64,11 +64,10 @@ "from modules.MNIST import MNIST\n", "from modules.ImagesCallback import ImagesCallback\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/AE4'\n", - "run_id, run_dir, datasets_dir = fidle.init('AE4', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('AE4')" ] }, { @@ -95,7 +94,7 @@ "prepared_dataset = './data/mnist-noisy.h5'\n", "dataset_seed = None\n", "\n", - "scale = 1\n", + "scale = .1\n", "\n", "latent_dim = 10\n", "\n", @@ -119,7 +118,7 @@ "outputs": [], "source": [ "fidle.override('prepared_dataset', 'dataset_seed', 'scale', 'latent_dim')\n", - "fidle.override('train_prop', 'batch_size', 'epochs')" + "fidle.override('train_prop', 'batch_size', 'epochs', 'fit_verbosity')" ] }, { @@ -141,7 +140,7 @@ " train_prop = train_prop,\n", " seed = dataset_seed,\n", " shuffle = True,\n", - " filename=prepared_dataset )" + " filename = prepared_dataset )" ] }, { @@ -429,7 +428,7 @@ "metadata": {}, "outputs": [], "source": [ - "denoised_test, classcat_test = model.predict(noisy_test)\n", + "denoised_test, classcat_test = model.predict(noisy_test, verbose=0)\n", "\n", "print('Denoised images (denoised_test) shape : ',denoised_test.shape)\n", "print('Predicted classes (classcat_test) shape : ',classcat_test.shape)" @@ -507,7 +506,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -521,7 +520,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/AE/05-ExtAE-with-MNIST.ipynb b/AE/05-ExtAE-with-MNIST.ipynb index 4dc1e5e865a2914a97ffeca66a9ad95a8750c016..75309a3a30e0f79b4eab0d35003b4d4a2e80c709 100644 --- a/AE/05-ExtAE-with-MNIST.ipynb +++ b/AE/05-ExtAE-with-MNIST.ipynb @@ -64,11 +64,10 @@ "from modules.MNIST import MNIST\n", "from modules.ImagesCallback import ImagesCallback\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/AE5'\n", - "run_id, run_dir, datasets_dir = fidle.init('AE5', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('AE5')" ] }, { @@ -95,7 +94,7 @@ "prepared_dataset = './data/mnist-noisy.h5'\n", "dataset_seed = None\n", "\n", - "scale = 1\n", + "scale = .1\n", "\n", "latent_dim = 10\n", "\n", @@ -119,7 +118,7 @@ "outputs": [], "source": [ "fidle.override('prepared_dataset', 'dataset_seed', 'scale', 'latent_dim')\n", - "fidle.override('train_prop', 'batch_size', 'epochs')" + "fidle.override('train_prop', 'batch_size', 'epochs', 'fit_verbosity')" ] }, { @@ -136,11 +135,12 @@ "metadata": {}, "outputs": [], "source": [ - "clean_train,clean_test, noisy_train,noisy_test, class_train,class_test = MNIST.reload_prepared_dataset(scale = scale, \n", + "clean_train,clean_test, noisy_train,noisy_test, class_train,class_test = MNIST.reload_prepared_dataset(\n", + " scale = scale, \n", " train_prop = train_prop,\n", " seed = dataset_seed,\n", " shuffle = True,\n", - " filename=prepared_dataset )" + " filename = prepared_dataset )" ] }, { @@ -460,7 +460,7 @@ "metadata": {}, "outputs": [], "source": [ - "denoised_test, classcat_test = model.predict(noisy_test)\n", + "denoised_test, classcat_test = model.predict(noisy_test, verbose=0)\n", "\n", "print('Denoised images (denoised_test) shape : ',denoised_test.shape)\n", "print('Predicted classes (classcat_test) shape : ',classcat_test.shape)" @@ -538,7 +538,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -552,7 +552,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.9" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb b/DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb index e58707ed49d3ff77e7ca0637859f4215d7ceb2b6..e629e8fa94fac7df364b5db055697ae7adb35b33 100644 --- a/DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb +++ b/DCGAN/01-DCGAN-Draw-me-a-sheep.ipynb @@ -60,11 +60,10 @@ "from modules.models import DCGAN\n", "from modules.callbacks import ImagesCallback\n", "\n", - "# Init Fidle environment\n", "import fidle\n", + "# Init Fidle environment\n", "\n", - "run_dir = './run/SHEEP1.001' # Output directory\n", - "run_id, run_dir, datasets_dir = fidle.init('SHEEP1', run_dir)" + "run_id, run_dir, datasets_dir = fidle.init('SHEEP1')" ] }, { @@ -90,7 +89,7 @@ "epochs = 10\n", "batch_size = 32\n", "num_img = 12\n", - "fit_verbosity = 1" + "fit_verbosity = 2" ] }, { @@ -384,11 +383,8 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -402,7 +398,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/DCGAN/02-WGANGP-Draw-me-a-sheep.ipynb b/DCGAN/02-WGANGP-Draw-me-a-sheep.ipynb index 71316e52bcf11296be5d3a11d09904526e7ce1ed..c136ac8efdc58e1e883b2f42537e192f730e268a 100644 --- a/DCGAN/02-WGANGP-Draw-me-a-sheep.ipynb +++ b/DCGAN/02-WGANGP-Draw-me-a-sheep.ipynb @@ -60,11 +60,10 @@ "from modules.models import WGANGP\n", "from modules.callbacks import ImagesCallback\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/SHEEP2.001' # Output directory\n", - "run_id, run_dir, datasets_dir = fidle.init('SHEEP2', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('SHEEP2')" ] }, { @@ -91,7 +90,7 @@ "n_critic = 2\n", "batch_size = 64\n", "num_img = 12\n", - "fit_verbosity = 1" + "fit_verbosity = 2" ] }, { diff --git a/GTSRB/01-Preparation-of-data.ipynb b/GTSRB/01-Preparation-of-data.ipynb index e01d6a17fb08b5abbfd2da34f47e2e3fee03863d..d3924885f83e4434b619af96ac56b8a4a9b01d92 100644 --- a/GTSRB/01-Preparation-of-data.ipynb +++ b/GTSRB/01-Preparation-of-data.ipynb @@ -71,6 +71,7 @@ "\n", "You can choose to perform tests or generate the whole enhanced dataset by setting the following parameters: \n", "`scale` : 1 mean 100% of the dataset - set 0.1 for tests \n", + "`progress_verbosity`: Verbosity of progress bar: 0=silent, 1=progress bar, 2=One line \n", "`output_dir` : where to write enhanced dataset, could be :\n", " - `./data`, for tests purpose\n", " - `<datasets_dir>/GTSRB/enhanced` to add clusters in your datasets dir. \n", @@ -94,7 +95,7 @@ "# scale = 1\n", "# output_dir = f'{datasets_dir}/GTSRB/enhanced'\n", "\n", - "# ---- Verbosity - 0 = silent, 1 = one line, 2 = full progress bar\n", + "# ---- Verbosity\n", "#\n", "progress_verbosity = 2" ] diff --git a/README.ipynb b/README.ipynb index ed7a93685f15be2cdbe366c0b7b27e2c25377baf..e3280c1de45c36ef9fe6379eef8f882901ff35ee 100644 --- a/README.ipynb +++ b/README.ipynb @@ -3,13 +3,13 @@ { "cell_type": "code", "execution_count": 1, - "id": "a6392f98", + "id": "ca61843b", "metadata": { "execution": { - "iopub.execute_input": "2022-10-10T11:07:39.161206Z", - "iopub.status.busy": "2022-10-10T11:07:39.160393Z", - "iopub.status.idle": "2022-10-10T11:07:39.172452Z", - "shell.execute_reply": "2022-10-10T11:07:39.171611Z" + "iopub.execute_input": "2022-10-10T20:30:25.278804Z", + "iopub.status.busy": "2022-10-10T20:30:25.278247Z", + "iopub.status.idle": "2022-10-10T20:30:25.289806Z", + "shell.execute_reply": "2022-10-10T20:30:25.289004Z" }, "jupyter": { "source_hidden": true @@ -52,7 +52,7 @@ "For more information, you can contact us at : \n", "[<img width=\"200px\" style=\"vertical-align:middle\" src=\"fidle/img/00-Mail_contact.svg\"></img>](#top)\n", "\n", - "Current Version : <!-- VERSION_BEGIN -->2.02b3<!-- VERSION_END -->\n", + "Current Version : <!-- VERSION_BEGIN -->2.02b5<!-- VERSION_END -->\n", "\n", "\n", "## Course materials\n", @@ -226,7 +226,7 @@ "from IPython.display import display,Markdown\n", "display(Markdown(open('README.md', 'r').read()))\n", "#\n", - "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 10/10/22 13:07:38" + "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 10/10/22 22:30:24" ] } ], diff --git a/README.md b/README.md index ef4f47e4f1e16402cff716fa2655a014a6015d11..63e52096e6a311e3875d19d253e2dbc480405b10 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ For more information, see **https://fidle.cnrs.fr** : For more information, you can contact us at : [<img width="200px" style="vertical-align:middle" src="fidle/img/00-Mail_contact.svg"></img>](#top) -Current Version : <!-- VERSION_BEGIN -->2.02b3<!-- VERSION_END --> +Current Version : <!-- VERSION_BEGIN -->2.02b5<!-- VERSION_END --> ## Course materials diff --git a/VAE/01-VAE-with-MNIST.ipynb b/VAE/01-VAE-with-MNIST.ipynb index 4ca25fc7a33b458bbd3231a297c1ae134b396940..8b48f7ad35106ff1b1139fcd57dd2de028afddde 100644 --- a/VAE/01-VAE-with-MNIST.ipynb +++ b/VAE/01-VAE-with-MNIST.ipynb @@ -13,7 +13,7 @@ "\n", "## Objectives :\n", " - Understanding and implementing a **variational autoencoder** neurals network (VAE)\n", - " - Understanding **Keras functional API**\n", + " - Understanding **Keras functional API**, using two custom layers\n", "\n", "The calculation needs being important, it is preferable to use a very simple dataset such as MNIST to start with. \n", "...MNIST with a small scale if you haven't a GPU ;-)\n", @@ -54,11 +54,10 @@ "from modules.datagen import MNIST\n", "\n", "import sys\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/VAE1.001'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE1', run_dir)\n" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE1')\n" ] }, { @@ -68,8 +67,7 @@ "## Step 2 - Parameters\n", "`scale` : With scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU !\\\n", "`latent_dim` : 2 dimensions is small, but usefull to draw !\\\n", - "`fit_verbosity` : verbosity during training : 0 = silent, 1 = progress bar, 2 = one line per epoch\n", - "\n", + "`fit_verbosity`: Verbosity of training progress bar: 0=silent, 1=progress bar, 2=One line \n", "\n", "`loss_weights` : Our **loss function** is the weighted sum of two loss:\n", " - `r_loss` which measures the loss during reconstruction. \n", @@ -88,7 +86,7 @@ "latent_dim = 2\n", "loss_weights = [1,.001]\n", "\n", - "scale = 1\n", + "scale = 0.2\n", "seed = 123\n", "\n", "batch_size = 64\n", @@ -264,11 +262,12 @@ "metadata": {}, "outputs": [], "source": [ - "pwk.chrono_start()\n", + "chrono=fidle.Chrono()\n", + "chrono.start()\n", "\n", "history = vae.fit(x_data, epochs=epochs, batch_size=batch_size, callbacks=callbacks_list, verbose=fit_verbosity)\n", "\n", - "pwk.chrono_show()" + "chrono.show()" ] }, { @@ -383,11 +382,8 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -401,7 +397,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.10" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/02-VAE-with-MNIST.ipynb b/VAE/02-VAE-with-MNIST.ipynb index f1e43cc0d939bbca16bab9481fb9abb513351d0a..9242044b2e5ee5b792d4fa604a60c0aaf938a877 100644 --- a/VAE/02-VAE-with-MNIST.ipynb +++ b/VAE/02-VAE-with-MNIST.ipynb @@ -13,7 +13,7 @@ "\n", "## Objectives :\n", " - Understanding and implementing a **variational autoencoder** neurals network (VAE)\n", - " - Understanding a still more **advanced programming model**\n", + " - Understanding a still more **advanced programming model**, using a **custom model**\n", "\n", "The calculation needs being important, it is preferable to use a very simple dataset such as MNIST to start with. \n", "...MNIST with a small scale if you haven't a GPU ;-)\n", @@ -58,11 +58,10 @@ "from modules.callbacks import ImagesCallback, BestModelCallback\n", "from modules.datagen import MNIST\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/VAE2.001'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE2', run_dir)\n", + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE2')\n", "\n", "VAE.about()" ] @@ -72,10 +71,9 @@ "metadata": {}, "source": [ "## Step 2 - Parameters\n", - "`scale` : With scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU ! \n", + "`scale` : with scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU ! \n", "`latent_dim` : 2 dimensions is small, but usefull to draw ! \n", - "`fit_verbosity` : verbosity during training : 0 = silent, 1 = progress bar, 2 = one line per epoch\n", - "\n", + "`fit_verbosity`: Verbosity of training progress bar: 0=silent, 1=progress bar, 2=One line \n", "\n", "`loss_weights` : Our **loss function** is the weighted sum of two loss:\n", " - `r_loss` which measures the loss during reconstruction. \n", @@ -94,11 +92,11 @@ "latent_dim = 2\n", "loss_weights = [1,.001] # [1, .001] give good results\n", "\n", - "scale = 1\n", + "scale = .2\n", "seed = 123\n", "\n", "batch_size = 64\n", - "epochs = 10\n", + "epochs = 5\n", "fit_verbosity = 1" ] }, @@ -260,11 +258,12 @@ "metadata": {}, "outputs": [], "source": [ - "pwk.chrono_start()\n", + "chrono=fidle.Chrono()\n", + "chrono.start()\n", "\n", "history = vae.fit(x_data, epochs=epochs, batch_size=batch_size, callbacks=callbacks_list, verbose=fit_verbosity)\n", "\n", - "pwk.chrono_show()" + "chrono.show()" ] }, { @@ -368,7 +367,7 @@ "source": [ "# ---- Select few images\n", "\n", - "x_show = pwk.pick_dataset(x_data, n=10)\n", + "x_show = fidle.utils.pick_dataset(x_data, n=10)\n", "\n", "# ---- Get latent points and reconstructed images\n", "\n", @@ -395,11 +394,11 @@ "metadata": {}, "outputs": [], "source": [ - "n_show = 20000\n", + "n_show = int(20000*scale)\n", "\n", "# ---- Select images\n", "\n", - "x_show, y_show = pwk.pick_dataset(x_data,y_data, n=n_show)\n", + "x_show, y_show = fidle.utils.pick_dataset(x_data,y_data, n=n_show)\n", "\n", "# ---- Get latent points\n", "\n", @@ -472,11 +471,8 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -490,7 +486,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.10" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/03-VAE-with-MNIST-post.ipynb b/VAE/03-VAE-with-MNIST-post.ipynb index f07f842a3b8818f72d5bc7dc0a34f30cc0f40a30..fd37532618c91cfcff2acdccf339c4844bef06f6 100644 --- a/VAE/03-VAE-with-MNIST-post.ipynb +++ b/VAE/03-VAE-with-MNIST-post.ipynb @@ -145,7 +145,7 @@ "source": [ "# ---- Select few images\n", "\n", - "x_show = pwk.pick_dataset(x_data, n=10)\n", + "x_show = fidle.utils.pick_dataset(x_data, n=10)\n", "\n", "# ---- Get latent points and reconstructed images\n", "\n", @@ -176,7 +176,7 @@ "\n", "# ---- Select images\n", "\n", - "x_show, y_show = pwk.pick_dataset(x_data,y_data, n=n_show)\n", + "x_show, y_show = fidle.utils.pick_dataset(x_data,y_data, n=n_show)\n", "\n", "# ---- Get latent points\n", "\n", @@ -249,11 +249,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -266,7 +264,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/05-About-CelebA.ipynb b/VAE/05-About-CelebA.ipynb index 9d3e42c89dcfb88fcd72d903bff9d45dc0a84e0e..a475a9587191065fed0fc0b31cf2cf241364b8c7 100644 --- a/VAE/05-About-CelebA.ipynb +++ b/VAE/05-About-CelebA.ipynb @@ -42,18 +42,17 @@ "\n", "from importlib import reload\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir='./run/VAE5'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE5', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE5')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "`progress_verbosity` : Progress bar verbosity, 0 = silent, 1 = progress bar, 2 = one line" + "`progress_verbosity`: Verbosity of progress bar: 0=silent, 1=progress bar, 2=One line" ] }, { @@ -129,7 +128,8 @@ "metadata": {}, "outputs": [], "source": [ - "pwk.chrono_start()\n", + "chrono = fidle.Chrono()\n", + "chrono.start()\n", "\n", "nb_images=5000\n", "filenames = [ f'{dataset_img}/{i}' for i in dataset_desc.image_id[:nb_images] ]\n", @@ -141,12 +141,12 @@ "x_data=np.array(x)\n", "x=None\n", " \n", - "duration=pwk.chrono_stop()\n", + "duration=chrono.get_delay()\n", "print(f'\\nDuration : {duration:.2f} s')\n", "print(f'Shape is : {x_data.shape}')\n", "print(f'Numpy type : {x_data.dtype}')\n", "\n", - "pwk.display_md('<br>**Note :** Estimation for **200.000** normalized images : ')\n", + "fidle.utils.display_md('<br>**Note :** Estimation for **200.000** normalized images : ')\n", "x_data=x_data/255\n", "k=200000/nb_images\n", "print(f'Charging time : {k*duration:.2f} s or {fidle.utils.hdelay(k*duration)}')\n", @@ -239,11 +239,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -256,7 +254,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/06-Prepare-CelebA-datasets.ipynb b/VAE/06-Prepare-CelebA-datasets.ipynb index 3c267bcf7ea033f6b5795376a19b728ed77afa5c..43cc6cf409015051f69c7faf021d36688435dff3 100644 --- a/VAE/06-Prepare-CelebA-datasets.ipynb +++ b/VAE/06-Prepare-CelebA-datasets.ipynb @@ -48,13 +48,10 @@ "import csv\n", "import math, random\n", "\n", - "from importlib import reload\n", - "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir='./run/VAE6'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE6', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE6')" ] }, { @@ -76,7 +73,7 @@ " - `<datasets_dir>/celeba/enhanced` to add clusters in your datasets dir. \n", " \n", "`cluster_size` : number of images in a cluster, 10000 is fine. (will be adjust by scale) \n", - "`progress_verbosity`: Verbosity of progress bar: 0=no progress, 1: progress bar, 2: One line\n", + "`progress_verbosity`: Verbosity of progress bar: 0=silent, 1=progress bar, 2=One line \n", "\n", "**Note :** If the target folder is not empty and exit_if_exist is True, the construction is blocked. " ] @@ -203,8 +200,7 @@ " nb_clusters : Number of clusters\n", " duration: total duration\n", " '''\n", - " global pwk\n", - " \n", + "\n", " def save_cluster(imgs,desc,cols,id):\n", " file_img = f'{cluster_dir}/{cluster_name}-{id:03d}.npy'\n", " file_desc = f'{cluster_dir}/{cluster_name}-{id:03d}.csv'\n", @@ -213,7 +209,8 @@ " df.to_csv(file_desc, index=False)\n", " return [],[],id+1\n", " \n", - " pwk.chrono_start()\n", + " chrono = fidle.Chrono()\n", + " chrono.start()\n", " \n", " # ---- Seed\n", " #\n", @@ -287,7 +284,7 @@ " # ---- Save uncomplete cluster\n", " if len(imgs)>0 : imgs,desc,cluster_id=save_cluster(imgs,desc,cols,cluster_id)\n", "\n", - " duration=pwk.chrono_stop()\n", + " duration=chrono.get_delay('seconds')\n", " return cluster_id,duration\n" ] }, @@ -353,7 +350,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3.9.2 ('fidle-env')", "language": "python", "name": "python3" }, @@ -367,7 +364,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/07-Check-CelebA.ipynb b/VAE/07-Check-CelebA.ipynb index d0227baf61c2df031cc714d7e21fa0129577ec51..81e98261588f11ba5bb63718d5375c404ba25079 100644 --- a/VAE/07-Check-CelebA.ipynb +++ b/VAE/07-Check-CelebA.ipynb @@ -45,11 +45,10 @@ "\n", "from modules.datagen import DataGenerator\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir='./run/VAE7'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE7', run_dir)" + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE7')" ] }, { @@ -59,10 +58,10 @@ "### 1.2 - Parameters\n", "(Un)comment the right lines to be in accordance with the VAE6 notebook \n", "`image_size` : images size in the clusters, should be 128x128 or 192,160 - original size is (218,178) \n", - "`enhanced_dir` : the place where clustered dataset was saved. Maybe :\n", - " - `./data`, for tests purpose\n", - " - `f{datasets_dir}/celeba/enhanced` in your datasets dir. \n", - "`progress_verbosity`: Verbosity of progress bar: 0=no progress, 1: progress bar, 2: One line" + "`progress_verbosity`: Verbosity of progress bar: 0=silent, 1=progress bar, 2=One line \n", + "`enhanced_dir` : the place where clustered dataset was saved, can be :\n", + "- `./data`, for tests purpose\n", + "- `f{datasets_dir}/celeba/enhanced` in your datasets dir. " ] }, { @@ -122,7 +121,8 @@ " if v==1 : legend.append(cols[i])\n", " return str('\\n'.join(legend))\n", "\n", - "pwk.chrono_start()\n", + "chrono = fidle.Chrono()\n", + "chrono.start()\n", "\n", "# ---- the place of the clusters files\n", "#\n", @@ -170,10 +170,10 @@ " \n", " fidle.utils.update_progress('Load clusters :',i,imax, redraw=True, verbosity=progress_verbosity)\n", "\n", - "d=pwk.chrono_stop()\n", + "d=chrono.get_delay('seconds')\n", "\n", "fidle.utils.subtitle('Few stats :')\n", - "print(f'Loading time : {d:.2f} s or {fidle.utils.hdelay(d)}')\n", + "print(f'Loading time : {d} s or {fidle.utils.hdelay(d)}')\n", "print(f'Number of cluster : {i}')\n", "print(f'Number of images : {n1}')\n", "print(f'Number of desc. : {n2}')\n", @@ -245,11 +245,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -262,7 +260,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/08-VAE-with-CelebA.ipynb b/VAE/08-VAE-with-CelebA.ipynb index e9bfa05d32a78218ca810e878c0540f6d821a318..5e0cd0d99467979982c7ef66d7ce8a210e270edb 100644 --- a/VAE/08-VAE-with-CelebA.ipynb +++ b/VAE/08-VAE-with-CelebA.ipynb @@ -79,9 +79,10 @@ "metadata": {}, "source": [ "## Step 2 - Parameters\n", - "`scale` : With scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU ! \n", + "`scale` : with scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU ! \n", "`latent_dim` : 2 dimensions is small, but usefull to draw ! \n", - "`fit_verbosity` : verbosity during training : 0 = silent, 1 = progress bar, 2 = one line per epoch \n", + "`fit_verbosity`: Verbosity of training progress bar: 0=silent, 1=progress bar, 2=One line \n", + "\n", "`loss_weights` : Our **loss function** is the weighted sum of two loss:\n", " - `r_loss` which measures the loss during reconstruction. \n", " - `kl_loss` which measures the dispersion. \n", @@ -337,11 +338,12 @@ "metadata": {}, "outputs": [], "source": [ - "pwk.chrono_start()\n", + "chrono = fidle.Chrono()\n", + "chrono.start()\n", "\n", "history = vae.fit(data_gen, epochs=epochs, batch_size=batch_size, callbacks=callbacks_list, verbose=fit_verbosity)\n", "\n", - "pwk.chrono_show()" + "chrono.show()" ] }, { @@ -422,11 +424,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -439,7 +439,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/VAE/09-VAE-with-CelebA-192x160.ipynb b/VAE/09-VAE-with-CelebA-192x160.ipynb index b97c49e9d6bb56abda5144bf4e3badf84c3c31ce..588cd50a449964baec923b1fbfe432933fd63ea0 100644 --- a/VAE/09-VAE-with-CelebA-192x160.ipynb +++ b/VAE/09-VAE-with-CelebA-192x160.ipynb @@ -54,11 +54,10 @@ "from modules.callbacks import ImagesCallback, BestModelCallback\n", "from modules.datagen import DataGenerator\n", "\n", - "# Init Fidle environment\n", "import fidle\n", "\n", - "run_dir = './run/VAE9'\n", - "run_id, run_dir, datasets_dir = fidle.init('VAE9', run_dir)\n", + "# Init Fidle environment\n", + "run_id, run_dir, datasets_dir = fidle.init('VAE9')\n", "\n", "VAE.about()\n", "DataGenerator.about()" @@ -81,7 +80,8 @@ "## Step 2 - Parameters\n", "`scale` : With scale=1, we need 1'30s on a GPU V100 ...and >20' on a CPU ! \n", "`latent_dim` : 2 dimensions is small, but usefull to draw ! \n", - "`fit_verbosity` : verbosity during training : 0 = silent, 1 = progress bar, 2 = one line per epoch \n", + "`fit_verbosity`: Verbosity of training progress bar: 0=silent, 1=progress bar, 2=One line \n", + "\n", "`loss_weights` : Our **loss function** is the weighted sum of two loss:\n", " - `r_loss` which measures the loss during reconstruction. \n", " - `kl_loss` which measures the dispersion. \n", @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -347,11 +347,12 @@ "metadata": {}, "outputs": [], "source": [ - "pwk.chrono_start()\n", + "chrono = fidle.Chrono()\n", + "chrono.start()\n", "\n", "history = vae.fit(data_gen, epochs=epochs, batch_size=batch_size, callbacks=callbacks_list, verbose=fit_verbosity)\n", "\n", - "pwk.chrono_show()" + "chrono.show()" ] }, { @@ -432,11 +433,9 @@ } ], "metadata": { - "interpreter": { - "hash": "8e38643e33497db9a306e3f311fa98cb1e65371278ca73ee4ea0c76aa5a4f387" - }, "kernelspec": { - "display_name": "Python 3.9.7 64-bit ('fidle-cpu': conda)", + "display_name": "Python 3.9.2 ('fidle-env')", + "language": "python", "name": "python3" }, "language_info": { @@ -449,7 +448,12 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.9.2" + }, + "vscode": { + "interpreter": { + "hash": "b3929042cc22c1274d74e3e946c52b845b57cb6d84f2d591ffe0519b38e4896d" + } } }, "nbformat": 4, diff --git a/fidle/about.yml b/fidle/about.yml index 21ca86230643896acf6d140b97c315f9c2bc97fa..df1da0cc38c811d7f318a541a0501bf4fee00f44 100644 --- a/fidle/about.yml +++ b/fidle/about.yml @@ -13,7 +13,7 @@ # # This file describes the notebooks used by the Fidle training. -version: 2.02b4 +version: 2.02b5 content: notebooks name: Notebooks Fidle description: All notebooks used by the Fidle training diff --git a/fidle/ci/default.yml b/fidle/ci/default.yml index e52b040e9251a1d20d4c14db5af37206af76fc5c..4e4ff78e06dcdea29149d9acc7645c46ce44214c 100644 --- a/fidle/ci/default.yml +++ b/fidle/ci/default.yml @@ -1,6 +1,6 @@ campain: version: '1.0' - description: Automatically generated ci profile (10/10/22 13:07:38) + description: Automatically generated ci profile (10/10/22 22:30:24) directory: ./campains/default existing_notebook: 'remove # remove|skip' report_template: 'fidle # fidle|default' @@ -129,12 +129,14 @@ IMDB3: overrides: vocab_size: default review_len: default + saved_models: default dictionaries_dir: default IMDB4: notebook: IMDB/04-Show-vectors.ipynb overrides: vocab_size: default review_len: default + saved_models: default dictionaries_dir: default IMDB5: notebook: IMDB/05-LSTM-Keras.ipynb @@ -208,6 +210,7 @@ AE2: train_prop: default batch_size: default epochs: default + fit_verbosity: default AE3: notebook: AE/03-AE-with-MNIST-post.ipynb overrides: @@ -225,6 +228,7 @@ AE4: train_prop: default batch_size: default epochs: default + fit_verbosity: default AE5: notebook: AE/05-ExtAE-with-MNIST.ipynb overrides: @@ -235,6 +239,7 @@ AE5: train_prop: default batch_size: default epochs: default + fit_verbosity: default # # ------------ VAE