Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
tags:
|
| 4 |
+
- image-classification
|
| 5 |
+
- medical-imaging
|
| 6 |
+
- brain-tumor
|
| 7 |
+
- resnet
|
| 8 |
+
- pytorch
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
datasets:
|
| 11 |
+
- sartajbhuvaji/brain-tumor-classification-mri
|
| 12 |
+
metrics:
|
| 13 |
+
- accuracy
|
| 14 |
+
model-index:
|
| 15 |
+
- name: brain-tumor-resnet-classifier
|
| 16 |
+
results:
|
| 17 |
+
- task:
|
| 18 |
+
type: image-classification
|
| 19 |
+
dataset:
|
| 20 |
+
name: Brain Tumor Classification MRI
|
| 21 |
+
type: sartajbhuvaji/brain-tumor-classification-mri
|
| 22 |
+
metrics:
|
| 23 |
+
- type: accuracy
|
| 24 |
+
value: 79.95
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
# Brain Tumor Classification with ResNet
|
| 28 |
+
|
| 29 |
+
## Model Description
|
| 30 |
+
|
| 31 |
+
Bu model, beyin MRI görüntülerinden tümör sınıflandırması yapmak için eğitilmiş bir ResNet modelidir.
|
| 32 |
+
|
| 33 |
+
## Dataset
|
| 34 |
+
|
| 35 |
+
Model, [Brain Tumor Classification MRI](https://www.kaggle.com/datasets/sartajbhuvaji/brain-tumor-classification-mri) veri seti üzerinde eğitilmiştir.
|
| 36 |
+
|
| 37 |
+
Veri seti 4 sınıf içermektedir:
|
| 38 |
+
- Glioma
|
| 39 |
+
- Meningioma
|
| 40 |
+
- No Tumor
|
| 41 |
+
- Pituitary
|
| 42 |
+
|
| 43 |
+
## Training Details
|
| 44 |
+
|
| 45 |
+
**En İyi Model Konfigürasyonu:**
|
| 46 |
+
- Model: resnet101
|
| 47 |
+
- Test Accuracy: **79.95%**
|
| 48 |
+
- Validation Accuracy: 97.56%
|
| 49 |
+
|
| 50 |
+
## Denenen Konfigürasyonlar ve Sonuçları
|
| 51 |
+
|
| 52 |
+
| Model | Augmentation | Optimizer | Test Acc |
|
| 53 |
+
|-------|-------------|-----------|----------|
|
| 54 |
+
| resnet50 | heavy | - | 76.65% |
|
| 55 |
+
| resnet101 | best | - | 79.95% |
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
## Kullanım
|
| 59 |
+
```python
|
| 60 |
+
import torch
|
| 61 |
+
from torchvision import transforms, models
|
| 62 |
+
from PIL import Image
|
| 63 |
+
|
| 64 |
+
# Model yükleme
|
| 65 |
+
model = models.resnet101(pretrained=False)
|
| 66 |
+
num_features = model.fc.in_features
|
| 67 |
+
model.fc = torch.nn.Linear(num_features, 4)
|
| 68 |
+
|
| 69 |
+
checkpoint = torch.hub.load_state_dict_from_url(
|
| 70 |
+
'https://huggingface.co/Yasette/brain-tumor-resnet-classifier/resolve/main/pytorch_model.pth',
|
| 71 |
+
map_location='cpu'
|
| 72 |
+
)
|
| 73 |
+
model.load_state_dict(checkpoint['model_state_dict'])
|
| 74 |
+
model.eval()
|
| 75 |
+
|
| 76 |
+
# Görüntü işleme
|
| 77 |
+
transform = transforms.Compose([
|
| 78 |
+
transforms.Resize((224, 224)),
|
| 79 |
+
transforms.ToTensor(),
|
| 80 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
| 81 |
+
])
|
| 82 |
+
|
| 83 |
+
# Tahmin
|
| 84 |
+
image = Image.open('brain_mri.jpg').convert('RGB')
|
| 85 |
+
input_tensor = transform(image).unsqueeze(0)
|
| 86 |
+
|
| 87 |
+
with torch.no_grad():
|
| 88 |
+
output = model(input_tensor)
|
| 89 |
+
_, predicted = torch.max(output, 1)
|
| 90 |
+
|
| 91 |
+
classes = ['glioma', 'meningioma', 'notumor', 'pituitary']
|
| 92 |
+
print(f"Tahmin: {classes[predicted.item()]}")
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## Ekip Üyeleri
|
| 96 |
+
|
| 97 |
+
- [İsim 1]
|
| 98 |
+
- [İsim 2]
|
| 99 |
+
- [İsim 3]
|
| 100 |
+
|
| 101 |
+
## Lisans
|
| 102 |
+
|
| 103 |
+
Apache 2.0
|