How mohamedalihabib/brain-tumor-detection works
Project type and purpose
• This is a machine-learning image-classification pipeline (brain tumor vs. non-tumor) implemented in Jupyter notebooks using TensorFlow/Keras.
• It ingests raw MRI images, augments and preprocesses them, trains a custom CNN, logs metrics, and saves model weights.
File structure
• Notebooks:
• Data Augmentation.ipynb – contains data-augmentation logic.
• Brain Tumor Detection.ipynb – contains data preprocessing, model definition, training, evaluation.
• Data directories:
• “yes” and “no” – original raw images (tumor vs. non-tumor).
• “augmented data” – output of augmentation step (combined original + synthetic).
• “logs” – TensorBoard event logs for each training run.
• “models” – serialized Keras .model files for each epoch/checkpoint; best model highlighted.
• Config artifacts: LICENSE, README.md.
Key insights from the README
• Data augmentation expanded 253 images → 2,065 examples.
• Preprocessing steps: cropping, resizing to (240×240×3), normalization.
• Data split: 70% train / 15% val / 15% test.
• CNN architecture: zero-padding → Conv7×7 → batch-norm → ReLU → two max-pool layers → flatten → dense(sigmoid).
• Training epochs logged; best model at epoch 23 (91% val accuracy).
1. External Data Source (Kaggle repository link)
2. Raw Data Store
3. Data Augmentation Module
4. Preprocessing Module
5. Data Splitter (Train / Validation / Test)
6. Model Training Engine (CNN)
7. Logging Service (TensorBoard logs)
8. Model Storage (serialized .model files)
9. Evaluation & Metrics Report
10. Model Loader / Deployment Interface
• External Data → Raw Data Store
• Raw Data Store → Data Augmentation → Augmented Data Store
• Augmented Data Store → Preprocessing → Preprocessed Dataset
• Preprocessed Dataset → Data Splitter → {Train, Val, Test}
• Train + Val → Model Training → Model Storage + Logging Service
• Test + Stored Model → Evaluation → Metrics Report
• Model Storage → Model Loader / Deployment
c. Architectural patterns & principles:
• Pipeline pattern – sequential stages of data transformation.
• Modularity – separate notebooks/modules for augmentation vs. training.
• Reproducibility – logs tied to each training run; versioned model artifacts.
• Scalability consideration – augmentation to expand small dataset.
d. Key technologies & frameworks:
• Jupyter Notebooks (or Python scripts)
• TensorFlow 2.x & Keras API
• Python imaging libraries (e.g., OpenCV or PIL) for crop/resize
• TensorBoard for logging
• HDF5 or SavedModel format for weights