diff --git a/examples/README.md b/examples/README.md index 89adcf8..7975e1c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,5 +1,28 @@ [[Click For Russian version]](README_RU.md) +## Quick Start + +1. Clone the repository: + ```bash + git clone https://github.com/ChrisLisbon/TorchCNNBuilder.git + cd TorchCNNBuilder + +2. Install in development mode (recommended): + ```bash + pip install -e . + +**This will**: install all required dependencies, make the package available system-wide, allow +you to modify code and see changes immediately. + +3. For just running examples (without development): + ```bash + pip install numpy torch matplotlib jupyter + +4. ⚠️ Note: The examples use relative paths for data loading. +To avoid file not found errors, always launch Jupyter from the repository root directory: + ```bash + jupyter notebook examples/example_name.ipynb + # Usage examples Relevant usage examples can be found in this directory. The API examples of each submodule are located in the corresponding `ipynb` file: diff --git a/examples/README_RU.md b/examples/README_RU.md index 99d61b1..b2f302d 100644 --- a/examples/README_RU.md +++ b/examples/README_RU.md @@ -1,5 +1,29 @@ # Примеры использования +## Быстрый старт + +1. Клонируйте репозиторий: + ```bash + git clone https://github.com/ChrisLisbon/TorchCNNBuilder.git + cd TorchCNNBuilder + +2. Установка в режиме разработки (рекомендуется): + ```bash + pip install -e . + +**Это позволит**: установить все необходимые зависимости, сделать пакет доступным системе, +видеть изменения в коде без переустановки. + +3. Только для запуска примеров (без разработки): + + ```bash + pip install numpy torch matplotlib jupyter + +4. ⚠️ Важно! Примеры используют относительные пути к данным. +Всегда запускайте ноутбуки из корня репозитория: + ```bash + jupyter notebook examples/имя_примера.ipynb + ## Примеры работы с компонентами библиотеки Примеры обращения в API для каждого подмодуля расположены в соответствующих файлах `ipynb`: - [`torchcnnbuilder`](usage_examples/main_examples_ru.ipynb) - основные переменные и мат. аппартат сверток diff --git a/examples/anime_example.ipynb b/examples/anime_example.ipynb index 3b97312..6e39c42 100644 --- a/examples/anime_example.ipynb +++ b/examples/anime_example.ipynb @@ -9,7 +9,6 @@ { "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, "source": [ "!pip install numpy\n", @@ -17,7 +16,8 @@ "!pip install matplotlib \n", "!pip install pillow" ], - "id": "9a0fa490fe399727" + "id": "9a0fa490fe399727", + "outputs": [] }, { "metadata": {}, diff --git a/examples/anime_example_ru.ipynb b/examples/anime_example_ru.ipynb index 914fe2e..6295778 100644 --- a/examples/anime_example_ru.ipynb +++ b/examples/anime_example_ru.ipynb @@ -47,8 +47,8 @@ "id": "e6a3d5d05db5d1ab", "metadata": { "ExecuteTime": { - "end_time": "2025-07-01T13:28:21.510394Z", - "start_time": "2025-07-01T13:28:21.372396Z" + "end_time": "2025-08-07T15:26:29.602405Z", + "start_time": "2025-08-07T15:26:29.491405Z" } }, "source": [ @@ -94,8 +94,8 @@ "id": "61165453374fda73", "metadata": { "ExecuteTime": { - "end_time": "2025-07-01T13:28:44.614031Z", - "start_time": "2025-07-01T13:28:44.113957Z" + "end_time": "2025-08-07T15:26:30.165543Z", + "start_time": "2025-08-07T15:26:29.743406Z" } }, "source": [ @@ -148,8 +148,8 @@ "id": "4fdf405ba3465604", "metadata": { "ExecuteTime": { - "end_time": "2025-07-01T13:30:29.858767Z", - "start_time": "2025-07-01T13:30:28.296769Z" + "end_time": "2025-08-07T15:26:32.311631Z", + "start_time": "2025-08-07T15:26:31.071571Z" } }, "source": [ @@ -173,8 +173,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2025-07-01T13:31:15.123617Z", - "start_time": "2025-07-01T13:31:14.942092Z" + "end_time": "2025-08-07T15:26:32.483645Z", + "start_time": "2025-08-07T15:26:32.312634Z" } }, "cell_type": "code", @@ -203,8 +203,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T14:13:30.181383Z", - "start_time": "2024-10-14T14:13:29.281678Z" + "end_time": "2025-08-07T15:26:34.038192Z", + "start_time": "2025-08-07T15:26:33.359231Z" } }, "cell_type": "code", @@ -222,8 +222,8 @@ "epochs_list = []" ], "id": "5bb4b425f1a33233", - "execution_count": 5, - "outputs": [] + "outputs": [], + "execution_count": 5 }, { "metadata": {}, @@ -234,8 +234,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T14:25:59.822849Z", - "start_time": "2024-10-14T14:19:12.883444Z" + "end_time": "2025-08-07T15:33:42.113459Z", + "start_time": "2025-08-07T15:26:35.837073Z" } }, "cell_type": "code", @@ -296,8 +296,30 @@ "print(f'time spent: {end-start}')" ], "id": "1075054a695b6ee0", - "execution_count": 10, - "outputs": [] + "outputs": [ + { + "data": { + "text/plain": [ + " 0%| | 0/100000 [00:00, ?it/s]" + ], + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "9ff4f1a53bf04bb1bf3beec9393477de" + } + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "time spent: 426.2163863182068\n" + ] + } + ], + "execution_count": 6 }, { "metadata": {}, diff --git a/examples/moving_mnist_example.ipynb b/examples/moving_mnist_example.ipynb index cf996b7..3fa0ac1 100644 --- a/examples/moving_mnist_example.ipynb +++ b/examples/moving_mnist_example.ipynb @@ -27,14 +27,62 @@ { "metadata": {}, "cell_type": "markdown", - "source": "#### MovingMnist dataset is benchmark for video forecasting task. It is presented by 1000 samples with 20 frames series with numbers which are moving on different trajectories. It can be loaded by [official link](https://www.cs.toronto.edu/~nitish/unsupervised_video/).", + "source": "#### MovingMnist dataset is benchmark for video forecasting task. It is presented by 1000 samples with 20 frames series with numbers which are moving on different trajectories. It can be loaded by [official link](https://www.cs.toronto.edu/~nitish/unsupervised_video/) or with code below.", "id": "3f77501b70f4d95b" }, { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T09:56:21.168973Z", - "start_time": "2024-10-14T09:56:16.776957Z" + "end_time": "2025-08-07T14:01:05.755920Z", + "start_time": "2025-08-07T13:59:03.246329Z" + } + }, + "cell_type": "code", + "source": [ + "import os\n", + "import urllib.request\n", + "import numpy as np\n", + "\n", + "# Create data directory if it doesn't exist\n", + "os.makedirs('data', exist_ok=True)\n", + "\n", + "# Download the Moving MNIST dataset\n", + "url = 'https://www.cs.toronto.edu/~nitish/unsupervised_video/mnist_test_seq.npy'\n", + "filename = 'data/moving_mnist.npy'\n", + "\n", + "if not os.path.exists(filename):\n", + " print(\"Downloading Moving MNIST dataset...\")\n", + " urllib.request.urlretrieve(url, filename)\n", + " print(\"Download complete!\")\n", + "else:\n", + " print(\"Dataset already exists, skipping download.\")\n", + "\n", + "# Load the data to verify it works\n", + "try:\n", + " data = np.load(filename)\n", + " print(f\"Dataset loaded successfully! Shape: {data.shape}\")\n", + "except Exception as e:\n", + " print(f\"Error loading dataset: {e}\")" + ], + "id": "2d5cbe608bd88738", + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Downloading Moving MNIST dataset...\n", + "Download complete!\n", + "Dataset loaded successfully! Shape: (20, 10000, 64, 64)\n" + ] + } + ], + "execution_count": 3 + }, + { + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-07T14:02:36.638050Z", + "start_time": "2025-08-07T14:02:33.195270Z" } }, "cell_type": "code", @@ -47,8 +95,8 @@ "from torchcnnbuilder.models import ForecasterBase" ], "id": "31ed0de82a611c0e", - "execution_count": 1, - "outputs": [] + "outputs": [], + "execution_count": 4 }, { "metadata": {}, @@ -63,8 +111,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T09:56:23.661012Z", - "start_time": "2024-10-14T09:56:21.169973Z" + "end_time": "2025-08-07T14:02:40.601889Z", + "start_time": "2025-08-07T14:02:38.370207Z" } }, "cell_type": "code", @@ -82,8 +130,8 @@ "train_dataset = TensorDataset(tensor(train_features), tensor(train_target))" ], "id": "952753315f5e41c9", - "execution_count": 2, - "outputs": [] + "outputs": [], + "execution_count": 5 }, { "metadata": {}, @@ -94,8 +142,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T09:56:23.898013Z", - "start_time": "2024-10-14T09:56:23.662013Z" + "end_time": "2025-08-07T14:02:42.885612Z", + "start_time": "2025-08-07T14:02:42.681446Z" } }, "cell_type": "code", @@ -109,8 +157,16 @@ "model = model.to(device)" ], "id": "28b3c7ce2bf1a6f6", - "execution_count": 3, - "outputs": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Calculation on device: cuda\n" + ] + } + ], + "execution_count": 6 }, { "metadata": {}, @@ -121,8 +177,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2024-10-14T09:56:24.859588Z", - "start_time": "2024-10-14T09:56:23.899012Z" + "end_time": "2025-08-07T14:02:47.637744Z", + "start_time": "2025-08-07T14:02:46.822216Z" } }, "cell_type": "code", @@ -134,8 +190,8 @@ "criterion = nn.L1Loss()" ], "id": "865f21b5b683f464", - "execution_count": 4, - "outputs": [] + "outputs": [], + "execution_count": 7 }, { "metadata": {}, @@ -145,9 +201,11 @@ }, { "metadata": { + "jupyter": { + "is_executing": true + }, "ExecuteTime": { - "end_time": "2024-10-14T11:20:10.342587Z", - "start_time": "2024-10-14T09:56:24.861554Z" + "start_time": "2025-08-07T14:02:49.237682Z" } }, "cell_type": "code", @@ -186,8 +244,23 @@ "torch.save(model.state_dict(), f'mnist_{epochs}.pt')" ], "id": "aeddbfcb6a8d497c", - "execution_count": 5, - "outputs": [] + "outputs": [ + { + "data": { + "text/plain": [ + "Epoch: 0%| | 0/2000 [00:00, ?it/s]" + ], + "application/vnd.jupyter.widget-view+json": { + "version_major": 2, + "version_minor": 0, + "model_id": "8908c8df85534d1f8b1520e000877b85" + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "execution_count": null }, { "metadata": {}, @@ -197,13 +270,11 @@ }, { "metadata": { - "ExecuteTime": { - "end_time": "2024-10-14T11:20:10.517588Z", - "start_time": "2024-10-14T11:20:10.343587Z" + "jupyter": { + "is_executing": true } }, "cell_type": "code", - "execution_count": 6, "source": [ "plt.plot(epoches, losses)\n", "plt.grid()\n", @@ -213,7 +284,8 @@ "plt.show()" ], "id": "158e21693348b808", - "outputs": [] + "outputs": [], + "execution_count": null }, { "metadata": {}, @@ -226,9 +298,8 @@ }, { "metadata": { - "ExecuteTime": { - "end_time": "2024-10-14T11:59:32.768505Z", - "start_time": "2024-10-14T11:59:32.761515Z" + "jupyter": { + "is_executing": true } }, "cell_type": "code", @@ -240,8 +311,8 @@ "print('Data loaded')" ], "id": "7d5acbcc242f9257", - "execution_count": 9, - "outputs": [] + "outputs": [], + "execution_count": null }, { "metadata": {}, @@ -251,9 +322,8 @@ }, { "metadata": { - "ExecuteTime": { - "end_time": "2024-10-14T12:22:38.919526Z", - "start_time": "2024-10-14T12:22:35.939867Z" + "jupyter": { + "is_executing": true } }, "cell_type": "code", @@ -268,8 +338,8 @@ "print(f'Mean MAE for test set = {np.mean(l1_errors)}') " ], "id": "7ea14812103a9542", - "execution_count": 23, - "outputs": [] + "outputs": [], + "execution_count": null }, { "metadata": {}, @@ -279,9 +349,8 @@ }, { "metadata": { - "ExecuteTime": { - "end_time": "2024-10-14T12:23:16.961107Z", - "start_time": "2024-10-14T12:23:15.561655Z" + "jupyter": { + "is_executing": true } }, "cell_type": "code", @@ -298,8 +367,8 @@ " plt.show()" ], "id": "e18517cdad9b8f27", - "execution_count": 24, - "outputs": [] + "outputs": [], + "execution_count": null }, { "metadata": {}, diff --git a/examples/moving_mnist_example_ru.ipynb b/examples/moving_mnist_example_ru.ipynb index df4f346..e2a8f10 100644 --- a/examples/moving_mnist_example_ru.ipynb +++ b/examples/moving_mnist_example_ru.ipynb @@ -9,7 +9,6 @@ { "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, "source": [ "!pip install numpy\n", @@ -17,7 +16,8 @@ "!pip install matplotlib \n", "!pip install pytorch_msssim" ], - "id": "4cdbbb653ab416f3" + "id": "4cdbbb653ab416f3", + "outputs": [] }, { "metadata": {}, @@ -28,9 +28,42 @@ { "metadata": {}, "cell_type": "markdown", - "source": "#### Набор данных MovingMnist является классическим для задачи прогнозирования видео. Он представлен 1000 выборками с 20 сериями кадров с числами, движущимися по разным траекториям. Его можно загрузить по [официальной ссылке](https://www.cs.toronto.edu/~nitish/unsupervised_video/).", + "source": "#### Набор данных MovingMnist является классическим для задачи прогнозирования видео. Он представлен 1000 выборками с 20 сериями кадров с числами, движущимися по разным траекториям. Его можно загрузить по [официальной ссылке](https://www.cs.toronto.edu/~nitish/unsupervised_video/) или используя код следующей ячейки.", "id": "3f77501b70f4d95b" }, + { + "metadata": {}, + "cell_type": "code", + "outputs": [], + "execution_count": null, + "source": [ + "import os\n", + "import urllib.request\n", + "import numpy as np\n", + "\n", + "# Создаём директорию для данных, если её нет\n", + "os.makedirs('data', exist_ok=True)\n", + "\n", + "# Загружаем датасет Moving MNIST\n", + "url = 'https://www.cs.toronto.edu/~nitish/unsupervised_video/mnist_test_seq.npy'\n", + "filename = 'data/moving_mnist.npy'\n", + "\n", + "if not os.path.exists(filename):\n", + " print(\"Загрузка датасета Moving MNIST...\")\n", + " urllib.request.urlretrieve(url, filename)\n", + " print(\"Загрузка завершена!\")\n", + "else:\n", + " print(\"Датасет уже существует, загрузка не требуется.\")\n", + "\n", + "# Загружаем данные для проверки\n", + "try:\n", + " data = np.load(filename)\n", + " print(f\"Датасет успешно загружен! Размерность: {data.shape}\")\n", + "except Exception as e:\n", + " print(f\"Ошибка при загрузке датасета: {e}\")" + ], + "id": "bfbf130874b0a803" + }, { "metadata": { "ExecuteTime": { @@ -311,10 +344,10 @@ { "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, "source": "", - "id": "eb6e0b2e0a5a05ae" + "id": "eb6e0b2e0a5a05ae", + "outputs": [] } ], "metadata": { diff --git a/examples/synthetic_noise_examples/best_train.py b/examples/synthetic_noise_examples/best_train.py index 8715c8e..fa0861f 100644 --- a/examples/synthetic_noise_examples/best_train.py +++ b/examples/synthetic_noise_examples/best_train.py @@ -128,7 +128,7 @@ # iterations # ------------------------------------ # logging -exp_path = './best model/' +exp_path = 'best model/' log_print(logger, f'start {exp_path}') if not os.path.exists(exp_path): os.makedirs(exp_path) diff --git a/examples/synthetic_noise_examples/grid_train.py b/examples/synthetic_noise_examples/grid_train.py index 6d21c28..5c1df91 100644 --- a/examples/synthetic_noise_examples/grid_train.py +++ b/examples/synthetic_noise_examples/grid_train.py @@ -79,15 +79,19 @@ batch_size = 50 epochs = 2_000 -# iterations_path = './iterations - batchnorm L1 loss' -# iterations_path = './iterations - batchnorm SSIM loss' -# iterations_path = './iterations - batchnorm BCE loss' +""" + Each case can be run with future variables: -# iterations_path = './iterations - none L1 loss' -# iterations_path = './iterations - none SSIM loss' -# iterations_path = './iterations - none BCE loss' + iterations_path = 'iterations - batchnorm L1 loss' + iterations_path = 'iterations - batchnorm SSIM loss' + iterations_path = 'iterations - batchnorm BCE loss' + + iterations_path = 'iterations - none L1 loss' + iterations_path = 'iterations - none SSIM loss' + iterations_path = 'iterations - none BCE loss' +""" -iterations_path = './iterations - batchnorm SSIM + BCE loss' +iterations_path = 'iterations - batchnorm SSIM + BCE loss' model_type = { 'batchnorm': 'batchnorm', @@ -95,9 +99,12 @@ } loss_type = { - # 'L1 loss': nn.L1Loss(), - # 'SSIM loss': lambda x, y: 1 - ssim(x, y, data_range=1, size_average=True), - # 'BCE loss': nn.BCELoss(), + """ + Each type of loss can be tested with keys: + 'L1 loss': nn.L1Loss(), + 'SSIM loss': lambda x, y: 1 - ssim(x, y, data_range=1, size_average=True), + 'BCE loss': nn.BCELoss(), + """ 'SSIM + BCE loss': lambda x, y: 0.6 * nn.functional.binary_cross_entropy(x, y) + 0.4 * (1 - ssim(x, y, data_range=1, size_average=True)), } diff --git a/examples/synthetic_noise_examples/iterations/iterations - batchnorm BCE loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - batchnorm BCE loss/results.csv new file mode 100644 index 0000000..ef68f2a --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - batchnorm BCE loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +batchnorm BCE loss 0% 6.273781478401124e-05 0.001646813121624291 0.982297956943512 2024-02-29 23:48:03.550295 2024-03-01 01:25:51.375010 5867.824715 +batchnorm BCE loss 1% 4.559156478768638e-05 0.0008041798137128353 0.9919941425323486 2024-03-01 01:26:25.542105 2024-03-01 03:04:39.244339 5893.702234 +batchnorm BCE loss 3% 5.2396820083054156e-05 0.001052160863764584 0.9893621802330017 2024-03-01 03:05:13.849902 2024-03-01 04:43:27.686822 5893.83692 +batchnorm BCE loss 5% 4.3252483279106484e-05 0.0007810361566953361 0.9928851127624512 2024-03-01 04:44:02.421355 2024-03-01 06:22:15.206400 5892.785045 +batchnorm BCE loss 10% 6.153911613417694e-05 0.0012035571271553636 0.9879045486450195 2024-03-01 06:22:50.033465 2024-03-01 08:00:53.528541 5883.495076 +batchnorm BCE loss 25% 3.928426574256799e-05 0.0014094952493906021 0.9852403402328491 2024-03-01 08:01:28.449264 2024-03-01 09:39:54.570678 5906.121414 +batchnorm BCE loss 50% 4.010800220776981e-05 0.0018215322634205222 0.9824396371841431 2024-03-01 09:40:29.780687 2024-03-01 11:18:41.355554 5891.574867 diff --git a/examples/synthetic_noise_examples/iterations/iterations - batchnorm L1 loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - batchnorm L1 loss/results.csv new file mode 100644 index 0000000..188d116 --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - batchnorm L1 loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +batchnorm L1 loss 0% 0.0006915227358078857 0.0018220605561509728 0.9863409996032715 2024-02-28 23:29:22.741161 2024-02-29 01:06:16.787702 5814.046541 +batchnorm L1 loss 1% 0.0008468349388413712 0.002271840814501047 0.980649471282959 2024-02-29 01:06:50.851732 2024-02-29 02:44:46.981594 5876.129862 +batchnorm L1 loss 3% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-02-29 02:45:21.807343 2024-02-29 04:23:27.481336 5885.673993 +batchnorm L1 loss 5% 0.0008842984918411415 0.0022870972752571106 0.9813157320022583 2024-02-29 04:24:02.208523 2024-02-29 06:02:14.555386 5892.346863 +batchnorm L1 loss 10% 0.0009954969754476085 0.002158472780138254 0.9832056164741516 2024-02-29 06:02:49.408318 2024-02-29 07:40:48.146197 5878.737879 +batchnorm L1 loss 25% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-02-29 07:41:23.222486 2024-02-29 09:19:24.931029 5881.708543 +batchnorm L1 loss 50% 0.0006580391578749654 0.0024218689650297165 0.9807299971580505 2024-02-29 09:19:59.786525 2024-02-29 10:58:06.358221 5886.571696 diff --git a/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM + BCE loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM + BCE loss/results.csv new file mode 100644 index 0000000..420b332 --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM + BCE loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +batchnorm SSIM + BCE loss 0% 4.703331943327754e-05 0.001838005380704999 0.9809330701828003 2024-03-02 20:36:15.956414 2024-03-02 22:19:00.705427 6164.749013 +batchnorm SSIM + BCE loss 1% 3.037466730555104e-05 0.0009155301377177238 0.9914963841438293 2024-03-02 22:19:34.210268 2024-03-03 00:03:50.595418 6256.38515 +batchnorm SSIM + BCE loss 3% 2.5232639063324383e-05 0.00044404188520275056 0.9966683387756348 2024-03-03 00:04:25.094167 2024-03-03 01:48:24.496942 6239.402775 +batchnorm SSIM + BCE loss 5% 3.24266766168888e-05 0.0010295886313542724 0.9903817772865295 2024-03-03 01:48:58.875873 2024-03-03 03:33:18.452389 6259.576516 +batchnorm SSIM + BCE loss 10% 3.503804035016395e-05 0.0008685151115059853 0.9915258288383484 2024-03-03 03:33:53.143676 2024-03-03 05:18:02.300307 6249.156631 +batchnorm SSIM + BCE loss 25% 3.250510216498287e-05 0.0015450069913640618 0.9849971532821655 2024-03-03 05:18:37.352944 2024-03-03 07:03:00.412589 6263.059645 +batchnorm SSIM + BCE loss 50% 4.310883857431444e-05 0.0016315311659127474 0.9832671284675598 2024-03-03 07:03:35.811634 2024-03-03 08:47:47.289461 6251.477827 diff --git a/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM loss/results.csv new file mode 100644 index 0000000..2685212 --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - batchnorm SSIM loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +batchnorm SSIM loss 0% 7.380955580287128e-05 0.0015755696222186089 0.9880495071411133 2024-02-29 11:05:24.038480 2024-02-29 12:48:05.178528 6161.140048 +batchnorm SSIM loss 1% 4.0622578782349635e-05 0.0011767226969823241 0.9930772185325623 2024-02-29 12:48:39.172592 2024-02-29 14:32:32.963633 6233.791041 +batchnorm SSIM loss 3% 6.49283776058037e-05 0.0008349802810698748 0.996840238571167 2024-02-29 14:33:07.644379 2024-02-29 16:18:46.687580 6339.043201 +batchnorm SSIM loss 5% 3.676765525168214e-05 0.001172215910628438 0.9957174062728882 2024-02-29 16:19:22.559483 2024-02-29 18:03:59.435317 6276.875834 +batchnorm SSIM loss 10% 4.508645052660217e-05 0.0012195019517093897 0.9920879602432251 2024-02-29 18:04:35.183599 2024-02-29 19:48:17.554979 6222.37138 +batchnorm SSIM loss 25% 5.907159517503407e-05 0.0013627776643261313 0.9921279549598694 2024-02-29 19:48:53.330984 2024-02-29 21:32:36.477638 6223.146654 +batchnorm SSIM loss 50% 3.246033612830621e-05 0.001957215368747711 0.9851090908050537 2024-02-29 21:33:12.472984 2024-02-29 23:16:50.492203 6218.019219 diff --git a/examples/synthetic_noise_examples/iterations/iterations - none BCE loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - none BCE loss/results.csv new file mode 100644 index 0000000..501c55f --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - none BCE loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +none BCE loss 0% 0.00014217105744973485 5.0824422942241654e-05 0.9997283816337585 2024-03-02 11:21:11.978918 2024-03-02 12:06:03.418768 2691.43985 +none BCE loss 1% 1.62210540921251e-05 0.00010324227332603186 0.9988656640052795 2024-03-02 12:06:36.723048 2024-03-02 12:52:06.911076 2730.188028 +none BCE loss 3% 1.632212724769605e-05 7.058848859742284e-05 0.9993249773979187 2024-03-02 12:52:41.386730 2024-03-02 13:38:08.702311 2727.315581 +none BCE loss 5% 2.212522745098254e-05 0.00026588229229673743 0.9973129630088806 2024-03-02 13:38:43.169393 2024-03-02 14:24:07.035968 2723.866575 +none BCE loss 10% 4.5598061938757244e-05 0.000803257804363966 0.9910317063331604 2024-03-02 14:24:41.621593 2024-03-02 15:10:02.266847 2720.645254 +none BCE loss 25% 5.255417055066643e-05 0.0006481552845798433 0.994242250919342 2024-03-02 15:10:37.463800 2024-03-02 15:55:58.177609 2720.713809 +none BCE loss 50% 1.0958673018212132e-05 0.0011706402292475104 0.9869590401649475 2024-03-02 15:56:33.260425 2024-03-02 16:41:53.547253 2720.286828 diff --git a/examples/synthetic_noise_examples/iterations/iterations - none L1 loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - none L1 loss/results.csv new file mode 100644 index 0000000..aa10af0 --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - none L1 loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +none L1 loss 0% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-03-01 11:52:57.023520 2024-03-01 12:37:48.419661 2691.396141 +none L1 loss 1% 0.022502585055549886 0.021582068875432014 0.893893837928772 2024-03-01 12:38:21.550502 2024-03-01 13:23:39.856372 2718.30587 +none L1 loss 3% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-03-01 13:24:14.677875 2024-03-01 14:09:35.000082 2720.322207 +none L1 loss 5% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-03-01 14:10:09.374174 2024-03-01 14:55:32.400475 2723.026301 +none L1 loss 10% 0.021567698193072617 0.021108107641339302 0.8934774994850159 2024-03-01 14:56:07.095010 2024-03-01 15:41:29.083370 2721.98836 +none L1 loss 25% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-03-01 15:42:04.005717 2024-03-01 16:27:36.246395 2732.240678 +none L1 loss 50% 0.03489439727531539 0.03305785357952118 0.837907075881958 2024-03-01 16:28:11.163037 2024-03-01 17:13:33.075712 2721.912675 diff --git a/examples/synthetic_noise_examples/iterations/iterations - none SSIM loss/results.csv b/examples/synthetic_noise_examples/iterations/iterations - none SSIM loss/results.csv new file mode 100644 index 0000000..c30d514 --- /dev/null +++ b/examples/synthetic_noise_examples/iterations/iterations - none SSIM loss/results.csv @@ -0,0 +1,8 @@ +norm type loss type noise type loss value L1 val SSIM val start time end time duration (sec) +none SSIM loss 0% 0.04276175358974628 0.009667381644248962 0.9590610265731812 2024-03-01 23:44:22.992401 2024-03-02 00:32:22.717229 2879.724828 +none SSIM loss 1% 0.16940376493665907 0.03306145966053009 0.837907075881958 2024-03-02 00:32:56.647685 2024-03-02 01:21:16.601588 2899.953903 +none SSIM loss 3% 0.06629286803187291 0.01384272426366806 0.9346688985824585 2024-03-02 01:21:51.146235 2024-03-02 02:10:03.001645 2891.85541 +none SSIM loss 5% 0.07680332689148221 0.01579538732767105 0.9247464537620544 2024-03-02 02:10:37.503017 2024-03-02 02:58:58.781540 2901.278523 +none SSIM loss 10% 0.03503085740188346 0.008152404800057411 0.9626864790916443 2024-03-02 02:59:33.529340 2024-03-02 03:47:53.242856 2899.713516 +none SSIM loss 25% 0.16940376493665907 0.03306565061211586 0.837907075881958 2024-03-02 03:48:28.082701 2024-03-02 04:36:49.282679 2901.199978 +none SSIM loss 50% 0.1694031717064232 0.03307770565152168 0.837907075881958 2024-03-02 04:37:24.473840 2024-03-02 05:25:46.421643 2901.947803 diff --git a/examples/synthetic_noise_examples/results.ipynb b/examples/synthetic_noise_examples/results.ipynb index d301f1e..03deb41 100644 --- a/examples/synthetic_noise_examples/results.ipynb +++ b/examples/synthetic_noise_examples/results.ipynb @@ -9,7 +9,6 @@ { "metadata": {}, "cell_type": "code", - "outputs": [], "execution_count": null, "source": [ "!pip install pandas\n", @@ -17,7 +16,8 @@ "!pip install matplotlib\n", "!pip install seaborn" ], - "id": "ab526de0db4820b4" + "id": "ab526de0db4820b4", + "outputs": [] }, { "metadata": {}, @@ -26,10 +26,13 @@ "id": "b2694fc2e6fb149a" }, { - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-07T15:19:09.179179Z", + "start_time": "2025-08-07T15:19:09.165180Z" + } + }, "cell_type": "code", - "outputs": [], - "execution_count": 1, "source": [ "import pandas as pd\n", "import numpy as np\n", @@ -37,32 +40,151 @@ "import matplotlib.pyplot as plt\n", "import seaborn as sns" ], - "id": "c42bfc82-4867-48d7-9289-1ff2c4e30e8a" + "id": "c42bfc82-4867-48d7-9289-1ff2c4e30e8a", + "outputs": [], + "execution_count": 1 }, { "cell_type": "code", - "execution_count": 2, "id": "f1ad535d-e4c9-4f44-b43e-c78b33ed0b00", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-07T15:21:45.899779Z", + "start_time": "2025-08-07T15:21:45.891780Z" + } + }, "source": [ - "paths = ['./iterations - batchnorm L1 loss',\n", - " './iterations - batchnorm SSIM loss',\n", - " './iterations - batchnorm BCE loss',\n", - " './iterations - none L1 loss',\n", - " './iterations - none SSIM loss',\n", - " './iterations - none BCE loss',\n", - " './iterations - batchnorm SSIM + BCE loss']" - ] + "paths = ['iterations/iterations - batchnorm L1 loss',\n", + " 'iterations/iterations - batchnorm SSIM loss',\n", + " 'iterations/iterations - batchnorm BCE loss',\n", + " 'iterations/iterations - none L1 loss',\n", + " 'iterations/iterations - none SSIM loss',\n", + " 'iterations/iterations - none BCE loss',\n", + " 'iterations/iterations - batchnorm SSIM + BCE loss']" + ], + "outputs": [], + "execution_count": 4 }, { "cell_type": "code", - "execution_count": 3, "id": "ea3f369f-62fe-468e-b1c9-ba0a0350a062", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2025-08-07T15:21:47.790929Z", + "start_time": "2025-08-07T15:21:47.761928Z" + } + }, + "source": [ + "results = [pd.read_csv(f'{path}/results.csv', sep='\\t') for path in paths]\n", + "results = pd.concat(results).reset_index(drop=True)\n", + "results" + ], "outputs": [ { "data": { + "text/plain": [ + " norm type loss type noise type loss value L1 val SSIM val \\\n", + "0 batchnorm L1 loss 0% 0.000692 0.001822 0.986341 \n", + "1 batchnorm L1 loss 1% 0.000847 0.002272 0.980649 \n", + "2 batchnorm L1 loss 3% 0.034894 0.033058 0.837907 \n", + "3 batchnorm L1 loss 5% 0.000884 0.002287 0.981316 \n", + "4 batchnorm L1 loss 10% 0.000995 0.002158 0.983206 \n", + "5 batchnorm L1 loss 25% 0.034894 0.033058 0.837907 \n", + "6 batchnorm L1 loss 50% 0.000658 0.002422 0.980730 \n", + "7 batchnorm SSIM loss 0% 0.000074 0.001576 0.988050 \n", + "8 batchnorm SSIM loss 1% 0.000041 0.001177 0.993077 \n", + "9 batchnorm SSIM loss 3% 0.000065 0.000835 0.996840 \n", + "10 batchnorm SSIM loss 5% 0.000037 0.001172 0.995717 \n", + "11 batchnorm SSIM loss 10% 0.000045 0.001220 0.992088 \n", + "12 batchnorm SSIM loss 25% 0.000059 0.001363 0.992128 \n", + "13 batchnorm SSIM loss 50% 0.000032 0.001957 0.985109 \n", + "14 batchnorm BCE loss 0% 0.000063 0.001647 0.982298 \n", + "15 batchnorm BCE loss 1% 0.000046 0.000804 0.991994 \n", + "16 batchnorm BCE loss 3% 0.000052 0.001052 0.989362 \n", + "17 batchnorm BCE loss 5% 0.000043 0.000781 0.992885 \n", + "18 batchnorm BCE loss 10% 0.000062 0.001204 0.987905 \n", + "19 batchnorm BCE loss 25% 0.000039 0.001409 0.985240 \n", + "20 batchnorm BCE loss 50% 0.000040 0.001822 0.982440 \n", + "21 none L1 loss 0% 0.034894 0.033058 0.837907 \n", + "22 none L1 loss 1% 0.022503 0.021582 0.893894 \n", + "23 none L1 loss 3% 0.034894 0.033058 0.837907 \n", + "24 none L1 loss 5% 0.034894 0.033058 0.837907 \n", + "25 none L1 loss 10% 0.021568 0.021108 0.893477 \n", + "26 none L1 loss 25% 0.034894 0.033058 0.837907 \n", + "27 none L1 loss 50% 0.034894 0.033058 0.837907 \n", + "28 none SSIM loss 0% 0.042762 0.009667 0.959061 \n", + "29 none SSIM loss 1% 0.169404 0.033061 0.837907 \n", + "30 none SSIM loss 3% 0.066293 0.013843 0.934669 \n", + "31 none SSIM loss 5% 0.076803 0.015795 0.924746 \n", + "32 none SSIM loss 10% 0.035031 0.008152 0.962686 \n", + "33 none SSIM loss 25% 0.169404 0.033066 0.837907 \n", + "34 none SSIM loss 50% 0.169403 0.033078 0.837907 \n", + "35 none BCE loss 0% 0.000142 0.000051 0.999728 \n", + "36 none BCE loss 1% 0.000016 0.000103 0.998866 \n", + "37 none BCE loss 3% 0.000016 0.000071 0.999325 \n", + "38 none BCE loss 5% 0.000022 0.000266 0.997313 \n", + "39 none BCE loss 10% 0.000046 0.000803 0.991032 \n", + "40 none BCE loss 25% 0.000053 0.000648 0.994242 \n", + "41 none BCE loss 50% 0.000011 0.001171 0.986959 \n", + "42 batchnorm SSIM + BCE loss 0% 0.000047 0.001838 0.980933 \n", + "43 batchnorm SSIM + BCE loss 1% 0.000030 0.000916 0.991496 \n", + "44 batchnorm SSIM + BCE loss 3% 0.000025 0.000444 0.996668 \n", + "45 batchnorm SSIM + BCE loss 5% 0.000032 0.001030 0.990382 \n", + "46 batchnorm SSIM + BCE loss 10% 0.000035 0.000869 0.991526 \n", + "47 batchnorm SSIM + BCE loss 25% 0.000033 0.001545 0.984997 \n", + "48 batchnorm SSIM + BCE loss 50% 0.000043 0.001632 0.983267 \n", + "\n", + " start time end time duration (sec) \n", + "0 2024-02-28 23:29:22.741161 2024-02-29 01:06:16.787702 5814.046541 \n", + "1 2024-02-29 01:06:50.851732 2024-02-29 02:44:46.981594 5876.129862 \n", + "2 2024-02-29 02:45:21.807343 2024-02-29 04:23:27.481336 5885.673993 \n", + "3 2024-02-29 04:24:02.208523 2024-02-29 06:02:14.555386 5892.346863 \n", + "4 2024-02-29 06:02:49.408318 2024-02-29 07:40:48.146197 5878.737879 \n", + "5 2024-02-29 07:41:23.222486 2024-02-29 09:19:24.931029 5881.708543 \n", + "6 2024-02-29 09:19:59.786525 2024-02-29 10:58:06.358221 5886.571696 \n", + "7 2024-02-29 11:05:24.038480 2024-02-29 12:48:05.178528 6161.140048 \n", + "8 2024-02-29 12:48:39.172592 2024-02-29 14:32:32.963633 6233.791041 \n", + "9 2024-02-29 14:33:07.644379 2024-02-29 16:18:46.687580 6339.043201 \n", + "10 2024-02-29 16:19:22.559483 2024-02-29 18:03:59.435317 6276.875834 \n", + "11 2024-02-29 18:04:35.183599 2024-02-29 19:48:17.554979 6222.371380 \n", + "12 2024-02-29 19:48:53.330984 2024-02-29 21:32:36.477638 6223.146654 \n", + "13 2024-02-29 21:33:12.472984 2024-02-29 23:16:50.492203 6218.019219 \n", + "14 2024-02-29 23:48:03.550295 2024-03-01 01:25:51.375010 5867.824715 \n", + "15 2024-03-01 01:26:25.542105 2024-03-01 03:04:39.244339 5893.702234 \n", + "16 2024-03-01 03:05:13.849902 2024-03-01 04:43:27.686822 5893.836920 \n", + "17 2024-03-01 04:44:02.421355 2024-03-01 06:22:15.206400 5892.785045 \n", + "18 2024-03-01 06:22:50.033465 2024-03-01 08:00:53.528541 5883.495076 \n", + "19 2024-03-01 08:01:28.449264 2024-03-01 09:39:54.570678 5906.121414 \n", + "20 2024-03-01 09:40:29.780687 2024-03-01 11:18:41.355554 5891.574867 \n", + "21 2024-03-01 11:52:57.023520 2024-03-01 12:37:48.419661 2691.396141 \n", + "22 2024-03-01 12:38:21.550502 2024-03-01 13:23:39.856372 2718.305870 \n", + "23 2024-03-01 13:24:14.677875 2024-03-01 14:09:35.000082 2720.322207 \n", + "24 2024-03-01 14:10:09.374174 2024-03-01 14:55:32.400475 2723.026301 \n", + "25 2024-03-01 14:56:07.095010 2024-03-01 15:41:29.083370 2721.988360 \n", + "26 2024-03-01 15:42:04.005717 2024-03-01 16:27:36.246395 2732.240678 \n", + "27 2024-03-01 16:28:11.163037 2024-03-01 17:13:33.075712 2721.912675 \n", + "28 2024-03-01 23:44:22.992401 2024-03-02 00:32:22.717229 2879.724828 \n", + "29 2024-03-02 00:32:56.647685 2024-03-02 01:21:16.601588 2899.953903 \n", + "30 2024-03-02 01:21:51.146235 2024-03-02 02:10:03.001645 2891.855410 \n", + "31 2024-03-02 02:10:37.503017 2024-03-02 02:58:58.781540 2901.278523 \n", + "32 2024-03-02 02:59:33.529340 2024-03-02 03:47:53.242856 2899.713516 \n", + "33 2024-03-02 03:48:28.082701 2024-03-02 04:36:49.282679 2901.199978 \n", + "34 2024-03-02 04:37:24.473840 2024-03-02 05:25:46.421643 2901.947803 \n", + "35 2024-03-02 11:21:11.978918 2024-03-02 12:06:03.418768 2691.439850 \n", + "36 2024-03-02 12:06:36.723048 2024-03-02 12:52:06.911076 2730.188028 \n", + "37 2024-03-02 12:52:41.386730 2024-03-02 13:38:08.702311 2727.315581 \n", + "38 2024-03-02 13:38:43.169393 2024-03-02 14:24:07.035968 2723.866575 \n", + "39 2024-03-02 14:24:41.621593 2024-03-02 15:10:02.266847 2720.645254 \n", + "40 2024-03-02 15:10:37.463800 2024-03-02 15:55:58.177609 2720.713809 \n", + "41 2024-03-02 15:56:33.260425 2024-03-02 16:41:53.547253 2720.286828 \n", + "42 2024-03-02 20:36:15.956414 2024-03-02 22:19:00.705427 6164.749013 \n", + "43 2024-03-02 22:19:34.210268 2024-03-03 00:03:50.595418 6256.385150 \n", + "44 2024-03-03 00:04:25.094167 2024-03-03 01:48:24.496942 6239.402775 \n", + "45 2024-03-03 01:48:58.875873 2024-03-03 03:33:18.452389 6259.576516 \n", + "46 2024-03-03 03:33:53.143676 2024-03-03 05:18:02.300307 6249.156631 \n", + "47 2024-03-03 05:18:37.352944 2024-03-03 07:03:00.412589 6263.059645 \n", + "48 2024-03-03 07:03:35.811634 2024-03-03 08:47:47.289461 6251.477827 " + ], "text/html": [ "