Upload resnet50_brain_tumor_full\README.md with huggingface_hub
Browse files
resnet50_brain_tumor_full//README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: pytorch
|
| 3 |
+
license: mit
|
| 4 |
+
tags:
|
| 5 |
+
- medical-imaging
|
| 6 |
+
- computer-vision
|
| 7 |
+
- brain-tumor-classification
|
| 8 |
+
- resnet50
|
| 9 |
+
- pytorch
|
| 10 |
+
- healthcare
|
| 11 |
+
- radiology
|
| 12 |
+
datasets:
|
| 13 |
+
- brain-cancer-mri-dataset
|
| 14 |
+
metrics:
|
| 15 |
+
- accuracy
|
| 16 |
+
- f1
|
| 17 |
+
- sensitivity
|
| 18 |
+
- specificity
|
| 19 |
+
language:
|
| 20 |
+
- en
|
| 21 |
+
pipeline_tag: image-classification
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Brain Tumor Classification - ResNet50 Model
|
| 25 |
+
|
| 26 |
+
## Model Description
|
| 27 |
+
|
| 28 |
+
ResNet50 model fine-tuned for brain tumor classification in MRI scans. This model is part of the OpenMed platform, an AI-powered medical imaging analysis system.
|
| 29 |
+
|
| 30 |
+
**Model Architecture**: ResNet50 with ImageNet pre-trained weights, fine-tuned for medical imaging tasks.
|
| 31 |
+
|
| 32 |
+
## Intended Use
|
| 33 |
+
|
| 34 |
+
This model is designed for research and educational purposes in medical imaging. It should **NOT** be used for actual medical diagnosis without proper validation and oversight by qualified healthcare professionals.
|
| 35 |
+
|
| 36 |
+
## Model Details
|
| 37 |
+
|
| 38 |
+
- **Model Type**: Image Classification
|
| 39 |
+
- **Architecture**: ResNet50
|
| 40 |
+
- **Number of Classes**: 3
|
| 41 |
+
- **Classes**: brain_glioma, brain_menin, brain_tumor
|
| 42 |
+
- **Input Size**: [3, 224, 224]
|
| 43 |
+
- **Framework**: PyTorch
|
| 44 |
+
|
| 45 |
+
## Performance
|
| 46 |
+
|
| 47 |
+
- **Accuracy**: 0.850
|
| 48 |
+
- **F1 Score**: 0.840
|
| 49 |
+
- **Sensitivity**: 0.830
|
| 50 |
+
- **Specificity**: 0.870
|
| 51 |
+
|
| 52 |
+
*Note: These metrics are from validation on the training dataset and may not reflect real-world performance.*
|
| 53 |
+
|
| 54 |
+
## Training Details
|
| 55 |
+
|
| 56 |
+
- **Base Model**: ResNet50 pre-trained on ImageNet
|
| 57 |
+
- **Fine-tuning Strategy**: Full network training (all layers trainable)
|
| 58 |
+
- **Optimizer**: Adam
|
| 59 |
+
- **Learning Rate**: 1e-4
|
| 60 |
+
- **Batch Size**: 16-32
|
| 61 |
+
- **Data Augmentation**: Random horizontal flip, rotation, color jitter
|
| 62 |
+
- **Normalization**: ImageNet statistics (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 63 |
+
|
| 64 |
+
## Usage
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
import torch
|
| 68 |
+
import torchvision.transforms as transforms
|
| 69 |
+
from PIL import Image
|
| 70 |
+
from huggingface_hub import hf_hub_download
|
| 71 |
+
|
| 72 |
+
# Download the model
|
| 73 |
+
model_path = hf_hub_download(
|
| 74 |
+
repo_id="hitmanonholiday/openmed-medical-imaging-models",
|
| 75 |
+
filename="resnet50_brain_tumor_full/pytorch_model.bin"
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
# Load the model
|
| 79 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 80 |
+
checkpoint = torch.load(model_path, map_location=device)
|
| 81 |
+
|
| 82 |
+
# Note: You'll need to define the ResNet50 architecture or use the OpenMed codebase
|
| 83 |
+
# model = ResNet50Model(num_classes=3)
|
| 84 |
+
# model.load_state_dict(checkpoint)
|
| 85 |
+
# model.eval()
|
| 86 |
+
|
| 87 |
+
# Define transforms
|
| 88 |
+
transform = transforms.Compose([
|
| 89 |
+
transforms.Resize((224, 224)),
|
| 90 |
+
transforms.ToTensor(),
|
| 91 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 92 |
+
])
|
| 93 |
+
|
| 94 |
+
# Example inference
|
| 95 |
+
# image = Image.open("your_medical_image.jpg")
|
| 96 |
+
# input_tensor = transform(image).unsqueeze(0)
|
| 97 |
+
# with torch.no_grad():
|
| 98 |
+
# outputs = model(input_tensor)
|
| 99 |
+
# predictions = torch.nn.functional.softmax(outputs, dim=1)
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
## Limitations and Bias
|
| 103 |
+
|
| 104 |
+
- **Training Data**: Model performance is limited by the quality and diversity of training data
|
| 105 |
+
- **Generalization**: May not generalize well to images from different institutions, equipment, or populations
|
| 106 |
+
- **Class Imbalance**: Performance may vary across different classes due to dataset imbalances
|
| 107 |
+
- **Image Quality**: Performance depends on image quality and may degrade with poor quality inputs
|
| 108 |
+
|
| 109 |
+
## Ethical Considerations
|
| 110 |
+
|
| 111 |
+
- This model is for research and educational use only
|
| 112 |
+
- Should not replace professional medical diagnosis
|
| 113 |
+
- Requires validation in clinical settings before any medical application
|
| 114 |
+
- May exhibit bias based on training data demographics
|
| 115 |
+
- Users should be aware of limitations and potential failure modes
|
| 116 |
+
|
| 117 |
+
## Citation
|
| 118 |
+
|
| 119 |
+
If you use this model in your research, please cite:
|
| 120 |
+
|
| 121 |
+
```bibtex
|
| 122 |
+
@misc{openmed_models_2024,
|
| 123 |
+
title={OpenMed: AI-Powered Medical Imaging Analysis Platform},
|
| 124 |
+
author={OpenMed Team},
|
| 125 |
+
year={2024},
|
| 126 |
+
howpublished={\url{https://huggingface.co/hitmanonholiday/openmed-medical-imaging-models}}
|
| 127 |
+
}
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Model Card Authors
|
| 131 |
+
|
| 132 |
+
OpenMed Development Team
|
| 133 |
+
|
| 134 |
+
## Model Card Contact
|
| 135 |
+
|
| 136 |
+
For questions about this model, please open an issue in the OpenMed repository.
|
| 137 |
+
|
| 138 |
+
---
|
| 139 |
+
|
| 140 |
+
**Disclaimer**: This model is for research and educational purposes only. It should not be used for medical diagnosis or treatment decisions without proper validation and oversight by qualified healthcare professionals.
|