itsomk
Vit Xray V1
Model Description This model is a fine-tuned Vision Transformer (google/vit-base-patch16-224-in21k) for multi-label classification of chest X-rays. It predicts the presence of multiple findings such as: - Nodule - Infiltration - Effusion - Atelectasis The model is designed for research and educational purposes only and should not be used as a substitute for clinical diagnosis. Intended Use - Research in medical imaging and computer vision - Educational purposes for understanding X-ray image classification - Baseline model for further fine-tuning or domain adaptation ⚠️ Not intended for clinical use. Predictions should not guide medical decisions. Training Data - Dataset: Chest X-ray images (publicly available datasets, e.g., NIH ChestX-ray14, etc.) - Images were preprocessed (resized to 224x224, normalized). - Labels are multi-label, meaning an X-ray can contain more than one finding. Model Performance - Optimized for detecting common thoracic abnormalities. - Evaluation metrics: AUC . - Nodule AUC: 0.696 - Infiltration AUC: 0.684 - Effusion AUC: 0.843 - Atelectasis AUC: 0.762 ```python from transformers import AutoImageProcessor, AutoModelForImageClassification import torch from PIL import Image MODEL = "itsomk/vit-xray-v1" processor = AutoImageProcessor.frompretrained(MODEL) model = AutoModelForImageClassification.frompretrained(MODEL) img = Image.open("path/to/xray.jpg").convert("RGB") inputs = processor(images=img, returntensors="pt") probs = torch.sigmoid(logits).squeeze().tolist() results = {model.config.id2label[i]: float(probs[i]) for i in range(len(probs))} print(results)
Chexpert Densenet121
DenseNet121 CheXpert Multi-label (chexpert-densenet121-v1) Model Description This model is a fine-tuned DenseNet-121 (PyTorch) for multi-label classification of chest X-rays, trained on the Stanford CheXpert v1.0 dataset. It predicts the presence of the following 14 labels (order preserved): - No Finding - Enlarged Cardiomediastinum - Cardiomegaly - Lung Opacity - Lung Lesion - Edema - Consolidation - Pneumonia - Atelectasis - Pneumothorax - Pleural Effusion - Pleural Other - Fracture - Support Devices Model files included: - `chexpertpytorch.safetensors` — model weights saved with `safetensors` - `config.json` — minimal config (backbone, numlabels, transforms) - `traininghistory.png` — training curves > ⚠️ Important: This model is provided for research and educational purposes only. Not for clinical use. Intended Use - Research in medical imaging and multi-label classification - Educational use and reproducible baseline for further fine-tuning or adaptation - NOT intended for clinical diagnosis or patient care. Use with caution; validate thoroughly before any downstream application. Training Summary - Backbone: DenseNet-121 (PyTorch `torchvision.models.densenet121`) - Dataset: CheXpert v1.0 (Stanford) - Uncertainty handling: U-Zeros (replace -1 with 0) - Image size: 224 × 224 - Epochs: 20 - Batch size: 32 - Optimizer: Adam (lr=1e-4, weightdecay=1e-4) - Loss: BCEWithLogitsLoss with per-class posweight - Best validation mean AUC: 0.8176 Per-class AUC (validation) - No Finding : 0.8762 - Enlarged Cardiomediastinum : 0.5959 - Cardiomegaly : 0.8165 - Lung Opacity : 0.8083 - Lung Lesion : 0.8230 - Edema : 0.8779 - Consolidation : 0.8527 - Pneumonia : 0.7559 - Atelectasis : 0.7117 - Pneumothorax : 0.8546 - Pleural Effusion : 0.9021 - Pleural Other : 0.9157 - Fracture : 0.7936 - Support Devices : 0.8622 import torch from torchvision import models, transforms from safetensors.torch import loadfile from huggingfacehub import hfhubdownload from PIL import Image REPOID = "itsomk/chexpert-densenet121" FILENAME = "pytorchmodel.safetensors" localpath = hfhubdownload(repoid=REPOID, filename=FILENAME) class DenseNet121CheXpert(torch.nn.Module): def init(self, numlabels=14, pretrained=False): super().init() self.densenet = models.densenet121(pretrained=pretrained) numfeatures = self.densenet.classifier.infeatures self.densenet.classifier = torch.nn.Linear(numfeatures, numlabels) def forward(self, x): return self.densenet(x) model = DenseNet121CheXpert(numlabels=14, pretrained=False) model.loadstatedict(state, strict=False) model.eval() preprocess = transforms.Compose([ transforms.Resize((224, 224)), transforms.ToTensor(), transforms.Normalize(mean=[0.485,0.456,0.406], std=[0.229,0.224,0.225]) ]) labels = [ "No Finding","Enlarged Cardiomediastinum","Cardiomegaly","Lung Opacity", "Lung Lesion","Edema","Consolidation","Pneumonia","Atelectasis", "Pneumothorax","Pleural Effusion","Pleural Other","Fracture","Support Devices" ] inference img = Image.open("path/to/xray.jpg").convert("RGB") x = preprocess(img).unsqueeze(0) with torch.nograd(): logits = model(x) probs = torch.sigmoid(logits).squeeze().tolist() results = {labels[i]: float(probs[i]) for i in range(len(labels))} print(results)