Downloads · 30 days
10
3% of all-time downloads
Koushim/breast-cancer-swin-classifier
breast-cancer-swin-classifier is a machine learning model from Koushim. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This repository contains a fine-tuned Swin Transformer Tiny model from Hugging Face trained on a colorized CT and X-ray breast cancer dataset for binary classification. The model classifies images into:
Downloads · 30 days
10
3% of all-time downloads
All-time downloads
339
Public
Parameters
27.5M
221 MB on disk
Likes
2
Public
Click a slice to open those files.
.bin110 MB · 50%
How the weights are stored.
F3227.5M · 100%
From the Hugging Face model README
This repository contains a fine-tuned Swin Transformer Tiny model from Hugging Face trained on a colorized CT and X-ray breast cancer dataset for binary classification. The model classifies images into:
The dataset includes colorized medical images enhanced with advanced colorization techniques to aid diagnostic AI models and medical professionals.
Note: This dataset focuses on CT and X-ray images colorized with various methods to improve visual interpretation and enhance model training. The model does not include the dataset itself.
microsoft/swin-tiny-patch4-window7-224microsoft/swin-tiny-patch4-window7-224Image Preprocessing:
AutoImageProcessor for normalization and resizingtorchvision.transforms (horizontal/vertical flips, rotations, etc.)Data Loading:
torchvision.datasets.ImageFolder and wrapped in DataLoaderModel:
num_labels=2)Training:
Saving:
pytorch_model.bin| Metric | Value |
|---|---|
| Train Accuracy | 99.05% |
| Val Accuracy | 82.25% |
| Test Accuracy | 79.00% |
| Test Loss | 0.9054 |
This model is intended for:
⚠️ Not for clinical diagnosis or deployment without further validation and regulatory approval.
from transformers import AutoImageProcessor, SwinForImageClassification
from PIL import Image
import torch
# Load model and processor
model_path = "Koushim/breast-cancer-swin-classifier" # Your HF repo
processor = AutoImageProcessor.from_pretrained(model_path)
model = SwinForImageClassification.from_pretrained(model_path).eval()
# Load and preprocess image
image = Image.open("your_image.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
# Predict
with torch.no_grad():
outputs = model(**inputs)
predicted_class = outputs.logits.argmax(-1).item()
labels = ["benign", "malignant"]
print("Predicted class:", labels[predicted_class])