Skip to content

Commit 499dfdb

Browse files
authored
Update HoVerNet pipeline (#1101)
Fixes #. ### Description add training mode descriptions in README update prepare_patches.py change to "fast" mode ### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [ ] Notebook runs automatically `./runner [-p <regex_pattern>]` Signed-off-by: KumoLiu <[email protected]>
1 parent 3f12d3c commit 499dfdb

File tree

8 files changed

+940
-925
lines changed

8 files changed

+940
-925
lines changed

pathology/hovernet/README.MD

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# HoVerNet Examples
22

3-
This folder contains ignite version examples to run train and validate a HoVerNet model.
3+
This folder contains ignite version examples to run train and validate a HoVerNet [1] model.
44
It also has torch version notebooks to run training and evaluation.
55
<p align="center">
66
<img src="https://ars.els-cdn.com/content/image/1-s2.0-S1361841519301045-fx1_lrg.jpg" alt="HoVerNet scheme")
77
</p>
8-
implementation based on:
9-
10-
Simon Graham et al., HoVer-Net: Simultaneous Segmentation and Classification of Nuclei in Multi-Tissue Histology Images.' Medical Image Analysis, (2019). <https://arxiv.org/abs/1812.06499>
118

129
### 1. Data
1310

@@ -47,6 +44,8 @@ python ./prepare_patches.py \
4744
This example uses MONAI workflow to train a HoVerNet model on prepared CoNSeP dataset.
4845
Since HoVerNet is training via a two-stage approach. First initialized the model with pre-trained weights on the [ImageNet dataset](https://ieeexplore.ieee.org/document/5206848), trained only the decoders for the first 50 epochs, and then fine-tuned all layers for another 50 epochs. We need to specify `--stage` during training.
4946

47+
There are two training modes in total. If "original" mode is specified, it uses [270, 270] and [80, 80] for `patch_size` and `out_size` respectively. If "fast" mode is specified, it uses [256, 256] and [164, 164] for `patch_size` and `out_size` respectively. The results we show below are based on the "fast" model.
48+
5049
Each user is responsible for checking the content of models/datasets and the applicable licenses and determining if suitable for the intended use.
5150
The license for the pre-trained model used in examples is different than MONAI license. Please check the source where these weights are obtained from:
5251
<https://github.com/vqdang/hover_net#data-format>
@@ -78,7 +77,7 @@ torchrun --nnodes=1 --nproc_per_node=2 training.py --stage 1
7877
#### [HoVerNet Validation](./evaluation.py)
7978

8079
This example uses MONAI workflow to evaluate the trained HoVerNet model on prepared test data from CoNSeP dataset.
81-
With their metrics on original mode. We reproduce the results with Dice: 0.82762; PQ: 0.48976; F1d: 0.73592.
80+
Using this training pipeline in the "fast" mode, we have achieved the following metrics: Dice: 0.8329, PQ: 0.4977 and F1d: 0.7421.
8281

8382
```bash
8483
# Run to get all possible arguments
@@ -117,3 +116,7 @@ torchrun --nnodes=1 --nproc_per_node=2 ./inference.py
117116
## Disclaimer
118117

119118
This is an example, not to be used for diagnostic purposes.
119+
120+
## Reference
121+
[1] Simon Graham, Quoc Dang Vu, Shan E Ahmed Raza, Ayesha Azam, Yee Wah Tsang, Jin Tae Kwak, Nasir Rajpoot, Hover-Net: Simultaneous segmentation and classification of nuclei in multi-tissue histology images, Medical Image Analysis, 2019
122+
https://doi.org/10.1016/j.media.2019.101563

pathology/hovernet/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def main():
139139
parser.add_argument("--bs", type=int, default=16, dest="batch_size", help="batch size")
140140
parser.add_argument("--no-amp", action="store_false", dest="amp", help="deactivate amp")
141141
parser.add_argument("--classes", type=int, default=5, dest="out_classes", help="output classes")
142-
parser.add_argument("--mode", type=str, default="original", help="choose either `original` or `fast`")
142+
parser.add_argument("--mode", type=str, default="fast", help="choose either `original` or `fast`")
143143

144144
parser.add_argument("--cpu", type=int, default=8, dest="num_workers", help="number of workers")
145145
parser.add_argument("--use_gpu", type=bool, default=True, dest="use_gpu", help="whether to use gpu")

0 commit comments

Comments
 (0)