SmartHisto is a Deep Bayesian Neural Network Framework that can be used to
- Train a bayesian model on annotated histopathology images.
- Identify structures on histopathology slices.
- Interact with pathologists in order to reduce annotation efforts during dataset aggregation.
You can clone this repository and run the scripts below.
You will need to install the torchbnn package from the git branch https://github.com/sriram98v/bayesian-neural-network-pytorch. See the README for instructions.
This section describes how to train a new model
In order to make predicitons you first need to train a model on your local dataset. Your training dataset must be restrucutured as follows:
└── Dataset
├── GT
│ ├── class 1
│ │ ├── 0.png
│ │ ├── 1000200.png
│ │ ├── 1000500.png
│ │ └── 1000800.png
│ ├── class 2
│ ├── class 3
│ ├── class 4
│ ├── class 5
. .
. .
└── images
├── 0.png
├── 1000200.png
├── 1000500.png
└── 1000800.png
Each of the images in the GT
directory is a binary image with true marked on the corresponding pixels.
With this directory structure, you can use the provided dataloaders. Custom datasets are described in the further below
In order to train a model on your dataset, you need to set up a training configuration. A default configuration can be generated by running
python gen_config.py
You can change this configuration file as per your system specifications.
You can now train a model by running
python Activetrain.py -c config.json
This will generate two new files which are model_config.json
and model.pth
. You will need both in order to make predicitons.
To make predictions, run predict.py with the arguments as directed in the help manual. You can see the help manual by running:
python predict.py --help
For example:
python predict.py -m ./Final_model.pth -i test_images/ -d cuda -c model_config.json
- @kumar-shridhar github:PyTorch-BayesianCNN
- @Harry-24k github: bayesian-neural-network-pytorch