Automated lung segmentation in chest-x ray
Train pipeline: https://github.com/alimbekovKZ/lungs_segmentation_train
pip install lungs-segmentation
Jupyter notebook with the example:
model | best dice | Mb |
---|---|---|
resnet34 | 0.9657 | 103.4 |
densenet121 | 0.9655 | 62.8 |
Code example for resnet34:
from lungs_segmentation.pre_trained_models import create_model
import lungs_segmentation.inference as inference
model = create_model("resnet34")
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
plt.figure(figsize=(20,40))
plt.subplot(1,1,1)
image, mask = inference.inference(model,'739px-Chest_Xray_PA_3-8-2010.png', 0.2)
plt.imshow(inference.img_with_masks( image, [mask[0], mask[1]], alpha = 0.1))
Renat Alimbekov, Ivan Vassilenko, Abylaikhan Turlassov