|
|
--- |
|
|
tags: |
|
|
- lung |
|
|
- segmentation |
|
|
- medical |
|
|
- medical-imaging |
|
|
- xray |
|
|
- pytorch |
|
|
--- |
|
|
# Model description |
|
|
|
|
|
This model performs automatic lung segmentation on chest X-ray images. |
|
|
It ouputs a binary lung mask that can be used as a preprocessing step before downstream tasks such as classification. |
|
|
|
|
|
This model was designed to focus the classifier on the lung region only, reducing background bias and improving interpretability. |
|
|
|
|
|
# Intended use |
|
|
|
|
|
- Automatic lung masking for chest X-ray images |
|
|
- Preprocessing step before a Covid-19 classification model |
|
|
- Research and educational purposes |
|
|
|
|
|
/!\ NOT intended for medical diagnosis or clinical use. |
|
|
|
|
|
# Model details |
|
|
- Framework : PyTorch |
|
|
- Model format : TorchScript (.pt) |
|
|
- Task : Image segmentation |
|
|
- Input : RGB chest X-ray image |
|
|
- Out put : Binary lung mask |
|
|
|
|
|
# Input format |
|
|
- Image size to 192x192 px |
|
|
- 3 channels (RGB) |
|
|
- Pixel values normalized to [0,1] |
|
|
|
|
|
# Output format |
|
|
- Single-channel binary mask |
|
|
- Vlaues in {0,1} |
|
|
- Can be resized back to original image size and applied as a mask |
|
|
|
|
|
# Example usage |
|
|
|
|
|
```python |
|
|
import torch |
|
|
|
|
|
model = torch.jit.load("mask_auto.pt", map_location="cpu") |
|
|
model.eval() |
|
|
|
|
|
with torch.no_grad(): |
|
|
mask = model(input_tensor) |
|
|
``` |
|
|
|
|
|
# Training data |
|
|
|
|
|
The model was trained in chest X-ray images with corresponding lung masks, from the public dataset : |
|
|
|
|
|
**COVID-19 Radiography Dataset (Kaggle)** |
|
|
|
|
|
https://www.kaggle.com/datasets/tawsifurrahman/covid19-radiography-database/data |
|
|
|
|
|
The dataset contains chest X-ray images labeled as COVID, Normal, Lung-Opacity and Viral Pneumonia. |
|
|
|
|
|
# Limitations |
|
|
- Performance may degrade on low-quality or non-frontal X-ray images |
|
|
- Trained on a specific data distribution; generalization is not guaranteed |
|
|
- Should not be used for clinical decision-making |
|
|
|
|
|
# Licence |
|
|
|
|
|
This model is shared for research and educational purposes. |
|
|
|
|
|
# Author |
|
|
|
|
|
Asma Sima |