HEMnet - Haematoxylin & Eosin and Molecular neural network
Description
A deep learning automated cancer diagnosis software using molecular labelling to improve pathological annotation of Haematoxylin and Eosin (H&E) stained tissue.
Installation
-
Docker
You can download and run the docker image using the following commands:
docker pull andrewsu1/hemnet docker run -it andrewsu1/hemnet -
Conda
Install Openslide (this is necessary to open whole slide images) - download it here
Create a conda environment from the
environment.ymlfileconda env create -f environment.yml conda activate HEMnet
Usage
Slide Preparation
Name slides in the format: slide_id_TP53 for TP53 slides and slide_id_HandE for H&E slides
The TP53 and HandE suffix is used by HEMnet to identify the stain used.
1. Generate training and testing datasets
a. Generate train dataset
python HEMnet_train_dataset.py -b /path/to/base/directory -s relative/path/to/slides -o relative/path/to/output/directory -t relative/path/to/template_slide.svs -v
b. Generate test dataset
python HEMnet_test_dataset.py -b /path/to/base/directory -s /relative/path/to/slides -o /relative/path/to/output/directory -t relative/path/to/template_slide -m tile_mag -a align_mag -c cancer_thresh -n non_cancer_thresh
Other parameters:
-tis the relative path to the template slide from which all other slides will be normalised against. The template slide should be the same for each step.-mis the tile magnification. e.g. if the input is10then the tiles will be output at 10x-ais the align magnification. Paired TP53 and H&E slides will be registered at this magnification. To reduce computation time we recommend this be less than the tile magnification - a five times downscale generally works well.-ccancer threshold to apply to the DAB channel. DAB intensities less than this threshold indicate cancer.-nnon-cancer threshold to apply to the DAB channel. DAB intensities greater than this threshold indicate no cancer.
2. Train and evaluate model
a. Training model
python train.py -b /path/to/base/directory -t relative/path/to/training_tile_directory -l relative/path/to/validation_tile_directory -o /relative/path/to/output/directory -m cnn_base -g num_gpus -e epochs -a batch_size -s -w -f -v
Other parameters:
-mis CNN base model. eg.resnet50,vgg16,vgg19,inception_v3andxception.-gis number of GPUs for training.-eis training epochs. Default is100epochs.-ais batch size. Default is32-sis option to save the trained model weights.-wis option to used transfer learning. Model will used pre-trained weights from ImageNet at the initial stage.-fis fine-tuning option. Model will re-train CNN base.
b. Test model prediction
python test.py -b /path/to/base/directory -t relative/path/to/test_tile_directory -o /relative/path/to/output/directory -w model_weights -m cnn_base -g num_gpus -v
Other parameters:
-wis path to trained model. eg.trained_model.h5.-mis CNN base model (same to training step).-gis number of GPUs for prediction.
c. Evaluate model performance and visualise model prediction
python visualisation.py -b /path/to/base/directory -t /relative/path/to/training_output_directory -p /relative/path/to/test_output_directory -o /relative/path/to/output/directory -i sample
Other parameters:
-tis path to training outputs.-pis path to test outputs.-iis name of Whole Slide Image for visualisation.
3. Apply model to diagnose new images
python HEMnet_inference.py -s '/path/to/new/HE/Slides/' -o '/path/to/output/directory/' -t '/path/to/template/slide/' -nn '/path/to/trained/model/' -v
Predict on TCGA images with our pretrained model for colorectal cancer using google colab
Results
Citing HEMnet
The Team
Please contact Dr Quan Nguyen (quan.nguyen@uq.edu.au), Andrew Su (a.su@uqconnect.edu.au), and Xiao Tan (xiao.tan@uqconnect.edu.au) for issues, suggestions, and we are very welcome to collaboration opportunities.
Metadata
Release files for HEMnet 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| HEMnet-1.0.0.tar.gz | 3.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| HEMnet-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / HEMnet-1.0.0.tar.gz
| Download URL | HEMnet-1.0.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6aac023efe1b1cff2d7b8fbd1a6f2c157adac00f3a66bc3fde64f42982ef1437
|
|
BLAKE2b-256 checksum How to use checksums |
75a7812515f9ce4c908aaab5850d4801f9e49703bc25627f94d598ca624daa0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.6
|
Release files / HEMnet-1.0.0-py3-none-any.whl
| Download URL | HEMnet-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
367e417dd9639ce41ae17f23dab79fd54e67eeb786fe60091cbea952a61aa7c7
|
|
BLAKE2b-256 checksum How to use checksums |
87df306349a9783a6ff24ce3df8761e9fae7637f2ee75343442d35df2477bdc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.6
|
Security for HEMnet 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.