CoolFace
Modelpublic

efecelik/medgemma-abdominal-ct-lora

sourceHugging Faceotherupdated 8mo agoView on Hugging Face
0likes9downloads
Model Card

MedGemma Abdominal CT LoRA

Abdominal organ classification adapter fine-tuned on OrganAMNIST (MedMNIST) using MedGemma 4B.

Identifies the primary organ or anatomical structure visible in abdominal CT axial slices across 11 classes.

Model Details

PropertyValue
Base Modelgoogle/medgemma-4b-it
MethodLoRA (Low-Rank Adaptation)
TaskMulti-class organ classification (11 classes)
ModalityAbdominal CT (axial 2D slices)
FrameworkPyTorch + HuggingFace Transformers + PEFT

Training Dataset

[OrganAMNIST](https://huggingface.co/datasets/satwatbashir/organamnist) from the MedMNIST v2 benchmark — standardized 2D axial CT slices for organ classification.

Reference: Yang et al. 2023, Scientific Data - "MedMNIST v2: A Large-Scale Lightweight Benchmark for 2D and 3D Biomedical Image Classification"

  • —Original dataset: ~58,850 images
  • —Train samples: 10,000 (curated subset)
  • —Validation samples: 1,000
  • —Image size: 28x28 pixels (MedMNIST standard, resized by processor)

Class Distribution

IDOrganDescription
0BladderUrinary bladder in the pelvis
1Femur (left)Proximal left femur and femoral head
2Femur (right)Proximal right femur and femoral head
3HeartCardiac silhouette with chambers and great vessels
4Kidney (left)Left kidney with cortex and medulla
5Kidney (right)Right kidney (slightly lower due to liver)
6LiverLargest solid abdominal organ, right upper quadrant
7Lung (left)Left hemithorax pulmonary tissue
8Lung (right)Right hemithorax, three lobes
9SpleenLeft upper quadrant, posterior to stomach
10PancreasRetroperitoneal organ crossing midline

Training Configuration

LoRA Parameters

ParameterValue
Rank (r)16
Alpha32
Dropout0.05
Target Modulesall-linear
Task TypeCAUSAL_LM
Trainable Params1.38B / 5.68B (24.3%)

Hyperparameters

ParameterValue
Epochs1
Per-device Batch Size1
Gradient Accumulation Steps8 (effective batch = 8)
Learning Rate2e-4
LR SchedulerLinear with warmup
Warmup Ratio0.03
Max Grad Norm0.3
Precisionbfloat16
Gradient CheckpointingEnabled
Seed42

Infrastructure

PropertyValue
GPUNVIDIA L4 (24 GB VRAM)
Cloud PlatformModal serverless GPU
Training Time~45-60 minutes

Prompt Format

Input:

Identify the primary organ or structure visible in this abdominal CT slice.

Output:

This abdominal CT slice primarily shows the Liver. Liver (largest solid organ in the abdomen, occupying the right upper quadrant with homogeneous parenchymal density).

Usage

python
from transformers import AutoProcessor, AutoModelForImageTextToText
from peft import PeftModel
from PIL import Image

base_model_id = "google/medgemma-4b-it"
adapter_id = "efecelik/medgemma-abdominal-ct-lora"

processor = AutoProcessor.from_pretrained(base_model_id)
model = AutoModelForImageTextToText.from_pretrained(
    base_model_id, torch_dtype="bfloat16", device_map="auto"
)
model = PeftModel.from_pretrained(model, adapter_id)

image = Image.open("abdominal_ct.jpg").convert("RGB")
messages = [
    {"role": "user", "content": [
        {"type": "image"},
        {"type": "text", "text": "Identify the primary organ or structure visible in this abdominal CT slice."}
    ]}
]

inputs = processor.apply_chat_template(
    messages, add_generation_prompt=True, tokenize=True,
    return_dict=True, return_tensors="pt", images=[image]
).to(model.device)

output = model.generate(**inputs, max_new_tokens=256)
print(processor.decode(output[0], skip_special_tokens=True))

Intended Use

This adapter is part of the MedVision AI platform built for the MedGemma Impact Challenge. It is designed for:

  • —Medical education: Helping students learn abdominal CT anatomy and organ identification
  • —Clinical decision support: Assisting radiologists with organ localization
  • —Research: Exploring fine-tuned medical VLMs for abdominal imaging

Limitations

  • —Not for clinical diagnosis. This model is for educational and research purposes only.
  • —Organ identification only: Classifies visible organ, does not detect pathology within organs.
  • —Low resolution source: MedMNIST images are 28x28 pixels, limiting fine structural detail.
  • —Normal anatomy only: Trained on healthy organ appearances, not pathological variants.
  • —Single epoch: Trained for 1 epoch; further training may improve performance.

Citation

bibtex
@article{yang2023medmnist,
  title={MedMNIST v2-A large-scale lightweight benchmark for 2D and 3D biomedical image classification},
  author={Yang, Jiancheng and Shi, Rui and Wei, Donglai and Liu, Zequan and Zhao, Lin and Ke, Bilian and Pfister, Hanspeter and Ni, Bingbing},
  journal={Scientific Data},
  volume={10},
  number={1},
  pages={41},
  year={2023},
  publisher={Nature Publishing Group UK London}
}

Disclaimer

This model is for educational and research purposes only. It is NOT intended for clinical diagnosis or patient care decisions. Always consult qualified medical professionals for medical advice.