Model Card: MRI Brain Tumor Classification (EfficientNet-B1)
Model Details
- Model Name:
MRIModel
- Architecture: EfficientNet-B1-based model for MRI brain tumor classification
- Dataset: Brain Tumor MRI Dataset
- Batch Size: 32
- Loss Function: CrossEntropy Loss
- Optimizer: Adam (learning rate = 1e-3)
- Transfer Learning: No (trained from scratch)
Model Architecture
This model is based on EfficientNet-B1, a lightweight yet powerful convolutional neural network, and has been adapted for MRI-based brain tumor classification.
Modifications
- Input Channel Adaptation: The first convolutional layer is modified to accept single-channel (grayscale) MRI scans.
- Classifier Head: The fully connected (FC) layer is modified to output 756 features.
Implementation
Model Definition
import torch
import torch.nn as nn
from torchvision.models import efficientnet_b1
class MRIModel(nn.Module, PyTorchModelHubMixin):
def __init__(self):
super(MRIModel, self).__init__()
self.base_model = efficientnet_b1(weights=False) # No pretrained weights
self.base_model.features[0] = nn.Sequential(
nn.Conv2d(1, 32, kernel_size=(3, 3), stride=(2, 2), bias=False),
nn.BatchNorm2d(
32, eps=0.001, momentum=0.1, affine=True, track_running_stats=True
),
nn.ReLU6(inplace=True),
)
self.base_model.classifier = nn.Linear(1280, 756)
def forward(self, x):
x = self.base_model(x)
return x
This model has been pushed to the Hub using the PytorchModelHubMixin integration:
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
HF Inference API was unable to determine this model's library.