diff --git a/auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb b/auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb index 3f33be8905..472752d449 100644 --- a/auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb +++ b/auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb @@ -78,28 +78,35 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Task09_Spleen.tar: 1.50GB [00:43, 36.7MB/s] \n" + ] + }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 03:23:09,534 - INFO - Expected md5 is None, skip md5 check for file Task05_Prostate.tar.\n", - "2022-09-21 03:23:09,535 - INFO - File exists: Task05_Prostate.tar, skipped downloading.\n", - "2022-09-21 03:23:09,536 - INFO - Non-empty folder exists in Task05_Prostate, skipped extracting.\n" + "2022-09-29 03:49:02,357 - INFO - Downloaded: Task09_Spleen.tar\n", + "2022-09-29 03:49:02,359 - INFO - Expected md5 is None, skip md5 check for file Task09_Spleen.tar.\n", + "2022-09-29 03:49:02,359 - INFO - Writing into directory: ./.\n" ] } ], "source": [ "root = \"./\"\n", - "work_dir = os.path.join(root, 'auto3dseg_work_dir')\n", + "work_dir = os.path.join(root, 'ref_api_work_dir')\n", "if not os.path.isdir(work_dir):\n", " os.makedirs(work_dir)\n", "\n", - "msd_task = \"Task05_Prostate\"\n", + "msd_task = \"Task09_Spleen\"\n", "dataroot = os.path.join(root, msd_task)\n", - "datalist_file = \"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\"\n", + "datalist_file = os.path.join(\"..\", \"tasks\", \"msd\", msd_task, \"msd_\" + msd_task.lower() + \"_folds.json\")\n", "\n", "resource = \"https://msd-for-monai.s3-us-west-2.amazonaws.com/\" + msd_task + \".tar\"\n", "compressed_file = os.path.join(root, msd_task + \".tar\")\n", @@ -116,16 +123,16 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "data_src_cfg = {\n", - " \"name\": \"Task05_Prostate\",\n", - " \"task\": \"segmentation\",\n", - " \"modality\": \"MRI\",\n", - " \"datalist\": datalist_file,\n", - " \"dataroot\": dataroot,\n", + " \"name\": msd_task, # optional\n", + " \"task\": \"segmentation\", # optional\n", + " \"modality\": \"MRI\", # required\n", + " \"datalist\": datalist_file, # required\n", + " \"dataroot\": dataroot, # required\n", "}\n", "input = os.path.join(work_dir, 'input.yaml')\n", "ConfigParser.export_config_file(data_src_cfg, input)" @@ -152,21 +159,28 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 30/30 [00:04<00:00, 6.51it/s]\n" + "100%|██████████| 40/40 [01:34<00:00, 2.37s/it]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 03:23:29,492 - WARNING - Data is not completely uniform. MONAI transforms may provide unexpected result\n" + "2022-09-29 01:43:36,891 - WARNING - Data is not completely uniform. MONAI transforms may provide unexpected result\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" ] } ], @@ -183,7 +197,7 @@ "Besides the Python API call, user can also use command line interface (CLI) provided by the user's OS. One example is the following bash commands:\n", "\n", "```bash\n", - "python -m monai.apps.auto3dseg DataAnalyzer get_all_case_stats --datalist=\"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\" --dataroot=\"./Task05_Prostate\" --output_path=\"./auto3dseg_work_dir/data_stats.yaml\"\n", + "python -m monai.apps.auto3dseg DataAnalyzer get_all_case_stats --datalist=\"../tasks/msd/Task09_Spleen/msd_task09_spleen_folds.json\" --dataroot=\"./Task09_Spleen\" --output_path=\"./ref_api_work_dir/data_stats.yaml\"\n", "```" ] }, @@ -202,23 +216,23 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ - "algo_templates.tar.gz: 100%|██████████| 280k/280k [00:01<00:00, 241kB/s] " + "algo_templates.tar.gz: 100%|██████████| 280k/280k [00:00<00:00, 607kB/s] " ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 03:23:38,373 - INFO - Downloaded: /tmp/tmp8t3vbaz0/algo_templates.tar.gz\n", - "2022-09-21 03:23:38,375 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmp8t3vbaz0/algo_templates.tar.gz.\n", - "2022-09-21 03:23:38,377 - INFO - Writing into directory: ./auto3dseg_work_dir.\n" + "2022-09-29 01:43:37,829 - INFO - Downloaded: /tmp/tmpodiia3qq/algo_templates.tar.gz\n", + "2022-09-29 01:43:37,830 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmpodiia3qq/algo_templates.tar.gz.\n", + "2022-09-29 01:43:37,830 - INFO - Writing into directory: ./ref_api_work_dir.\n" ] }, { @@ -232,26 +246,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 03:23:38,856 - INFO - ./auto3dseg_work_dir/segresnet2d_0\n", - "2022-09-21 03:23:39,401 - INFO - ./auto3dseg_work_dir/segresnet2d_1\n", - "2022-09-21 03:23:39,823 - INFO - ./auto3dseg_work_dir/segresnet2d_2\n", - "2022-09-21 03:23:40,353 - INFO - ./auto3dseg_work_dir/segresnet2d_3\n", - "2022-09-21 03:23:40,776 - INFO - ./auto3dseg_work_dir/segresnet2d_4\n", - "2022-09-21 03:23:41,363 - INFO - ./auto3dseg_work_dir/dints_0\n", - "2022-09-21 03:23:41,846 - INFO - ./auto3dseg_work_dir/dints_1\n", - "2022-09-21 03:23:42,431 - INFO - ./auto3dseg_work_dir/dints_2\n", - "2022-09-21 03:23:42,914 - INFO - ./auto3dseg_work_dir/dints_3\n", - "2022-09-21 03:23:43,453 - INFO - ./auto3dseg_work_dir/dints_4\n", - "2022-09-21 03:23:43,868 - INFO - ./auto3dseg_work_dir/swinunetr_0\n", - "2022-09-21 03:23:44,361 - INFO - ./auto3dseg_work_dir/swinunetr_1\n", - "2022-09-21 03:23:44,779 - INFO - ./auto3dseg_work_dir/swinunetr_2\n", - "2022-09-21 03:23:45,297 - INFO - ./auto3dseg_work_dir/swinunetr_3\n", - "2022-09-21 03:23:45,711 - INFO - ./auto3dseg_work_dir/swinunetr_4\n", - "2022-09-21 03:23:46,255 - INFO - ./auto3dseg_work_dir/segresnet_0\n", - "2022-09-21 03:23:46,713 - INFO - ./auto3dseg_work_dir/segresnet_1\n", - "2022-09-21 03:23:47,168 - INFO - ./auto3dseg_work_dir/segresnet_2\n", - "2022-09-21 03:23:47,730 - INFO - ./auto3dseg_work_dir/segresnet_3\n", - "2022-09-21 03:23:48,280 - INFO - ./auto3dseg_work_dir/segresnet_4\n" + "2022-09-29 01:43:38,651 - INFO - ./ref_api_work_dir/segresnet2d_0\n", + "2022-09-29 01:43:39,029 - INFO - ./ref_api_work_dir/segresnet2d_1\n", + "2022-09-29 01:43:39,411 - INFO - ./ref_api_work_dir/segresnet2d_2\n", + "2022-09-29 01:43:39,916 - INFO - ./ref_api_work_dir/segresnet2d_3\n", + "2022-09-29 01:43:40,373 - INFO - ./ref_api_work_dir/segresnet2d_4\n", + "2022-09-29 01:43:41,656 - INFO - ./ref_api_work_dir/dints_0\n", + "2022-09-29 01:43:42,284 - INFO - ./ref_api_work_dir/dints_1\n", + "2022-09-29 01:43:42,678 - INFO - ./ref_api_work_dir/dints_2\n", + "2022-09-29 01:43:43,172 - INFO - ./ref_api_work_dir/dints_3\n", + "2022-09-29 01:43:43,681 - INFO - ./ref_api_work_dir/dints_4\n", + "2022-09-29 01:43:44,448 - INFO - ./ref_api_work_dir/swinunetr_0\n", + "2022-09-29 01:43:44,807 - INFO - ./ref_api_work_dir/swinunetr_1\n", + "2022-09-29 01:43:45,177 - INFO - ./ref_api_work_dir/swinunetr_2\n", + "2022-09-29 01:43:45,687 - INFO - ./ref_api_work_dir/swinunetr_3\n", + "2022-09-29 01:43:48,313 - INFO - ./ref_api_work_dir/swinunetr_4\n", + "2022-09-29 01:43:48,983 - INFO - ./ref_api_work_dir/segresnet_0\n", + "2022-09-29 01:43:49,597 - INFO - ./ref_api_work_dir/segresnet_1\n", + "2022-09-29 01:43:50,008 - INFO - ./ref_api_work_dir/segresnet_2\n", + "2022-09-29 01:43:50,393 - INFO - ./ref_api_work_dir/segresnet_3\n", + "2022-09-29 01:43:51,990 - INFO - ./ref_api_work_dir/segresnet_4\n" ] } ], @@ -290,7 +304,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -313,14 +327,14 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "{'num_iterations': 12000, 'num_iterations_per_validation': 6000, 'num_images_per_batch': 2, 'num_epochs': 2000, 'num_warmup_iterations': 6000}\n" + "{'num_iterations': 32000, 'num_iterations_per_validation': 16000, 'num_images_per_batch': 2, 'num_epochs': 2000, 'num_warmup_iterations': 16000}\n" ] } ], @@ -371,7 +385,7 @@ "source": [ "history = import_bundle_algo_history(work_dir, only_trained=False)\n", "for task in history:\n", - " for name, algo in task.items():\n", + " for _, algo in task.items():\n", " algo.train(train_param) # can use default params by `algo.train()`\n", " acc = algo.get_score()\n", " algo_to_pickle(algo, template_path=algo.template_path, best_metrics=acc)" @@ -461,7 +475,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.13" + "version": "3.8.12" }, "vscode": { "interpreter": { diff --git a/auto3dseg/notebooks/auto3dseg_hello_world.ipynb b/auto3dseg/notebooks/auto3dseg_hello_world.ipynb index 9c27619317..ad85b603e4 100644 --- a/auto3dseg/notebooks/auto3dseg_hello_world.ipynb +++ b/auto3dseg/notebooks/auto3dseg_hello_world.ipynb @@ -115,7 +115,7 @@ "metadata": {}, "outputs": [], "source": [ - "work_dir = \"./auto3dseg_work_dir\"\n", + "work_dir = \"./helloworld_work_dir\"\n", "if not os.path.isdir(work_dir):\n", " os.makedirs(work_dir)\n", "\n", @@ -183,7 +183,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## 2. Test the Auto3Dsseg AutoRunner pipeline\n", + "## 2. Test the Auto3DSeg AutoRunner pipeline\n", "\n", "AutoRunner provides an interface to run the Auot3Dseg pipeline. It will automatically configure four different neural networks and perform multi-fold training to achieve the state-of-the-art performance. The module is highly configurable, but only requires minimal user inputs. In this example, we want to complete the piepline in two minutes, so we need to have some customizations\n", "\n", diff --git a/auto3dseg/notebooks/auto_runner.ipynb b/auto3dseg/notebooks/auto_runner.ipynb index 84405c460f..5459e47985 100644 --- a/auto3dseg/notebooks/auto_runner.ipynb +++ b/auto3dseg/notebooks/auto_runner.ipynb @@ -69,29 +69,29 @@ "name": "stderr", "output_type": "stream", "text": [ - "Task05_Prostate.tar: 229MB [00:18, 12.9MB/s] \n" + "Task09_Spleen.tar: 1.50GB [00:53, 30.2MB/s] \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:43,880 - INFO - Downloaded: Task05_Prostate.tar\n", - "2022-09-21 05:37:43,880 - INFO - Expected md5 is None, skip md5 check for file Task05_Prostate.tar.\n", - "2022-09-21 05:37:43,881 - INFO - Non-empty folder exists in Task05_Prostate, skipped extracting.\n" + "2022-09-28 16:22:52,786 - INFO - Downloaded: Task09_Spleen.tar\n", + "2022-09-28 16:22:52,787 - INFO - Expected md5 is None, skip md5 check for file Task09_Spleen.tar.\n", + "2022-09-28 16:22:52,787 - INFO - Writing into directory: ./.\n" ] } ], "source": [ "root = \"./\"\n", - "msd_task = \"Task05_Prostate\"\n", + "msd_task = \"Task09_Spleen\"\n", "resource = \"https://msd-for-monai.s3-us-west-2.amazonaws.com/\" + msd_task + \".tar\"\n", "compressed_file = os.path.join(root, msd_task + \".tar\")\n", "if os.path.exists(root):\n", " download_and_extract(resource, compressed_file, root)\n", "\n", "dataroot = os.path.join(root, msd_task)\n", - "datalist = \"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\"" + "datalist_file = os.path.join(\"..\", \"tasks\", \"msd\", msd_task, \"msd_\" + msd_task.lower() + \"_folds.json\")" ] }, { @@ -108,11 +108,11 @@ "outputs": [], "source": [ "data_src_cfg = {\n", - " \"name\": \"Task05_Prostate\",\n", - " \"task\": \"segmentation\",\n", - " \"modality\": \"MRI\",\n", - " \"datalist\": datalist,\n", - " \"dataroot\": dataroot,\n", + " \"name\": msd_task, # optional\n", + " \"task\": \"segmentation\", # optional\n", + " \"modality\": \"MRI\", # required\n", + " \"datalist\": datalist_file, # required\n", + " \"dataroot\": dataroot, # required\n", "}\n", "input = './input.yaml'\n", "ConfigParser.export_config_file(data_src_cfg, input)" @@ -146,11 +146,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:51,714 - INFO - ./work_dir does not exists. Creating...\n", - "2022-09-21 05:37:51,717 - INFO - ./work_dir created to save all results\n", - "2022-09-21 05:37:51,719 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:37:51,729 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n", - "2022-09-21 05:37:51,731 - INFO - Directory /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output is created to save ensemble predictions\n" + "2022-09-28 16:23:12,874 - INFO - ./work_dir does not exists. Creating...\n", + "2022-09-28 16:23:12,876 - INFO - ./work_dir created to save all results\n", + "2022-09-28 16:23:12,894 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:12,901 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n", + "2022-09-28 16:23:12,904 - INFO - Directory /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output is created to save ensemble predictions\n" ] } ], @@ -175,8 +175,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:53,192 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:37:53,196 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:13,306 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:13,384 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -202,11 +202,11 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:54,640 - INFO - ./my_workspace does not exists. Creating...\n", - "2022-09-21 05:37:54,646 - INFO - ./my_workspace created to save all results\n", - "2022-09-21 05:37:54,649 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/input.yaml\n", - "2022-09-21 05:37:54,655 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/ensemble_output will be used to save ensemble predictions\n", - "2022-09-21 05:37:54,657 - INFO - Directory /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/ensemble_output is created to save ensemble predictions\n" + "2022-09-28 16:23:13,659 - INFO - ./my_workspace does not exists. Creating...\n", + "2022-09-28 16:23:13,661 - INFO - ./my_workspace created to save all results\n", + "2022-09-28 16:23:13,677 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/input.yaml\n", + "2022-09-28 16:23:13,682 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/ensemble_output will be used to save ensemble predictions\n", + "2022-09-28 16:23:13,690 - INFO - Directory /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/my_workspace/ensemble_output is created to save ensemble predictions\n" ] } ], @@ -235,9 +235,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:55,878 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:37:55,880 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:37:55,882 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:14,063 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:14,072 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:14,085 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -270,9 +270,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:56,914 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:37:56,916 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:37:56,923 - INFO - Directory ./output_dir is created to save ensemble predictions\n" + "2022-09-28 16:23:14,446 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:14,454 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:14,475 - INFO - Directory ./output_dir is created to save ensemble predictions\n" ] } ], @@ -298,9 +298,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:58,125 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:37:58,126 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:37:58,129 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:14,843 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:14,853 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:14,876 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -326,9 +326,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:37:59,788 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:37:59,793 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:37:59,805 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:15,270 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:15,390 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:16,052 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -363,7 +363,7 @@ "\n", "num_epoch = max_epochs\n", "num_images_per_batch = 2\n", - "files_train_fold0, _ = datafold_read(datalist, \"\", 0)\n", + "files_train_fold0, _ = datafold_read(datalist_file, \"\", 0)\n", "n_data = len(files_train_fold0)\n", "n_iter = int(num_epoch * n_data / num_images_per_batch / num_gpus)\n", "n_iter_val = int(n_iter / 2)\n", @@ -395,9 +395,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:38:03,548 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:38:03,553 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:38:03,564 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:16,886 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:16,899 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:16,977 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -423,9 +423,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:38:04,464 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:38:04,469 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:38:04,479 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:17,289 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:17,298 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:17,329 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -462,9 +462,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:38:05,959 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:38:05,961 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:38:05,965 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:17,663 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:17,746 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:17,765 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], @@ -506,9 +506,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:38:07,627 - INFO - Work directory ./work_dir is used to save all results\n", - "2022-09-21 05:38:07,630 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", - "2022-09-21 05:38:07,640 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" + "2022-09-28 16:23:18,053 - INFO - Work directory ./work_dir is used to save all results\n", + "2022-09-28 16:23:18,063 - INFO - Loading ./input.yaml for AutoRunner and making a copy in /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/input.yaml\n", + "2022-09-28 16:23:18,084 - INFO - The output_dir is not specified. /workspace/monai/tutorials-in-dev/auto3dseg/notebooks/work_dir/ensemble_output will be used to save ensemble predictions\n" ] } ], diff --git a/auto3dseg/notebooks/data_analyzer.ipynb b/auto3dseg/notebooks/data_analyzer.ipynb index fdb5194ea5..8dc86ba86a 100644 --- a/auto3dseg/notebooks/data_analyzer.ipynb +++ b/auto3dseg/notebooks/data_analyzer.ipynb @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -46,9 +46,7 @@ "\n", "from monai.apps import download_and_extract\n", "from monai.apps.auto3dseg import DataAnalyzer\n", - "from monai.data import create_test_image_3d\n", - "\n", - "from pprint import pprint" + "from monai.data import create_test_image_3d" ] }, { @@ -61,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -107,9 +105,17 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "data are generated and saved in this directory: /tmp/tmpiw4ai2hg\n" + ] + } + ], "source": [ "def simulate():\n", " test_dir = tempfile.TemporaryDirectory()\n", @@ -143,13 +149,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "100%|██████████| 20/20 [00:00<00:00, 28.26it/s]\n" + ] + } + ], "source": [ "analyser = DataAnalyzer(sim_datalist, sim_dataroot)\n", "datastat = analyser.get_all_case_stats()\n", - "pprint(datastat)" + "# pprint(datastat)" ] }, { @@ -170,31 +184,78 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "root dir is: ./\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Task05_Prostate.tar: 229MB [00:08, 27.4MB/s] \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2022-09-28 16:32:41,231 - INFO - Downloaded: Task05_Prostate.tar\n", + "2022-09-28 16:32:41,233 - INFO - Expected md5 is None, skip md5 check for file Task05_Prostate.tar.\n", + "2022-09-28 16:32:41,234 - INFO - Writing into directory: ./.\n" + ] + } + ], "source": [ - "root_dir = os.environ.get(\"MONAI_DATA_DIRECTORY\") # can also specify your own!\n", + "root_dir = './' # can also specify your own!\n", "print(f\"root dir is: {root_dir}\")\n", - "resource = \"https://msd-for-monai.s3-us-west-2.amazonaws.com/Task04_Hippocampus.tar\"\n", + "msd_task = \"Task05_Prostate\"\n", + "resource = \"https://msd-for-monai.s3-us-west-2.amazonaws.com/\" + msd_task + \".tar\"\n", "\n", - "compressed_file = os.path.join(root_dir, \"Task04_Hippocampus.tar\")\n", - "dataroot = os.path.join(root_dir, \"Task04_Hippocampus\")\n", + "compressed_file = os.path.join(root_dir, msd_task + \".tar\")\n", + "dataroot = os.path.join(root_dir, msd_task)\n", "if not os.path.exists(dataroot):\n", " download_and_extract(resource, compressed_file, root_dir)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "100%|██████████| 30/30 [00:07<00:00, 4.07it/s]" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2022-09-28 16:33:15,014 - WARNING - Data is not completely uniform. MONAI transforms may provide unexpected result\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n" + ] + } + ], "source": [ - "datalist = \"../tasks/msd/Task04_Hippocampus/msd_task04_hippocampus_folds.json\"\n", + "datalist_file = os.path.join(\"..\", \"tasks\", \"msd\", msd_task, \"msd_\" + msd_task.lower() + \"_folds.json\")\n", "\n", - "analyser = DataAnalyzer(datalist, dataroot)\n", + "analyser = DataAnalyzer(datalist_file, dataroot)\n", "datastat = analyser.get_all_case_stats()\n", - "pprint(datastat)" + "# pprint(datastat) # optionally you can print all the stats info " ] }, { @@ -203,12 +264,12 @@ "source": [ "### 2.2 Run the data analyzer in shell (via Python Fire)\n", "\n", - "If you have downloaded Task09_Spleen from previous step to your data directory `/worksapce/data`\n", + "If you have downloaded Task05_Prostate from previous step to your data directory `/workspace/data`, you can run the following in the terminal.\n", "\n", "```bash\n", "python monai.apps.auto3dseg DataAnalyzer get_all_case_stats \\\n", - " --datalist=\"../tasks/msd/Task04_Hippocampus/msd_task04_hippocampus_folds.json\" \\\n", - " --dataroot=\"/worksapce/data/Task04_Hippocampus\"\n", + " --datalist=\"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\" \\\n", + " --dataroot=\"/workspace/data/Task05_Prostate\"\n", "```\n" ] }, diff --git a/auto3dseg/notebooks/ensemble_byoc.ipynb b/auto3dseg/notebooks/ensemble_byoc.ipynb index 4bb2480f6d..48256dca3d 100644 --- a/auto3dseg/notebooks/ensemble_byoc.ipynb +++ b/auto3dseg/notebooks/ensemble_byoc.ipynb @@ -93,7 +93,7 @@ "}\n", "\n", "dataroot = os.path.join(\"./data\")\n", - "work_dir = os.path.join(\"./workdir\")\n", + "work_dir = os.path.join(\"./ensemble_byoc_work_dir\")\n", "\n", "da_output_yaml = os.path.join(work_dir, \"datastats.yaml\")\n", "data_src_cfg = os.path.join(work_dir, \"data_src_cfg.yaml\")\n", diff --git a/auto3dseg/notebooks/hpo_nni.ipynb b/auto3dseg/notebooks/hpo_nni.ipynb index f04c3e5cdc..6b8aeac473 100644 --- a/auto3dseg/notebooks/hpo_nni.ipynb +++ b/auto3dseg/notebooks/hpo_nni.ipynb @@ -6,7 +6,7 @@ "source": [ "# MONAI Auto3Dseg Hyper-parameter Optimization with NNI\n", "\n", - "This notebook provides an example to perform hype-parameter optimization(HPO) on learning rate with grid search method for prostate segmentation using NNI.\n", + "This notebook provides an example to perform hype-parameter optimization(HPO) on learning rate with grid search method for spleen segmentation using NNI.\n", "\n", "Note: if you have used other notebooks under `auto3dseg`, for examples: \n", "- `auto_runner.ipynb`\n", @@ -65,19 +65,19 @@ "metadata": {}, "outputs": [], "source": [ - "# User created files\n", - "datalist_file = \"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\"\n", - "input_yaml = './input.yaml'\n", - "nni_yaml = './nni_config.yaml'\n", - "\n", "# Dataset pathes\n", "data_root = \"./\"\n", - "msd_task = \"Task05_Prostate\"\n", + "msd_task = \"Task09_Spleen\"\n", "dataroot = os.path.join(data_root, msd_task)\n", "\n", + "# User created files\n", + "datalist_file = os.path.join(\"..\", \"tasks\", \"msd\", msd_task, \"msd_\" + msd_task.lower() + \"_folds.json\")\n", + "input_yaml = './input.yaml'\n", + "nni_yaml = './nni_config.yaml'\n", + "\n", "# Experiment setup\n", "test_path = \"./\"\n", - "work_dir = os.path.join(test_path, \"workdir\")\n", + "work_dir = os.path.join(test_path, \"hpo_nni_work_dir\")\n", "datastats_file = os.path.join(work_dir, \"datastats.yaml\")\n", "if not os.path.isdir(work_dir):\n", " os.makedirs(work_dir)\n", @@ -121,7 +121,7 @@ "outputs": [], "source": [ "input_dict = {\n", - " \"name\": \"Task05_Prostate\",\n", + " \"name\": msd_task,\n", " \"task\": \"segmentation\",\n", " \"modality\": \"MRI\",\n", " \"datalist\": datalist_file,\n", @@ -314,7 +314,7 @@ "outputs": [], "source": [ "nni_config = {\n", - " \"experimentName\": \"Task05_Prostate_lr\",\n", + " \"experimentName\": msd_task + \"_lr\",\n", " \"searchSpace\": {\n", " \"learning_rate\": {\n", " \"_type\": \"choice\",\n", diff --git a/auto3dseg/notebooks/hpo_optuna.ipynb b/auto3dseg/notebooks/hpo_optuna.ipynb index 780f39663c..dd5ec91da5 100644 --- a/auto3dseg/notebooks/hpo_optuna.ipynb +++ b/auto3dseg/notebooks/hpo_optuna.ipynb @@ -6,7 +6,7 @@ "source": [ "# MONAI Auto3Dseg Hyper-parameter Optimization with Optuna\n", "\n", - "This notebook provides an example to perform hype-parameter optimization(HPO) on learning rate with grid search method for prostate segmentation using Optuna.\n", + "This notebook provides an example to perform hype-parameter optimization(HPO) on learning rate with grid search method for spleen segmentation using Optuna.\n", "\n", "Note: if you have used other notebooks under `auto3dseg`, for examples: \n", "- `auto_runner.ipynb`\n", @@ -67,18 +67,18 @@ "metadata": {}, "outputs": [], "source": [ - "# User created files\n", - "datalist_file = \"../tasks/msd/Task05_Prostate/msd_task05_prostate_folds.json\"\n", - "input_yaml = './input.yaml'\n", - "\n", "# Dataset pathes\n", "data_root = \"./\"\n", - "msd_task = \"Task05_Prostate\"\n", + "msd_task = \"Task09_Spleen\"\n", "dataroot = os.path.join(data_root, msd_task)\n", "\n", + "# User created files\n", + "datalist_file = os.path.join(\"..\", \"tasks\", \"msd\", msd_task, \"msd_\" + msd_task.lower() + \"_folds.json\")\n", + "input_yaml = './input.yaml'\n", + "\n", "# Experiment setup\n", "test_path = \"./\"\n", - "work_dir = os.path.join(test_path, \"workdir\")\n", + "work_dir = os.path.join(test_path, \"hpo_optuna_work_dir\")\n", "optuna_dir = './optuna_learningrate_grid'\n", "da_output_yaml = os.path.join(work_dir, \"datastats.yaml\")\n", "if not os.path.isdir(work_dir):\n", @@ -123,7 +123,7 @@ "outputs": [], "source": [ "input_dict = {\n", - " \"name\": \"Task05_Prostate\",\n", + " \"name\": msd_task,\n", " \"task\": \"segmentation\",\n", " \"modality\": \"MRI\",\n", " \"datalist\": datalist_file,\n", @@ -152,16 +152,31 @@ "name": "stderr", "output_type": "stream", "text": [ - "algo_templates.tar.gz: 100%|██████████| 280k/280k [00:00<00:00, 409kB/s] " + "100%|██████████| 40/40 [01:33<00:00, 2.34s/it]" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:02:08,158 - INFO - Downloaded: /tmp/tmpma_e1296/algo_templates.tar.gz\n", - "2022-09-21 05:02:08,160 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmpma_e1296/algo_templates.tar.gz.\n", - "2022-09-21 05:02:08,162 - INFO - Writing into directory: ./workdir.\n" + "2022-09-28 17:08:51,151 - WARNING - Data is not completely uniform. MONAI transforms may provide unexpected result\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\n", + "algo_templates.tar.gz: 100%|██████████| 280k/280k [00:00<00:00, 341kB/s] " + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2022-09-28 17:08:52,165 - INFO - Downloaded: /tmp/tmpwptjcv79/algo_templates.tar.gz\n", + "2022-09-28 17:08:52,165 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmpwptjcv79/algo_templates.tar.gz.\n", + "2022-09-28 17:08:52,166 - INFO - Writing into directory: ./hpo_optuna_work_dir.\n" ] }, { @@ -175,26 +190,26 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:02:08,736 - INFO - ./workdir/segresnet2d_0\n", - "2022-09-21 05:02:09,301 - INFO - ./workdir/segresnet2d_1\n", - "2022-09-21 05:02:09,732 - INFO - ./workdir/segresnet2d_2\n", - "2022-09-21 05:02:10,163 - INFO - ./workdir/segresnet2d_3\n", - "2022-09-21 05:02:10,760 - INFO - ./workdir/segresnet2d_4\n", - "2022-09-21 05:02:11,198 - INFO - ./workdir/dints_0\n", - "2022-09-21 05:02:11,795 - INFO - ./workdir/dints_1\n", - "2022-09-21 05:02:12,253 - INFO - ./workdir/dints_2\n", - "2022-09-21 05:02:12,857 - INFO - ./workdir/dints_3\n", - "2022-09-21 05:02:13,294 - INFO - ./workdir/dints_4\n", - "2022-09-21 05:02:13,883 - INFO - ./workdir/swinunetr_0\n", - "2022-09-21 05:02:14,311 - INFO - ./workdir/swinunetr_1\n", - "2022-09-21 05:02:14,907 - INFO - ./workdir/swinunetr_2\n", - "2022-09-21 05:02:15,335 - INFO - ./workdir/swinunetr_3\n", - "2022-09-21 05:02:15,924 - INFO - ./workdir/swinunetr_4\n", - "2022-09-21 05:02:16,358 - INFO - ./workdir/segresnet_0\n", - "2022-09-21 05:02:16,955 - INFO - ./workdir/segresnet_1\n", - "2022-09-21 05:02:17,393 - INFO - ./workdir/segresnet_2\n", - "2022-09-21 05:02:17,994 - INFO - ./workdir/segresnet_3\n", - "2022-09-21 05:02:18,429 - INFO - ./workdir/segresnet_4\n" + "2022-09-28 17:08:59,605 - INFO - ./hpo_optuna_work_dir/segresnet2d_0\n", + "2022-09-28 17:09:01,295 - INFO - ./hpo_optuna_work_dir/segresnet2d_1\n", + "2022-09-28 17:09:03,774 - INFO - ./hpo_optuna_work_dir/segresnet2d_2\n", + "2022-09-28 17:09:04,496 - INFO - ./hpo_optuna_work_dir/segresnet2d_3\n", + "2022-09-28 17:09:05,354 - INFO - ./hpo_optuna_work_dir/segresnet2d_4\n", + "2022-09-28 17:09:06,206 - INFO - ./hpo_optuna_work_dir/dints_0\n", + "2022-09-28 17:09:07,010 - INFO - ./hpo_optuna_work_dir/dints_1\n", + "2022-09-28 17:09:09,408 - INFO - ./hpo_optuna_work_dir/dints_2\n", + "2022-09-28 17:09:12,231 - INFO - ./hpo_optuna_work_dir/dints_3\n", + "2022-09-28 17:09:14,473 - INFO - ./hpo_optuna_work_dir/dints_4\n", + "2022-09-28 17:09:15,362 - INFO - ./hpo_optuna_work_dir/swinunetr_0\n", + "2022-09-28 17:09:16,713 - INFO - ./hpo_optuna_work_dir/swinunetr_1\n", + "2022-09-28 17:09:20,002 - INFO - ./hpo_optuna_work_dir/swinunetr_2\n", + "2022-09-28 17:09:21,317 - INFO - ./hpo_optuna_work_dir/swinunetr_3\n", + "2022-09-28 17:09:23,820 - INFO - ./hpo_optuna_work_dir/swinunetr_4\n", + "2022-09-28 17:09:25,380 - INFO - ./hpo_optuna_work_dir/segresnet_0\n", + "2022-09-28 17:09:27,202 - INFO - ./hpo_optuna_work_dir/segresnet_1\n", + "2022-09-28 17:09:29,275 - INFO - ./hpo_optuna_work_dir/segresnet_2\n", + "2022-09-28 17:09:30,899 - INFO - ./hpo_optuna_work_dir/segresnet_3\n", + "2022-09-28 17:09:32,433 - INFO - ./hpo_optuna_work_dir/segresnet_4\n" ] } ], @@ -291,7 +306,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:02:26,086 - INFO - ./workdir/segresnet2d_0_override\n" + "2022-09-28 17:09:37,228 - INFO - ./hpo_optuna_work_dir/segresnet2d_0_override\n" ] } ], @@ -320,280 +335,192 @@ "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m[I 2022-09-21 05:02:34,103]\u001b[0m A new study created in memory with name: no-name-75cbf3b1-5be2-409d-8ce9-deff53ef4fcf\u001b[0m\n" + "\u001b[32m[I 2022-09-28 17:09:37,486]\u001b[0m A new study created in memory with name: no-name-a34b729c-9f06-4439-b528-5199836c43d3\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:02:34,129 - INFO - ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1\n", - "2022-09-21 05:02:34,130 - INFO - Launching: torchrun --nnodes=1 --nproc_per_node=2 ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/scripts/train.py run --config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_train.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/hyper_parameters.yaml' --learning_rate=0.1\n", - "2022-09-21 05:02:49,849 - INFO - CompletedProcess(args=['torchrun', '--nnodes=1', '--nproc_per_node=2', './optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/scripts/train.py', 'run', \"--config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_train.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/hyper_parameters.yaml'\", '--learning_rate=0.1'], returncode=0, stdout=b\"[info] number of GPUs: 2\n", - "2022-09-21 05:02:37,216 - Added key: store_based_barrier_key:1 to store for rank: 0\n", - "[info] number of GPUs: 2\n", - "2022-09-21 05:02:37,219 - Added key: store_based_barrier_key:1 to store for rank: 1\n", - "2022-09-21 05:02:37,219 - Rank 1: Completed store-based barrier for key:store_based_barrier_key:1 with 2 nodes.\n", - "[info] world_size: 2\n", - "train_files: 12\n", - "val_files: 3\n", - "2022-09-21 05:02:37,226 - Rank 0: Completed store-based barrier for key:store_based_barrier_key:1 with 2 nodes.\n", - "[info] world_size: 2\n", - "train_files: 12\n", - "val_files: 3\n", + "2022-09-28 17:09:39,227 - INFO - ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001\n", + "2022-09-28 17:09:39,241 - INFO - Launching: python ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/scripts/train.py run --config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/hyper_parameters.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_train.yaml' --learning_rate=0.001\n", + "2022-09-28 17:12:50,088 - INFO - CompletedProcess(args=['python', './optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/scripts/train.py', 'run', \"--config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/hyper_parameters.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.001/configs/transforms_train.yaml'\", '--learning_rate=0.001'], returncode=0, stdout=b\"[info] number of GPUs: 1\n", + "[info] world_size: 1\n", + "train_files: 32\n", + "val_files: 8\n", "num_epochs 2\n", "num_epochs_per_validation 1\n", - "[info] training from scratch[info] training from scratch\n", - "\n", + "[info] training from scratch\n", "[info] amp enabled\n", "----------\n", "epoch 1/2\n", - "learning rate is set to 0.1\n", - "[2022-09-21 05:02:41] 1/6, train_loss: 1.0905\n", - "2022-09-21 05:02:41,335 - Reducer buckets have been rebuilt in this iteration.\n", - "2022-09-21 05:02:41,397 - Reducer buckets have been rebuilt in this iteration.\n", - "[2022-09-21 05:02:41] 2/6, train_loss: 0.9335\n", - "[2022-09-21 05:02:41] 3/6, train_loss: 0.9259\n", - "[2022-09-21 05:02:41] 4/6, train_loss: 0.7882\n", - "[2022-09-21 05:02:41] 5/6, train_loss: 0.8243\n", - "[2022-09-21 05:02:41] 6/6, train_loss: 0.7466\n", - "epoch 1 average loss: 0.8917, best mean dice: -1.0000 at epoch -1\n", - "1 / 3 tensor([[0.0000, 0.0222]], device='cuda:1')\n", - "1 / 3 tensor([[0.0000, 0.0261]], device='cuda:0')\n", - "2 / 3 tensor([[0.0002, 0.0047]], device='cuda:1')\n", - "2 / 3 tensor([[0.0000, 0.0273]], device='cuda:0')\n", - "3 / 3 tensor([[0.0000, 0.0031]], device='cuda:1')\n", - "3 / 3 tensor([[0.0008, 0.0049]], device='cuda:0')\n", - "evaluation metric - class 1: 0.00017869639365623394\n", - "evaluation metric - class 2: 0.014721528937419256\n", - "avg_metric 0.007450112665537745\n", + "learning rate is set to 0.001\n", + "[2022-09-28 17:10:21] 1/16, train_loss: 0.8308\n", + "[2022-09-28 17:10:21] 2/16, train_loss: 0.8357\n", + "[2022-09-28 17:10:21] 3/16, train_loss: 0.7409\n", + "[2022-09-28 17:10:21] 4/16, train_loss: 0.8472\n", + "[2022-09-28 17:10:21] 5/16, train_loss: 0.7716\n", + "[2022-09-28 17:10:21] 6/16, train_loss: 0.8473\n", + "[2022-09-28 17:10:21] 7/16, train_loss: 0.8624\n", + "[2022-09-28 17:10:21] 8/16, train_loss: 0.7660\n", + "[2022-09-28 17:10:27] 9/16, train_loss: 0.7231\n", + "[2022-09-28 17:10:27] 10/16, train_loss: 0.8150\n", + "[2022-09-28 17:10:27] 11/16, train_loss: 0.8157\n", + "[2022-09-28 17:10:27] 12/16, train_loss: 0.7737\n", + "[2022-09-28 17:10:27] 13/16, train_loss: 0.7800\n", + "[2022-09-28 17:10:27] 14/16, train_loss: 0.7598\n", + "[2022-09-28 17:10:31] 15/16, train_loss: 0.7847\n", + "[2022-09-28 17:10:31] 16/16, train_loss: 0.7580\n", + "epoch 1 average loss: 0.7945, best mean dice: -1.0000 at epoch -1\n", + "1 / 8 tensor([[0.0232]], device='cuda:0')\n", + "2 / 8 tensor([[0.0230]], device='cuda:0')\n", + "3 / 8 tensor([[0.0052]], device='cuda:0')\n", + "4 / 8 tensor([[0.0066]], device='cuda:0')\n", + "5 / 8 tensor([[0.0135]], device='cuda:0')\n", + "6 / 8 tensor([[0.0088]], device='cuda:0')\n", + "7 / 8 tensor([[0.0101]], device='cuda:0')\n", + "8 / 8 tensor([[0.0118]], device='cuda:0')\n", + "evaluation metric - class 1: 0.012783133424818516\n", + "avg_metric 0.012783133424818516\n", "saved new best metric model\n", - "current epoch: 1 current mean dice: 0.0075 best mean dice: 0.0075 at epoch 1\n", + "current epoch: 1 current mean dice: 0.0128 best mean dice: 0.0128 at epoch 1\n", "----------\n", "epoch 2/2\n", - "learning rate is set to 0.0125\n", - "[2022-09-21 05:02:44] 1/6, train_loss: 0.7870\n", - "[2022-09-21 05:02:44] 2/6, train_loss: 0.7972\n", - "[2022-09-21 05:02:44] 3/6, train_loss: 0.7456\n", - "[2022-09-21 05:02:44] 4/6, train_loss: 0.7370\n", - "[2022-09-21 05:02:44] 5/6, train_loss: 0.7523\n", - "[2022-09-21 05:02:44] 6/6, train_loss: 0.7194\n", - "epoch 2 average loss: 0.7497, best mean dice: 0.0075 at epoch 1\n", - "1 / 3 tensor([[0.0000, 0.0100]], device='cuda:1')\n", - "1 / 3 tensor([[0.0000, 0.0112]], device='cuda:0')\n", - "2 / 3 tensor([[0.0000, 0.0033]], device='cuda:1')\n", - "2 / 3 tensor([[0.0000, 0.0158]], device='cuda:0')\n", - "3 / 3 tensor([[0.0000, 0.0094]], device='cuda:1')\n", - "3 / 3 tensor([[0.0000, 0.0012]], device='cuda:0')\n", - "evaluation metric - class 1: 0.0\n", - "evaluation metric - class 2: 0.008489210779468218\n", - "avg_metric 0.004244605389734109\n", - "current epoch: 2 current mean dice: 0.0042 best mean dice: 0.0075 at epoch 1\n", - "train completed, best_metric: 0.0075 at epoch: 1\n", - "0.007450112665537745\n", - "-1\n", - "\", stderr=b'WARNING:torch.distributed.run:\n", - "*****************************************\n", - "Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. \n", - "*****************************************\n", - "Modifying image pixdim from [0.6249999 0.6249999 3.6 1. ] to [ 0.62499988 0.62499988 3.5999999 152.06272679]\n", - "Modifying image pixdim from [0.75 0.74999964 2.9999986 1. ] to [ 0.75 0.74999965 2.99999861 157.50724574]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 149.7974827]\n", - "Modifying image pixdim from [0.6249998 0.625 3.5999987 1. ] to [ 0.62499983 0.625 3.59999877 153.34152766]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 151.21210251]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.84918933]\n", - "Modifying image pixdim from [0.6 0.6000003 4.0000024 1. ] to [ 0.60000002 0.60000034 4.00000227 149.31681629]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 180.81811432]\n", - "Modifying image pixdim from [0.625 0.625 3.59999 1. ] to [ 0.625 0.625 3.59998989 208.35237358]\n", - "Modifying image pixdim from [0.6 0.6000003 4.0000024 1. ] to [ 0.60000002 0.60000034 4.00000227 149.31681629]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.84918933]\n", - "Modifying image pixdim from [0.62499976 0.62499976 3.6 1. ] to [ 0.62499976 0.62499976 3.5999999 164.74616031]\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000043 128.8161199 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 150.20609596]\n", - "Modifying image pixdim from [0.604167 0.6041667 3.999998 1. ] to [ 0.60416698 0.60416671 3.99999799 174.60244975]\n", - "Modifying image pixdim from [0.6249998 0.625 3.5999987 1. ] to [ 0.62499983 0.625 3.59999877 153.34152766]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 152.3814254]\n", - "Modifying image pixdim from [0.75 0.7500001 4.0000005 1. ] to [ 0.75 0.75000013 4.00000043 128.6789431 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 154.70488398]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000041 174.1516677 ]\n", - "Modifying image pixdim from [0.75 0.7500001 4.0000005 1. ] to [ 0.75 0.75000013 4.00000043 128.6789431 ]\n", - "is_namedtuple is deprecated, please use the python checks instead\n", - "Modifying image pixdim from [0.6 0.5999997 3.999998 1. ] to [ 0.60000002 0.59999975 3.99999799 129.0477496 ]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 154.70488398]\n", - "is_namedtuple is deprecated, please use the python checks instead\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 173.25173679]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 170.38896694]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 149.1610426 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 151.7973753]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.67573396]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 154.70488398]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 173.25173679]\n", - "Modifying image pixdim from [0.75 0.7500001 4.0000005 1. ] to [ 0.75 0.75000013 4.00000043 128.6789431 ]\n", - "Modifying image pixdim from [0.6249998 0.625 3.5999987 1. ] to [ 0.62499983 0.625 3.59999877 153.34152766]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 154.70488398]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.6 0.5999997 3.999998 1. ] to [ 0.60000002 0.59999975 3.99999799 129.0477496 ]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000041 174.1516677 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 152.3814254]\n", - "Modifying image pixdim from [0.604167 0.6041667 3.999998 1. ] to [ 0.60416698 0.60416671 3.99999799 174.60244975]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.75 0.7500001 4.0000005 1. ] to [ 0.75 0.75000013 4.00000043 128.6789431 ]\n", - "')\n" + "learning rate is set to 6.25e-05\n", + "[2022-09-28 17:11:34] 1/16, train_loss: 0.7544\n", + "[2022-09-28 17:11:36] 2/16, train_loss: 0.8144\n", + "[2022-09-28 17:11:36] 3/16, train_loss: 0.8003\n", + "[2022-09-28 17:11:36] 4/16, train_loss: 0.7940\n", + "[2022-09-28 17:11:36] 5/16, train_loss: 0.7637\n", + "[2022-09-28 17:11:36] 6/16, train_loss: 0.8216\n", + "[2022-09-28 17:11:47] 7/16, train_loss: 0.7264\n", + "[2022-09-28 17:11:47] 8/16, train_loss: 0.8045\n", + "[2022-09-28 17:11:47] 9/16, train_loss: 0.7602\n", + "[2022-09-28 17:11:47] 10/16, train_loss: 0.8182\n", + "[2022-09-28 17:11:47] 11/16, train_loss: 0.8250\n", + "[2022-09-28 17:11:48] 12/16, train_loss: 0.7793\n", + "[2022-09-28 17:11:48] 13/16, train_loss: 0.7558\n", + "[2022-09-28 17:11:48] 14/16, train_loss: 0.7282\n", + "[2022-09-28 17:11:58] 15/16, train_loss: 0.7240\n", + "[2022-09-28 17:11:58] 16/16, train_loss: 0.8222\n", + "epoch 2 average loss: 0.7808, best mean dice: 0.0128 at epoch 1\n", + "1 / 8 tensor([[0.0241]], device='cuda:0')\n", + "2 / 8 tensor([[0.0193]], device='cuda:0')\n", + "3 / 8 tensor([[0.0025]], device='cuda:0')\n", + "4 / 8 tensor([[0.0060]], device='cuda:0')\n", + "5 / 8 tensor([[0.0138]], device='cuda:0')\n", + "6 / 8 tensor([[0.0090]], device='cuda:0')\n", + "7 / 8 tensor([[0.0102]], device='cuda:0')\n", + "8 / 8 tensor([[0.0121]], device='cuda:0')\n", + "evaluation metric - class 1: 0.01212325133383274\n", + "avg_metric 0.01212325133383274\n", + "current epoch: 2 current mean dice: 0.0121 best mean dice: 0.0128 at epoch 1\n", + "train completed, best_metric: 0.0128 at epoch: 1\n", + "0.012783133424818516\n", + "\", stderr=b'')\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m[I 2022-09-21 05:02:49,856]\u001b[0m Trial 0 finished with value: 0.007450112665537745 and parameters: {'learning_rate': 0.1}. Best is trial 0 with value: 0.007450112665537745.\u001b[0m\n" + "\u001b[32m[I 2022-09-28 17:12:50,109]\u001b[0m Trial 0 finished with value: 0.012783133424818516 and parameters: {'learning_rate': 0.001}. Best is trial 0 with value: 0.012783133424818516.\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2022-09-21 05:02:49,888 - INFO - ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001\n", - "2022-09-21 05:02:49,889 - INFO - Launching: torchrun --nnodes=1 --nproc_per_node=2 ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/scripts/train.py run --config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_train.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/hyper_parameters.yaml' --learning_rate=0.0001\n", - "2022-09-21 05:03:05,613 - INFO - CompletedProcess(args=['torchrun', '--nnodes=1', '--nproc_per_node=2', './optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/scripts/train.py', 'run', \"--config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_train.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.0001/configs/hyper_parameters.yaml'\", '--learning_rate=0.0001'], returncode=0, stdout=b\"[info] number of GPUs: 2\n", - "2022-09-21 05:02:52,934 - Added key: store_based_barrier_key:1 to store for rank: 0\n", - "[info] number of GPUs: 2\n", - "2022-09-21 05:02:52,956 - Added key: store_based_barrier_key:1 to store for rank: 1\n", - "2022-09-21 05:02:52,956 - Rank 1: Completed store-based barrier for key:store_based_barrier_key:1 with 2 nodes.\n", - "[info] world_size: 2\n", - "train_files: 12\n", - "val_files: 3\n", - "2022-09-21 05:02:52,965 - Rank 0: Completed store-based barrier for key:store_based_barrier_key:1 with 2 nodes.\n", - "[info] world_size: 2\n", - "train_files: 12\n", - "val_files: 3\n", + "2022-09-28 17:12:50,835 - INFO - ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1\n", + "2022-09-28 17:12:50,854 - INFO - Launching: python ./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/scripts/train.py run --config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/hyper_parameters.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_train.yaml' --learning_rate=0.1\n", + "2022-09-28 17:15:58,897 - INFO - CompletedProcess(args=['python', './optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/scripts/train.py', 'run', \"--config_file='./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/network.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_validate.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_infer.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/hyper_parameters.yaml','./optuna_learningrate_grid/segresnet2d_0_override_learning_rate_0.1/configs/transforms_train.yaml'\", '--learning_rate=0.1'], returncode=0, stdout=b\"[info] number of GPUs: 1\n", + "[info] world_size: 1\n", + "train_files: 32\n", + "val_files: 8\n", "num_epochs 2\n", "num_epochs_per_validation 1\n", "[info] training from scratch\n", "[info] amp enabled\n", - "[info] training from scratch\n", "----------\n", "epoch 1/2\n", - "learning rate is set to 0.0001\n", - "[2022-09-21 05:02:56] 1/6, train_loss: 0.8805\n", - "2022-09-21 05:02:56,638 - Reducer buckets have been rebuilt in this iteration.\n", - "2022-09-21 05:02:56,638 - Reducer buckets have been rebuilt in this iteration.\n", - "[2022-09-21 05:02:56] 2/6, train_loss: 0.8467\n", - "[2022-09-21 05:02:56] 3/6, train_loss: 0.8154\n", - "[2022-09-21 05:02:56] 4/6, train_loss: 0.8258\n", - "[2022-09-21 05:02:56] 5/6, train_loss: 0.8269\n", - "[2022-09-21 05:02:56] 6/6, train_loss: 0.8360\n", - "epoch 1 average loss: 0.8399, best mean dice: -1.0000 at epoch -1\n", - "1 / 3 tensor([[0.0000, 0.0190]], device='cuda:1')\n", - "1 / 3 tensor([[0.0004, 0.0546]], device='cuda:0')\n", - "2 / 3 tensor([[0.0004, 0.0085]], device='cuda:1')\n", - "2 / 3 tensor([[0.0004, 0.0420]], device='cuda:0')\n", - "3 / 3 tensor([[0.0000, 0.0038]], device='cuda:1')\n", - "3 / 3 tensor([[0.0004, 0.0262]], device='cuda:0')\n", - "evaluation metric - class 1: 0.0002538532135076821\n", - "evaluation metric - class 2: 0.025665201246738434\n", - "avg_metric 0.012959527230123058\n", + "learning rate is set to 0.1\n", + "[2022-09-28 17:13:16] 1/16, train_loss: 0.8703\n", + "[2022-09-28 17:13:18] 2/16, train_loss: 0.5976\n", + "[2022-09-28 17:13:18] 3/16, train_loss: 0.5378\n", + "[2022-09-28 17:13:19] 4/16, train_loss: 0.5376\n", + "[2022-09-28 17:13:24] 5/16, train_loss: 0.4907\n", + "[2022-09-28 17:13:24] 6/16, train_loss: 0.4620\n", + "[2022-09-28 17:13:24] 7/16, train_loss: 0.4707\n", + "[2022-09-28 17:13:24] 8/16, train_loss: 0.4943\n", + "[2022-09-28 17:13:24] 9/16, train_loss: 0.5291\n", + "[2022-09-28 17:13:24] 10/16, train_loss: 0.4435\n", + "[2022-09-28 17:13:24] 11/16, train_loss: 0.5396\n", + "[2022-09-28 17:13:35] 12/16, train_loss: 0.4222\n", + "[2022-09-28 17:13:45] 13/16, train_loss: 0.4728\n", + "[2022-09-28 17:13:45] 14/16, train_loss: 0.4565\n", + "[2022-09-28 17:13:45] 15/16, train_loss: 0.4522\n", + "[2022-09-28 17:13:45] 16/16, train_loss: 0.4394\n", + "epoch 1 average loss: 0.5135, best mean dice: -1.0000 at epoch -1\n", + "1 / 8 tensor([[0.]], device='cuda:0')\n", + "2 / 8 tensor([[0.]], device='cuda:0')\n", + "3 / 8 tensor([[0.]], device='cuda:0')\n", + "4 / 8 tensor([[0.]], device='cuda:0')\n", + "5 / 8 tensor([[0.]], device='cuda:0')\n", + "6 / 8 tensor([[0.]], device='cuda:0')\n", + "7 / 8 tensor([[0.]], device='cuda:0')\n", + "8 / 8 tensor([[0.]], device='cuda:0')\n", + "evaluation metric - class 1: 0.0\n", + "avg_metric 0.0\n", "saved new best metric model\n", - "current epoch: 1 current mean dice: 0.0130 best mean dice: 0.0130 at epoch 1\n", + "current epoch: 1 current mean dice: 0.0000 best mean dice: 0.0000 at epoch 1\n", "----------\n", "epoch 2/2\n", - "learning rate is set to 1.25e-05\n", - "[2022-09-21 05:02:59] 1/6, train_loss: 0.8542\n", - "[2022-09-21 05:02:59] 2/6, train_loss: 0.8045\n", - "[2022-09-21 05:02:59] 3/6, train_loss: 0.8148\n", - "[2022-09-21 05:02:59] 4/6, train_loss: 0.8437\n", - "[2022-09-21 05:02:59] 5/6, train_loss: 0.8132\n", - "[2022-09-21 05:02:59] 6/6, train_loss: 0.8232\n", - "epoch 2 average loss: 0.8347, best mean dice: 0.0130 at epoch 1\n", - "1 / 3 tensor([[0.0000, 0.0189]], device='cuda:1')\n", - "1 / 3 tensor([[0.0004, 0.0540]], device='cuda:0')\n", - "2 / 3 tensor([[0.0004, 0.0084]], device='cuda:1')\n", - "2 / 3 tensor([[0.0003, 0.0418]], device='cuda:0')\n", - "3 / 3 tensor([[0.0000, 0.0037]], device='cuda:1')\n", - "3 / 3 tensor([[0.0003, 0.0261]], device='cuda:0')\n", - "evaluation metric - class 1: 0.00023144491327305636\n", - "evaluation metric - class 2: 0.02548489471276601\n", - "avg_metric 0.012858169813019533\n", - "current epoch: 2 current mean dice: 0.0129 best mean dice: 0.0130 at epoch 1\n", - "train completed, best_metric: 0.0130 at epoch: 1\n", - "0.012959527230123058\n", - "-1\n", - "\", stderr=b'WARNING:torch.distributed.run:\n", - "*****************************************\n", - "Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. \n", - "*****************************************\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 152.3814254]\n", - "Modifying image pixdim from [0.6 0.6000003 4.0000024 1. ] to [ 0.60000002 0.60000034 4.00000227 149.31681629]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.62499976 0.62499976 3.6 1. ] to [ 0.62499976 0.62499976 3.5999999 164.74616031]\n", - "Modifying image pixdim from [0.625 0.62500006 3.6000001 1. ] to [ 0.625 0.62500005 3.60000016 168.35859116]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 180.81811432]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 202.45334114]\n", - "Modifying image pixdim from [0.6249999 0.6249999 3.6 1. ] to [ 0.62499988 0.62499988 3.5999999 152.06272679]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 173.25173679]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 151.21210251]\n", - "Modifying image pixdim from [0.6 0.5999997 3.999998 1. ] to [ 0.60000002 0.59999975 3.99999799 129.0477496 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 150.52861008]\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000043 128.8161199 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 150.20609596]\n", - "Modifying image pixdim from [0.6 0.6000003 4.0000024 1. ] to [ 0.60000002 0.60000034 4.00000227 149.31681629]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.84918933]\n", - "Modifying image pixdim from [0.75 0.74999964 2.9999986 1. ] to [ 0.75 0.74999965 2.99999861 157.50724574]\n", - "Modifying image pixdim from [0.625 0.625 3.59999 1. ] to [ 0.625 0.625 3.59998989 208.35237358]\n", - "Modifying image pixdim from [0.604167 0.6041667 3.999998 1. ] to [ 0.60416698 0.60416671 3.99999799 174.60244975]\n", - "Modifying image pixdim from [0.6249999 0.6249999 3.6 1. ] to [ 0.62499988 0.62499988 3.5999999 152.06272679]\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000041 174.1516677 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 149.7974827]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 148.64025265]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 142.87013615]\n", - "Modifying image pixdim from [0.6 0.5999997 3.999998 1. ] to [ 0.60000002 0.59999975 3.99999799 129.0477496 ]\n", - "Modifying image pixdim from [0.75 0.74999964 2.9999986 1. ] to [ 0.75 0.74999965 2.99999861 157.50724574]\n", - "is_namedtuple is deprecated, please use the python checks instead\n", - "is_namedtuple is deprecated, please use the python checks instead\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 170.38896694]\n", - "Modifying image pixdim from [0.625 0.625 3.60001 1. ] to [ 0.625 0.625 3.60000992 149.1610426 ]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 151.7973753]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.67573396]\n", - "Modifying image pixdim from [0.6 0.5999997 3.999998 1. ] to [ 0.60000002 0.59999975 3.99999799 129.0477496 ]\n", - "Modifying image pixdim from [0.6 0.60000014 4.0000005 1. ] to [ 0.60000002 0.60000017 4.00000041 174.1516677 ]\n", - "Modifying image pixdim from [0.6249999 0.6249999 3.6 1. ] to [ 0.62499988 0.62499988 3.5999999 152.06272679]\n", - "Modifying image pixdim from [0.604167 0.6041667 3.999998 1. ] to [ 0.60416698 0.60416671 3.99999799 174.60244975]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 149.7974827]\n", - "Modifying image pixdim from [0.625 0.625 3.59999 1. ] to [ 0.625 0.625 3.59998989 208.35237358]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 160.84918933]\n", - "no available indices of class 1 to crop, set the crop ratio of this class to zero.\n", - "no available indices of class 2 to crop, set the crop ratio of this class to zero.\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 142.87013615]\n", - "Modifying image pixdim from [0.6 0.6000003 4.0000024 1. ] to [ 0.60000002 0.60000034 4.00000227 149.31681629]\n", - "Modifying image pixdim from [0.75 0.74999964 2.9999986 1. ] to [ 0.75 0.74999965 2.99999861 157.50724574]\n", - "Modifying image pixdim from [0.625 0.625 3.6 1. ] to [ 0.625 0.625 3.5999999 148.64025265]\n", - "Modifying image pixdim from [0.75 0.74999964 2.9999986 1. ] to [ 0.75 0.74999965 2.99999861 157.50724574]\n", - "')\n" + "learning rate is set to 0.00625\n", + "[2022-09-28 17:14:45] 1/16, train_loss: 0.4742\n", + "[2022-09-28 17:14:46] 2/16, train_loss: 0.4236\n", + "[2022-09-28 17:14:54] 3/16, train_loss: 0.4167\n", + "[2022-09-28 17:14:54] 4/16, train_loss: 0.4362\n", + "[2022-09-28 17:14:54] 5/16, train_loss: 0.4146\n", + "[2022-09-28 17:14:54] 6/16, train_loss: 0.4438\n", + "[2022-09-28 17:14:54] 7/16, train_loss: 0.4268\n", + "[2022-09-28 17:14:54] 8/16, train_loss: 0.4431\n", + "[2022-09-28 17:14:54] 9/16, train_loss: 0.4792\n", + "[2022-09-28 17:15:05] 10/16, train_loss: 0.4439\n", + "[2022-09-28 17:15:07] 11/16, train_loss: 0.4807\n", + "[2022-09-28 17:15:07] 12/16, train_loss: 0.5427\n", + "[2022-09-28 17:15:07] 13/16, train_loss: 0.4717\n", + "[2022-09-28 17:15:07] 14/16, train_loss: 0.4180\n", + "[2022-09-28 17:15:07] 15/16, train_loss: 0.4512\n", + "[2022-09-28 17:15:07] 16/16, train_loss: 0.4235\n", + "epoch 2 average loss: 0.4494, best mean dice: 0.0000 at epoch 1\n", + "1 / 8 tensor([[0.]], device='cuda:0')\n", + "2 / 8 tensor([[0.]], device='cuda:0')\n", + "3 / 8 tensor([[0.]], device='cuda:0')\n", + "4 / 8 tensor([[0.]], device='cuda:0')\n", + "5 / 8 tensor([[0.]], device='cuda:0')\n", + "6 / 8 tensor([[0.]], device='cuda:0')\n", + "7 / 8 tensor([[0.]], device='cuda:0')\n", + "8 / 8 tensor([[0.]], device='cuda:0')\n", + "evaluation metric - class 1: 0.0\n", + "avg_metric 0.0\n", + "current epoch: 2 current mean dice: 0.0000 best mean dice: 0.0000 at epoch 1\n", + "train completed, best_metric: 0.0000 at epoch: 1\n", + "0.0\n", + "\", stderr=b'')\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ - "\u001b[32m[I 2022-09-21 05:03:05,620]\u001b[0m Trial 1 finished with value: 0.012959527230123058 and parameters: {'learning_rate': 0.0001}. Best is trial 1 with value: 0.012959527230123058.\u001b[0m\n" + "\u001b[32m[I 2022-09-28 17:15:59,029]\u001b[0m Trial 1 finished with value: 0.0 and parameters: {'learning_rate': 0.1}. Best is trial 0 with value: 0.012783133424818516.\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Best value: 0.012959527230123058 (params: {'learning_rate': 0.0001})\n", + "Best value: 0.012783133424818516 (params: {'learning_rate': 0.001})\n", "\n" ] }