| --- |
| license: mit |
| language: |
| - en |
| library_name: pytorch |
| base_model: |
| - microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224 |
| - torchvision/vgg16 |
| datasets: |
| - Br35H |
| tags: |
| - medical-imaging |
| - brain-mri |
| - tumor-classification |
| - binary-classification |
| - pytorch |
| --- |
| |
| # Brain Tumor Binary Classifier |
| |
| PyTorch checkpoint artifacts for the MultiAgentMedClassifier binary brain tumor |
| MRI task. The repository contains a VGG16 CNN classifier checkpoint and, |
| optionally, a BiomedCLIP linear-probe checkpoint for classifying brain MRI |
| images as normal or tumor. |
| |
| These are checkpoint files for the accompanying project loaders, not standalone |
| Transformers models. |
| |
| ## Model Description |
| |
| - Task: binary brain tumor MRI classification |
| - CNN architecture: VGG16 |
| - Vision-language backbone for probe: `microsoft/BiomedCLIP-PubMedBERT_256-vit_base_patch16_224` |
| - Framework: PyTorch |
|
|
| ## Classes |
| |
| - `normal` |
| - `tumor` |
|
|
| The project-level BiomedCLIP labels are: |
| |
| - `normal brain MRI` |
| - `brain tumor MRI` |
|
|
| ## Files |
| |
| - `binary_tumor/cnn/vgg16_MRI_tumor_binary_norm_final.pt`: VGG16 CNN checkpoint for binary brain tumor MRI classification. |
| - `binary_tumor/biomedclip/linear_probe_BiomedCLIP_MRI_tumor_binary_norm_best.pt`: BiomedCLIP linear-probe checkpoint for binary brain tumor MRI classification. |
|
|
| ## Dataset |
| |
| Trained/evaluated for the binary tumor task using brain MRI tumor/normal data. |
| The local evaluation script supports the Br35H binary layout: |
| |
| - `data/Br35H/yes`: brain tumor MRI |
| - `data/Br35H/no`: normal brain MRI |
|
|
| Update this section if you publish a model trained on a different dataset split |
| or source. |
| |
| ## Training Details |
| |
| - Input size: 224 x 224 RGB |
| - Normalization: ImageNet mean/std |
| - CNN checkpoint: VGG16 fine-tuned for the `binary_tumor` task |
| - BiomedCLIP probe: linear/MLP probe over frozen BiomedCLIP image features |
|
|
| ## Metrics |
| |
| Evaluation is intended for the `binary_tumor` task on brain MRI tumor/normal |
| datasets such as the Br35H binary layout described above. Recompute metrics on |
| your held-out test set before using this model in a new domain or workflow. |
| |
| ## Inference Example |
| |
| Download the checkpoint from Hugging Face and point the local project config at |
| it: |
| |
| ```python |
| from huggingface_hub import hf_hub_download |
| |
| from agents.cnn_tool import CNNClassifier |
| from config import DEFAULT_CONFIG |
| |
| checkpoint_path = hf_hub_download( |
| repo_id="tamara-kostova/multiagentmed-binary-tumor", |
| filename="binary_tumor/cnn/vgg16_MRI_tumor_binary_norm_final.pt", |
| ) |
| |
| DEFAULT_CONFIG.model.cnn_checkpoints["binary_tumor"] = checkpoint_path |
| |
| classifier = CNNClassifier(DEFAULT_CONFIG.model, DEFAULT_CONFIG.preprocess) |
| result = classifier.classify("path/to/brain_mri.png", task="binary_tumor") |
| print(result) |
| ``` |
| |
| For the BiomedCLIP probe: |
| |
| ```python |
| from huggingface_hub import hf_hub_download |
| |
| from agents.biomedclip_tool import BiomedCLIPTool |
| from config import DEFAULT_CONFIG |
| |
| probe_path = hf_hub_download( |
| repo_id="tamara-kostova/multiagentmed-binary-tumor", |
| filename=( |
| "binary_tumor/biomedclip/" |
| "linear_probe_BiomedCLIP_MRI_tumor_binary_norm_best.pt" |
| ), |
| ) |
| |
| DEFAULT_CONFIG.model.biomedclip_probe_checkpoints["binary_tumor"] = probe_path |
| |
| tool = BiomedCLIPTool(DEFAULT_CONFIG.model, DEFAULT_CONFIG.preprocess) |
| result = tool.classify("path/to/brain_mri.png", task="binary_tumor") |
| print(result) |
| ``` |
| |
| ## Intended Use |
| |
| This model is intended for research and experimentation in automated |
| neuroimaging pipelines. It may be useful for prototype triage, benchmarking, |
| and comparison against other image classifiers. |
| |
| It is not a medical device and should not be used as the sole basis for |
| diagnosis, treatment decisions, or patient management. |
| |
| ## Loading In This Repository |
| |
| Use these files with this repository's local loaders: |
| |
| - CNN: `config.ModelConfig.cnn_checkpoints["binary_tumor"]` |
| - BiomedCLIP probe: `config.ModelConfig.biomedclip_probe_checkpoints["binary_tumor"]` |
| |