All Projects → IlliaOvcharenko → lung-segmentation

IlliaOvcharenko / lung-segmentation

Licence: MIT license
Lung segmentation for chest X-Ray images

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to lung-segmentation

ResUNetPlusPlus-with-CRF-and-TTA
ResUNet++, CRF, and TTA for segmentation of medical images (IEEE JBIHI)
Stars: ✭ 98 (+32.43%)
Mutual labels:  image-segmentation, unet
Deep Unet For Satellite Image Segmentation
Satellite Imagery Feature Detection with SpaceNet dataset using deep UNet
Stars: ✭ 227 (+206.76%)
Mutual labels:  image-segmentation, unet
Pytorch Nested Unet
PyTorch implementation of UNet++ (Nested U-Net).
Stars: ✭ 416 (+462.16%)
Mutual labels:  image-segmentation, unet
Segmentation models
Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
Stars: ✭ 3,575 (+4731.08%)
Mutual labels:  image-segmentation, unet
Tf.keras Commonly Used Models
基于Tensorflow的常用模型,包括分类分割、新型激活、卷积模块,可在Tensorflow2.X下运行。
Stars: ✭ 115 (+55.41%)
Mutual labels:  image-segmentation, unet
Segmentation models.pytorch
Segmentation models with pretrained backbones. PyTorch.
Stars: ✭ 4,584 (+6094.59%)
Mutual labels:  image-segmentation, unet
Segmentationcpp
A c++ trainable semantic segmentation library based on libtorch (pytorch c++). Backbone: ResNet, ResNext. Architecture: FPN, U-Net, PAN, LinkNet, PSPNet, DeepLab-V3, DeepLab-V3+ by now.
Stars: ✭ 49 (-33.78%)
Mutual labels:  image-segmentation, unet
Brain-MRI-Segmentation
Smart India Hackathon 2019 project given by the Department of Atomic Energy
Stars: ✭ 29 (-60.81%)
Mutual labels:  image-segmentation, unet
Paddleseg
End-to-end image segmentation kit based on PaddlePaddle.
Stars: ✭ 1,244 (+1581.08%)
Mutual labels:  image-segmentation, unet
Multiclass Semantic Segmentation Camvid
Tensorflow 2 implementation of complete pipeline for multiclass image semantic segmentation using UNet, SegNet and FCN32 architectures on Cambridge-driving Labeled Video Database (CamVid) dataset.
Stars: ✭ 67 (-9.46%)
Mutual labels:  image-segmentation, unet
ResUNetPlusPlus
Official code for ResUNetplusplus for medical image segmentation (TensorFlow implementation) (IEEE ISM)
Stars: ✭ 69 (-6.76%)
Mutual labels:  image-segmentation, unet
Semantic Segmentation Of Remote Sensing Images
遥感图像的语义分割,基于深度学习,在Tensorflow框架下,利用TF.Keras,运行环境TF2.0+
Stars: ✭ 125 (+68.92%)
Mutual labels:  image-segmentation, unet
uformer-pytorch
Implementation of Uformer, Attention-based Unet, in Pytorch
Stars: ✭ 54 (-27.03%)
Mutual labels:  image-segmentation, unet
Keras Unet
Helper package with multiple U-Net implementations in Keras as well as useful utility tools helpful when working with image semantic segmentation tasks. This library and underlying tools come from multiple projects I performed working on semantic segmentation tasks
Stars: ✭ 196 (+164.86%)
Mutual labels:  image-segmentation, unet
TensorFlow-Advanced-Segmentation-Models
A Python Library for High-Level Semantic Segmentation Models based on TensorFlow and Keras with pretrained backbones.
Stars: ✭ 64 (-13.51%)
Mutual labels:  image-segmentation, unet
Pytorch Unet
Simple PyTorch implementations of U-Net/FullyConvNet (FCN) for image segmentation
Stars: ✭ 470 (+535.14%)
Mutual labels:  image-segmentation, unet
Unets
Implemenation of UNets for Lung Segmentation
Stars: ✭ 18 (-75.68%)
Mutual labels:  unet, xray
PyTorch-Segmentation-Zoo
A PyTorch collection of semantic segmentation tools.
Stars: ✭ 33 (-55.41%)
Mutual labels:  image-segmentation, unet
Unet Tensorflow
Tensorflow implement of U-Net
Stars: ✭ 50 (-32.43%)
Mutual labels:  image-segmentation, unet
Open Solution Salt Identification
Open solution to the TGS Salt Identification Challenge
Stars: ✭ 124 (+67.57%)
Mutual labels:  image-segmentation, unet

