--- license: mit pipeline_tag: image-classification language: - en - fa - ku - ar metrics: - accuracy tags: - biology - medical --- # Model Card for Brain Tumor Detection Model (YOLOv8) This model detects and classifies brain tumors from MRI images using YOLOv8. It's trained on a high-quality, labeled dataset with three main tumor types (glioma, meningioma, and pituitary) as well as non-tumorous brain MRIs. The model is designed to assist medical professionals with rapid and automated tumor detection. This model card is part of the TekTonic AI series for accessible medical diagnostic AI. ## Model Details ### Model Description - **Developed by:** Alan Jafari (TekTonic AI) - **Funded by [optional]:** Self-funded - **Shared by:** TekTonic AI - **Model type:** YOLOv8n image classifier - **Language(s) (NLP):** Not applicable - **License:** MIT - **Finetuned from model:** YOLOv8n pretrained backbone (Ultralytics) ### Model Sources - **Repository:** [Add GitHub/Kaggle link here] - **Paper [optional]:** N/A - **Demo [optional]:** [Add Gradio/Streamlit link] ## Uses ### Direct Use Used to classify brain MRI slices into one of the following categories: - **Glioma Tumor** - **Meningioma Tumor** - **Pituitary Tumor** - **No Tumor** ### Downstream Use - Radiology assistant tools - Academic medical research - Mobile or embedded AI diagnostics ### Out-of-Scope Use - Not for full MRI scan interpretation (slice-level only) - Not trained for pediatric or rare tumor types - Not designed for CT scans or other imaging modalities ## Bias, Risks, and Limitations - Dataset sourced primarily from a single research collection - Class imbalance may exist - Model may be sensitive to image noise and artifacts ### Recommendations - Always use with expert clinical review - Further fine-tune on local datasets if possible - Do not use as a final diagnosis system ## How to Get Started with the Model ```python from ultralytics import YOLO import cv2 model = YOLO("nzr_brain_tumor.pt") img = cv2.imread("example_mri.jpg") results = model(img) # Display predicted class results[0].show() print(results[0].probs) # Confidence per class ```` ## Training Details ### Training Data * Source: Labeled Brain MRI Dataset (Glioma, Meningioma, Pituitary, No Tumor) * Preprocessing: Image resizing (224x224), normalization, and augmentation (rotation, flip) ### Training Procedure * Trained for 50 epochs on YOLOv8n architecture * Split: 70% training / 20% validation / 10% test * Optimizer: AdamW * Learning Rate: 0.001 #### Training Hyperparameters * `epochs = 50` * `batch = 16` * `imgsz = 224` * `optimizer = AdamW` * `fp32` precision #### Speeds, Sizes, Times * Training time: \~90 min on NVIDIA T4 * Inference time: \~12 ms per image * Model size: \~25.8 million parameters (≈ 14 MB weights) ## Evaluation ### Testing Data, Factors & Metrics #### Testing Data * Independent test set of 600 MRI slices * Balanced among four categories #### Factors * Class-level evaluation * Slice resolution (224x224) #### Metrics * Accuracy: 94.3% * Precision (avg): 95.1% * Recall (avg): 92.8% * F1-Score (avg): 93.9% ### Results High-performing slice-level brain tumor classification across major tumor types with strong real-time performance. ## Model Examination Grad-CAM analysis is in development for visual interpretability. ## Environmental Impact * **Hardware Type:** NVIDIA Tesla T4 (Google Colab) * **Hours used:** \~1.5 * **Cloud Provider:** Google Cloud (via Colab) * **Compute Region:** US (default) * **Carbon Emitted:** Approx. \~0.06 kg CO2eq ## Technical Specifications ### Model Architecture and Objective YOLOv8n (nano) classifier head trained on medical MRI image slices with 4-class objective. ### Compute Infrastructure #### Hardware * GPU: NVIDIA T4 (Colab) * RAM: 16 GB #### Software * Python 3.10 * Ultralytics YOLOv8 (v8.2) * OpenCV, NumPy, PyTorch ## Citation **BibTeX:** ```bibtex @misc{tektumor2025, title={YOLOv8-Based Brain Tumor Classifier}, author={Alan Jafari}, year={2025}, howpublished={\url{https://huggingface.co/USERNAME/tektumor-model}}, } ``` **APA:** Jafari, A. (2025). *YOLOv8-Based Brain Tumor Classifier* \[Machine learning model]. Hugging Face. [https://huggingface.co/USERNAME/tektumor-model](https://huggingface.co/USERNAME/tektumor-model) ## Glossary * **Glioma:** Tumor in the brain or spine from glial cells * **Meningioma:** Tumor from meninges of the brain * **Pituitary Tumor:** Tumor in the pituitary gland * **YOLOv8:** Real-time object detection/classification model ## More Information Contact via t.me/alan_jafari ## Model Card Authors * Alan Jafari (TekTonic AI) ## Model Card Contact * Email: alanjafariofficial@gmail.com