Downloads · 30 days
0
martinbadrous/Semantic-Segmentation-COVID-19
Semantic-Segmentation-COVID-19 is a image segmentation model from martinbadrous. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
U-Net based semantic segmentation of COVID-19 infected regions in lung CT scans.
Downloads · 30 days
0
Access
Public
Updated Feb 20, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py3.9 KB · 44%
From the Hugging Face model README
U-Net based semantic segmentation of COVID-19 infected regions in lung CT scans.
⚠️ For research and educational purposes only — not a medical device.
| 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 |
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.
| Metric | Score |
|---|---|
| Dice Coefficient | > 0.85 |
| Task | Binary segmentation (infected / healthy) |
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}%")
Martin Badrous — Computer Vision & Deep Learning Engineer