Skip to content

Auto3DSeg CI Test Errors Fix #961

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 61 additions & 47 deletions auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)"
Expand All @@ -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"
]
}
],
Expand All @@ -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",
"```"
]
},
Expand All @@ -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"
]
},
{
Expand All @@ -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"
]
}
],
Expand Down Expand Up @@ -290,7 +304,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -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"
]
}
],
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -461,7 +475,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.8.12"
},
"vscode": {
"interpreter": {
Expand Down
4 changes: 2 additions & 2 deletions auto3dseg/notebooks/auto3dseg_hello_world.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading