Spaces:
Configuration error
Configuration error
Upload 3 files
Browse files- README.md +129 -0
- model.pkl +3 -0
- requirements.txt +6 -0
README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: convnext_tiny_in22k
|
| 4 |
+
tags:
|
| 5 |
+
- medical
|
| 6 |
+
- healthcare
|
| 7 |
+
- image-classification
|
| 8 |
+
- brain-tumor-detection
|
| 9 |
+
datasets:
|
| 10 |
+
- medical-images
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
library_name: transformers
|
| 14 |
+
pipeline_tag: image-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Brain Tumor Detection
|
| 18 |
+
|
| 19 |
+
## Model Description
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
This model is a ConvNeXt Tiny architecture trained with FastAI for detecting brain tumors in MRI scans.
|
| 23 |
+
It can classify brain MRI images as either showing signs of a tumor or being normal (no tumor detected).
|
| 24 |
+
Note: This model uses FastAI format and requires specific loading procedures.
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## Intended Uses & Limitations
|
| 28 |
+
|
| 29 |
+
⚠️ **Important**: This model is for research and educational purposes only. It should **NOT** be used for actual medical diagnosis without proper clinical validation and oversight by qualified medical professionals.
|
| 30 |
+
|
| 31 |
+
### Intended Uses
|
| 32 |
+
- Research and development in medical AI
|
| 33 |
+
- Educational purposes for learning about medical image classification
|
| 34 |
+
- Proof-of-concept applications with proper disclaimers
|
| 35 |
+
- Academic studies and benchmarking
|
| 36 |
+
|
| 37 |
+
### Limitations
|
| 38 |
+
- Not clinically validated
|
| 39 |
+
- Should not replace professional medical diagnosis
|
| 40 |
+
- May have biases based on training data
|
| 41 |
+
- Performance may vary on different populations or imaging conditions
|
| 42 |
+
|
| 43 |
+
## Model Details
|
| 44 |
+
|
| 45 |
+
- **Model Type**: Image Classification
|
| 46 |
+
- **Architecture**: convnext_tiny_in22k
|
| 47 |
+
- **Classes**: 2
|
| 48 |
+
- **Input**: RGB images (224x224 pixels)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
### Classes
|
| 52 |
+
- No Tumor
|
| 53 |
+
- Tumor Detected
|
| 54 |
+
|
| 55 |
+
## Usage
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
from transformers import AutoModelForImageClassification, AutoImageProcessor
|
| 59 |
+
from PIL import Image
|
| 60 |
+
import torch
|
| 61 |
+
|
| 62 |
+
# Load model and processor
|
| 63 |
+
model = AutoModelForImageClassification.from_pretrained("your-username/brain-tumor-detection")
|
| 64 |
+
processor = AutoImageProcessor.from_pretrained("your-username/brain-tumor-detection")
|
| 65 |
+
|
| 66 |
+
# Load and process image
|
| 67 |
+
image = Image.open("path_to_image.jpg")
|
| 68 |
+
inputs = processor(image, return_tensors="pt")
|
| 69 |
+
|
| 70 |
+
# Make prediction
|
| 71 |
+
with torch.no_grad():
|
| 72 |
+
outputs = model(**inputs)
|
| 73 |
+
predicted_class_id = outputs.logits.argmax().item()
|
| 74 |
+
predicted_class = model.config.id2label[predicted_class_id]
|
| 75 |
+
|
| 76 |
+
print(f"Predicted class: {predicted_class}")
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Training Details
|
| 80 |
+
|
| 81 |
+
This model was fine-tuned from pre-trained vision transformers on medical image datasets. For detailed training information, please refer to the original model documentation.
|
| 82 |
+
|
| 83 |
+
## Evaluation
|
| 84 |
+
|
| 85 |
+
The model has been tested on held-out validation sets with the reported accuracy metrics. However, clinical evaluation and validation are required before any medical application.
|
| 86 |
+
|
| 87 |
+
## Ethical Considerations
|
| 88 |
+
|
| 89 |
+
- Medical AI models can have significant impact on human health
|
| 90 |
+
- Proper validation and regulatory approval required for clinical use
|
| 91 |
+
- Potential for bias in training data and model predictions
|
| 92 |
+
- Should be used responsibly with appropriate medical oversight
|
| 93 |
+
|
| 94 |
+
## Contact
|
| 95 |
+
|
| 96 |
+
For questions about this model, please create an issue in the repository.
|
| 97 |
+
|
| 98 |
+
## Citation
|
| 99 |
+
|
| 100 |
+
If you use this model in your research, please cite appropriately and acknowledge that it's for research purposes only.
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
## FastAI Usage
|
| 104 |
+
|
| 105 |
+
This model uses FastAI format. To use it:
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
from fastai.vision.all import load_learner
|
| 109 |
+
import pathlib
|
| 110 |
+
import platform
|
| 111 |
+
|
| 112 |
+
# Fix for cross-platform compatibility
|
| 113 |
+
if platform.system() == 'Windows':
|
| 114 |
+
pathlib.PosixPath = pathlib.WindowsPath
|
| 115 |
+
|
| 116 |
+
# Load the model
|
| 117 |
+
model = load_learner('model.pkl')
|
| 118 |
+
|
| 119 |
+
# Make prediction
|
| 120 |
+
prediction, pred_idx, probs = model.predict(image)
|
| 121 |
+
print(f"Prediction: {prediction}")
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
## Requirements
|
| 125 |
+
|
| 126 |
+
- fastai<2.8.0
|
| 127 |
+
- torch<2.7
|
| 128 |
+
- timm
|
| 129 |
+
- pathlib (for cross-platform compatibility)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d80056e02abd309d7d2d0b9ba2899d3305b49465e1baadeb285f9affadebe101
|
| 3 |
+
size 114579177
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastai<2.8.0
|
| 2 |
+
torch<2.7
|
| 3 |
+
torchvision
|
| 4 |
+
timm
|
| 5 |
+
pillow
|
| 6 |
+
numpy
|