The project is a tool to build Bone Suppression model, written in tensorflow
Bone suppression is an autoencoder-like model for eliminating bone shadow from Chest X-ray images. The model require two types of dataset: normal and bone-suppression X-ray images. The target model can suppress bone shadow from Chest X-ray images, help Radiologists diagnose better lung related diseases. Although there are some softwares supporting bone suppression (ClearRead, CareStream), this project is a practical open source in computer vision and deep learning.
The project requires Python>=3.5
.
I have trained on an instance with 1 NVIDIA GTX 1080Ti (11GB VRAM)
and it takes approximately 14 hours.
JSRT
dataset in png
format, BSE_JSRT
dataset in png
format, and augmented
dataset which can be trained directly.data_registration
to true
, and the input images are read from source_dir
(JSRT) and target_dir
(BSE_JSRT). The registered images will be saved to registered_output_dir
into source
and target
subdirectories.data_augmentation
to true
, the source_dir
and target_dir
will be used to augment. The total data after augmentation for source/target
= augmentation_seed
X total number of images in source_dir
or target_dir
. The augmented images will be saved to source
and target
subdirectories of augmented_output_dir
with .png
extension.source_folder
and target_folder
are folders to load training images.use_trained_model
to true and trained_model
to your model path.output_model
is where you save your model during training and output_log
is where you save the tensorboard checkpoints.If you want to start testing without training from scratch, you can use the model I have trained. The model has loss value: 0.01409, MSE: 7.1687e-4, MS-SSIM: 0.01517
Note that currently this project can only be executed in Linux and macOS. You might run into some issues in Windows.
pip install -r requirements.txt
.python preprocessing.py
to preprocess dataset. If you want to change your config path:python preprocessing.py --config <config path>
python train.py
to train a new model. If you want to change your config path:python train.py --config <config path>
During training, you can use Tensorboard to visualize the results:
tensorboard --logdir=<output_log in train.cfg>
python test.py
to evaluate your model on specific image. To change default parameters, you can use:python test.py --model <model_path> --config <model config path> --input <image path> --output <output image path>
I would like to thank LoudeNOUGH for scratch training script and Hussam Habbreeh (حسام هب الريح) for sharing his experiences on this task.
Chuong M. Huynh ([email protected])
MIT