🇺🇦 Support Ukraine

"how to" instruction

🦉 Lung segmentation

Data and task description

data-example

Dataset consists of collected from public available chest X-Ray (CXR) images. Overall amount of images is 800 meanwhile labeled only 704 of them. Whole dataset was randomly divided into train (0.8 of total) validation (0.1 splited from train) and test parts. Splits were saved into splits.pk.

The main task is to implement pixel-wise segmentation on the available data to detect lung area. Download link on the dataset https://drive.google.com/file/d/1ffbbyoPf-I3Y0iGbBahXpWqYdGd7xxQQ/view.

Proposed solution

The most obvious solution for semantic segmentation problems is UNet - fully convolutional network with an encoder-decoder path. High-resolution features from the contracting path are combined with the upsampled output in order to predict more precise output based on this information, which is the main idea of this architecture.

Softmax function was applied to model output and negative log-likelihood loss was used to train network. Optimization criterion - Adam with 0.0005 learning rate.

Some kinds of data augmentation were used: horizontal and vertical shift, minor zoom and padding. All images and masks were resized to 512x512 size before passing the network. To improve performance was decided to use pretrained on ImageNet encoder from vgg11 network. This approach slightly improves performance and greatly accelerate network convergence. Vanilla unet configuration doesn't have batch normalization. Nowadays it is used almost every time, so it was added to improve network convergence too. Such network configuration outperforms other variations of unet without batch norm and pretrained weights on validation dataset so it was chosen for final evaluation

Networks were trained on a batch of 4 images during more than 50 epochs on average.

After 40 epoch network stops to improve validation score and network began to overfit.

Weights with best validation scores were saved into models/ folder. Weights description:

  • unet-2v: simple unet + augmentation
Best epoch
epoch: 30/200, time: 156.41338729858398, train loss: 0.047798131544717216, 
val loss: 0.06580803386474911, val jaccard: 0.9143155990985402, val dice: 0.9541912308910436
epochs: 159, overall time: 413.0m, mean epoch time: 156.15773498037325s
test loss: 0.0634, test jaccard: 0.9110, test dice: 0.9520
  • unet-6v: pretrained vgg11 encoder + batch_norm + bilinear upscale + augmentation
Best epoch
epoch: 44/100, time: 135.7923891544342, train loss: 0.04682422929955094, 
val loss: 0.06021084505737873, val jaccard: 0.9213985225610566, val dice: 0.9580973742301004
epochs: 100, overall time: 227.0m, mean epoch time: 136.41898714780808s
test loss: 0.0530, test jaccard: 0.9268, test dice: 0.9611

Implementation of the described above solution using PyTorch you could find in scr/ folder and main.ipynb notebook.

Evaluation

For evaluation of model output was Jaccard and Dice metrics, well known for such kind of computer vision tasks. Jaccard also is known as Intersection over Union, while Dice is the same with F1 measure. They are both showing almost the same things - overlap between ground truth and calculated mask.

The main disadvantage is that they consider only the number of true positives, false positives and false negatives and ignore predicted location. So, more reasonable is to use average contour distance and average surface distance. These metrics are not implemented yet, more information about them you could find in "Accurate Lung Segmentation via Network-WiseTraining of Convolutional Networks" preprint, check out references list.

Evaluation was performed on test dataset, which was not used during training phase.

There are the best-achived results: Jaccard score - 0.9268, Dice score - 0.9611.

Some you obtained results could see on the figure below.

obtained-results

Next steps

There are some future steps on the way to improve the current solution:

  • implement k-fold cross validation
  • use transposed convolution instead of bilinear upscaling
  • try more powerful encoder (i.e. resnet)

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].