Skip to content

Commit

Permalink
workaround for Project-MONAI#1542
Browse files Browse the repository at this point in the history
Signed-off-by: YunLiu <[email protected]>
  • Loading branch information
KumoLiu committed Apr 16, 2024
1 parent f534a1a commit 2177016
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 136 deletions.
2 changes: 1 addition & 1 deletion pathology/hovernet/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It also has torch version notebooks to run training and evaluation.

### 1. Data

CoNSeP datasets which are used in the examples can be downloaded from <https://warwick.ac.uk/fac/cross_fac/tia/data/HoVerNet/>.
CoNSeP datasets which are used in the examples can be downloaded from <https://opendatalab.com/OpenDataLab/CoNSeP>.

- First download CoNSeP dataset to `DATA_ROOT` (default is `"/workspace/Data/Pathology/CoNSeP"`).
- Run `python prepare_patches.py` to prepare patches from images.
Expand Down
10 changes: 2 additions & 8 deletions pathology/hovernet/hovernet_torch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
"source": [
"## Download dataset, prepare patch\n",
"Each user is responsible for checking the content of datasets and the applicable licenses and determining if suitable for the intended use.\n",
"1. download CoNSeP dataset\n",
"1. download CoNSeP dataset which can be downloaded form [ConSeP](https://opendatalab.com/OpenDataLab/CoNSeP)\n",
"2. run ./prepare_patches.py to prepare patches from images. \n",
" Similar to https://github.com/vqdang/hover_net/blob/master/extract_patches.py"
]
Expand All @@ -218,13 +218,7 @@
"metadata": {},
"outputs": [],
"source": [
"resource = \"https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip\"\n",
"md5 = \"a4fa18067849c536cba5fceee0427e81\"\n",
"\n",
"compressed_file = os.path.join(root_dir, \"consep_dataset.zip\")\n",
"data_dir = os.path.join(root_dir, \"CoNSeP\")\n",
"if not os.path.exists(data_dir):\n",
" download_and_extract(resource, compressed_file, root_dir, md5)"
"data_dir = os.path.join(root_dir, \"CoNSeP\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pathology/nuclick/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ It also has notebooks to run inference over trained (monai-zoo) model.

### 1. Data

Training these model requires data. Some public available datasets which are used in the examples can be downloaded from [ConSeP](https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet).
Training these model requires data. Some public available datasets which are used in the examples can be downloaded from [ConSeP](https://opendatalab.com/OpenDataLab/CoNSeP). Each user is responsible for checking the content of datasets and the applicable licenses and determining if suitable for the intended use.

### 2. Questions and bugs

Expand Down
39 changes: 2 additions & 37 deletions pathology/nuclick/nuclei_classification_infer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -249,43 +249,6 @@
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"consep_dataset.zip: 146MB [00:40, 3.76MB/s] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2022-12-06 10:50:51,968 - INFO - Downloaded: /tmp/tmpct_gfbvg/consep_dataset.zip\n",
"2022-12-06 10:50:51,970 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmpct_gfbvg/consep_dataset.zip.\n",
"2022-12-06 10:50:51,972 - INFO - Writing into directory: workspace.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"consep_zip = \"https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip\"\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"if not os.path.exists(consep_dir):\n",
" download_and_extract(consep_zip, output_dir=workspace_path)"
]
},
{
"cell_type": "code",
"execution_count": 8,
Expand All @@ -310,6 +273,8 @@
}
],
"source": [
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"image_file = os.path.join(consep_dir, \"Test\", \"Images\", \"test_12.png\")\n",
"label_mat = os.path.join(consep_dir, \"Test\", \"Labels\", \"test_12.mat\")\n",
"\n",
Expand Down
43 changes: 5 additions & 38 deletions pathology/nuclick/nuclei_classification_training_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -146,44 +146,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Configure Workspace Path"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"consep_dataset.zip: 146MB [00:23, 6.41MB/s] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2022-12-06 10:46:41,905 - INFO - Downloaded: /tmp/tmp834vb_2l/consep_dataset.zip\n",
"2022-12-06 10:46:41,907 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmp834vb_2l/consep_dataset.zip.\n",
"2022-12-06 10:46:41,910 - INFO - Writing into directory: workspace.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"consep_zip = \"https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip\"\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"if not os.path.exists(consep_dir):\n",
" download_and_extract(consep_zip, output_dir=workspace_path)"
"## Configure Workspace Path\n",
"The public available datasets which are used in the examples can be downloaded from [ConSeP](https://opendatalab.com/OpenDataLab/CoNSeP). Each user is responsible for checking the content of datasets and the applicable licenses and determining if suitable for the intended use."
]
},
{
Expand All @@ -204,6 +168,9 @@
}
],
"source": [
"# consep_dir points to the root directory of the consep dataset\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"IImage(filename=os.path.join(consep_dir, \"Train\", \"Overlay\", \"train_8.png\"))"
]
},
Expand Down
39 changes: 2 additions & 37 deletions pathology/nuclick/nuclick_infer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -247,43 +247,6 @@
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"consep_dataset.zip: 146MB [00:26, 5.86MB/s] "
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2022-12-06 10:38:08,238 - INFO - Downloaded: /tmp/tmp7_dupxgu/consep_dataset.zip\n",
"2022-12-06 10:38:08,239 - INFO - Expected md5 is None, skip md5 check for file /tmp/tmp7_dupxgu/consep_dataset.zip.\n",
"2022-12-06 10:38:08,241 - INFO - Writing into directory: workspace.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"consep_zip = \"https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip\"\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"if not os.path.exists(consep_dir):\n",
" download_and_extract(consep_zip, output_dir=workspace_path)"
]
},
{
"cell_type": "code",
"execution_count": 8,
Expand All @@ -309,6 +272,8 @@
}
],
"source": [
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"image_file = os.path.join(consep_dir, \"Test\", \"Images\", \"test_12.png\")\n",
"foreground = [[190, 15], [218, 32], [296, 96]]\n",
"\n",
Expand Down
18 changes: 4 additions & 14 deletions pathology/nuclick/nuclick_training_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,7 @@
"metadata": {},
"source": [
"## Configure Workspace Path\n",
"Please note this dataset is under noncommercial license. You may not use it for commercial purpose."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"consep_zip = \"https://warwick.ac.uk/fac/cross_fac/tia/data/hovernet/consep_dataset.zip\"\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"if not os.path.exists(consep_dir):\n",
" download_and_extract(consep_zip, output_dir=workspace_path)"
"The public available datasets which are used in the examples can be downloaded from [ConSeP](https://opendatalab.com/OpenDataLab/CoNSeP). Each user is responsible for checking the content of datasets and the applicable licenses and determining if suitable for the intended use."
]
},
{
Expand All @@ -182,6 +169,9 @@
}
],
"source": [
"# consep_dir points to the root directory of the consep dataset\n",
"consep_dir = os.path.join(workspace_path, \"CoNSeP\")\n",
"\n",
"IImage(filename=os.path.join(consep_dir, \"Train\", \"Overlay\", \"train_1.png\"))"
]
},
Expand Down

0 comments on commit 2177016

Please sign in to comment.