π« U-Net β COVID-19 Lung CT Semantic Segmentation
U-Net based semantic segmentation of COVID-19 infected regions in lung CT scans.
β οΈ For research and educational purposes only β not a medical device.
π Model Summary
| Property | Details |
|---|---|
| ποΈ Architecture | U-Net |
| π― Task | Semantic Segmentation |
| πΌοΈ Input | Lung CT scan slices (grayscale) |
| π Output | Binary mask β infected vs. healthy tissue |
| π Input size | 256 Γ 256 px |
| βοΈ Framework | PyTorch |
| π License | MIT |
π§ What This Model Does
This U-Net model segments COVID-19 infected regions in lung CT scan slices, producing a binary mask that highlights infected tissue in red overlay.
It was developed as part of a deep learning research project exploring medical image analysis β combining classical encoder-decoder architecture with modern training techniques for robust segmentation performance.
π Performance
| Metric | Score |
|---|---|
| Dice Coefficient | > 0.85 |
| Task | Binary segmentation (infected / healthy) |
π How to Use
import torch
from torchvision import transforms
from PIL import Image
import numpy as np
# Load model
model = torch.jit.load("unet_model.pt", map_location="cpu")
model.eval()
# Preprocessing
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.Grayscale(),
transforms.ToTensor(),
transforms.Normalize([0.5], [0.5]),
])
# Inference
image = Image.open("ct_scan_slice.png")
tensor = transform(image).unsqueeze(0)
with torch.no_grad():
output = model(tensor)
mask = torch.sigmoid(output).squeeze().numpy()
# Binary mask
binary_mask = (mask > 0.5).astype(np.uint8) * 255
# Percentage of infected area
infected_pct = binary_mask.mean() / 255 * 100
print(f"Infected area: {infected_pct:.1f}%")
ποΈ Training Data
- Dataset: COVID-19 CT scan dataset (public research datasets)
- Input format: 256Γ256 greyscale CT slices
- Labels: Binary masks β infected lung regions vs. healthy tissue
β οΈ Limitations & Disclaimer
- Not a medical device β do not use for clinical diagnosis or treatment decisions
- Validated on research datasets only β not on clinical production data
- Performance may vary across different CT scanner manufacturers and imaging protocols
- Always consult qualified medical professionals for clinical interpretation
π Related Resources
- π€ Live Demo Space
- π» GitHub Repository
π€ Author
Martin Badrous β Computer Vision & Deep Learning Engineer