Official TensorFlow implementation of the Fast Capsule Network proposed in the paper Fast CapsNet for Lung Cancer Screening.
Fig1. Fast Capsule Network architecture
- Python (2.7 preferably; also works fine with python 3)
- NumPy
- Tensorflow>=1.3
- Matplotlib (for saving images)
To run the code, you first need to store your data in a folder named 'data' inside the project folder. Given the current DataLoader code, it must be an HDF5 file containing train, validation and test sets.
Most of the network parameters can be found in config.py
file. You may modify them or run with
the default values which runs the 3D Fast Capsule Network proposed in the paper.
Training the model displays the training results and saves the trained model after each epoch if an improvement observed in the accuracy value.
- For training in the default setting:
python main.py
- Loading the model and continue training:
python main.py --reload_epoch=epoch_num
whereepoch_num
determines th model number to be reload (e.g. is epoch_num=3, it will load the model trained and stored after 3 epochs). - For training AlexNet network:
python main.py --model=alexnet --loss_type=cross_entropy --add_recon_loss=False
- For running the test:
python main.py --mode=test --reload_epoch=epoch_num
whereepoch_num
determines th model number to be reload (e.g. is epoch_num=3, it will load the model trained and stored after 3 epochs).