{"id":31567844,"url":"https://github.com/ankitsharma-tech/brain-tumor-detection","last_synced_at":"2026-05-07T00:31:24.275Z","repository":{"id":318000113,"uuid":"1069654339","full_name":"ankitsharma-tech/Brain-Tumor-Detection","owner":"ankitsharma-tech","description":"A deep learning project for automated brain tumor detection using MRI scans. This repository includes model training, data preprocessing, and evaluation tools built with Python, TensorFlow/Keras, and OpenCV. Designed to assist in early diagnosis through medical image analysis.","archived":false,"fork":false,"pushed_at":"2025-10-04T11:11:14.000Z","size":3322,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T13:10:00.801Z","etag":null,"topics":["brain-tumor","computer-vision","deep-learning","healthcare","image-classification","machine-learning","medical-imaging","mri","opencv","python","tumor-detection"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ankitsharma-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-04T11:08:01.000Z","updated_at":"2025-10-04T11:11:17.000Z","dependencies_parsed_at":"2025-10-04T13:20:03.936Z","dependency_job_id":null,"html_url":"https://github.com/ankitsharma-tech/Brain-Tumor-Detection","commit_stats":null,"previous_names":["ankitsharma-tech/brain-tumor-detection"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ankitsharma-tech/Brain-Tumor-Detection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsharma-tech%2FBrain-Tumor-Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsharma-tech%2FBrain-Tumor-Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsharma-tech%2FBrain-Tumor-Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsharma-tech%2FBrain-Tumor-Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitsharma-tech","download_url":"https://codeload.github.com/ankitsharma-tech/Brain-Tumor-Detection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitsharma-tech%2FBrain-Tumor-Detection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278434439,"owners_count":25986199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brain-tumor","computer-vision","deep-learning","healthcare","image-classification","machine-learning","medical-imaging","mri","opencv","python","tumor-detection"],"created_at":"2025-10-05T09:13:29.671Z","updated_at":"2026-05-07T00:31:24.269Z","avatar_url":"https://github.com/ankitsharma-tech.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Brain Tumor Detection using Deep Learning\n\n## 📝 Abstract\n\nBrain tumors are a serious medical condition affecting both children and adults, constituting 85 to 90 percent of all primary Central Nervous System (CNS) tumors. Annually, around 11,700 people receive a brain tumor diagnosis, with a 5-year survival rate of approximately 34 percent for men and 36 percent for women. Proper treatment, planning, and accurate diagnostics are crucial to improving patient life expectancy.\n\nThis project focuses on automated brain tumor classification using advanced Deep Learning algorithms such as Convolutional Neural Networks (CNN), Transfer Learning (TL), and Artificial Neural Networks (ANN). These models significantly outperform manual classification methods by providing higher accuracy, faster analysis, and consistent results.\n\nBy leveraging these techniques, the system assists medical professionals worldwide in the efficient detection and classification of brain tumors, ultimately supporting early diagnosis and improved treatment planning [1][2][4][5][6][7][8].\n\n## 🌐 Context\n\nBrain tumors present complexities in size and location, requiring expertise for accurate analysis. Developing countries often face challenges due to a shortage of skilled doctors and insufficient knowledge about tumors. An automated system on the cloud can address these issues, providing a faster and more accessible solution[1][2][4][5][6][7][8].\n\n## 🔍 Methodology\n\n1. **Importing Libraries:**\n\n   - Libraries such as NumPy, Pandas, TensorFlow, and others are imported for data manipulation, visualization, and deep learning model building.\n\n2. **Loading the Dataset:**\n\n   - The dataset containing brain MRI images is loaded into dataframes. File paths and labels are extracted for each image in the dataset.\n\n3. **Data Preprocessing:**\n\n   - Data balance is checked to ensure there is an even distribution of classes.\n   - The dataset is split into training, validation, and test sets.\n   - ImageDataGenerator is used to preprocess the images and convert dataframes to numpy arrays for model training.\n\n4. **Model Architecture:**\n\n   - Three different convolutional neural network (CNN) models are created using Keras Sequential API:\n     - Model 1: Simple CNN model with few layers.\n     - Model 2: CNN model with additional layers for increased complexity.\n     - Model 3: Transfer learning using a pre-trained VGG16 model with fine-tuning.\n\n5. **Training the Models:**\n\n   - Each model is compiled using the Adam optimizer and categorical cross-entropy loss.\n   - The models are trained on the training dataset for a specified number of epochs, with validation data for evaluation.\n\n6. **Model Performance Analysis:**\n\n   - Training and validation loss and accuracy are plotted over epochs to visualize the models' performance.\n   - The best epoch based on validation loss and accuracy is determined for each model.\n\n7. **Model Evaluation:**\n\n   - Each model is evaluated on the training, validation, and test sets to assess its performance.\n   - Loss and accuracy metrics are displayed for each set.\n\n8. **Making Predictions:**\n\n   - The trained models are used to make predictions on the test set.\n   - Predictions are converted to class labels for evaluation.\n\n9. **Performance Metrics and Visualization:**\n\n   - For each model, performance metrics such as F1-score, precision, recall, and confusion matrix are calculated and displayed.\n\n10. **Saving the Best Model:**\n    - The best performing model is saved to an .keras file ('best_model.keras') for future use or deployment.\n\n**Note:** Ensure to update the paths accordingly based on your local machine's directory structure.\n\n**Data and Model File Download:**\n\n- Due to the large size of the dataset, it is not included in the GitHub repository. Please download the dataset from the provided location and place it in a directory named 'Datasets/Training' and 'Datasets/Testing' relative to the notebook.\n\n-Similarly, the trained model file ('best_model.keras') is generated when you run the notebook successfully. Please keep this file in a directory named 'Web App' for smooth deployment without hiccups.\n\n**Ensure to update the paths accordingly based on your local machine's directory structure**\n\n### Project Directory Structure\n\n```\nBrain Tumor Detection\n|- Dataset\n  |- Training Folder\n  |- Testing Folder\n  |- README.md\n|- Images\n  |- EDA README.md\n|- Model\n  |- brain_tumor.ipynb\n  |- README.md\n|- Web App\n  |- app.py\n  |- templates\n  |- demo.mp4\n  |- best_model.keras\n  |- README.md\n|- requirements.txt\n```\n\n## 🙌 Acknowledgments\n\nThe authors would like to acknowledge the contributions of the research community in the field of brain tumor detection using deep learning. The open-source datasets and repositories have been instrumental in the development of this project[1][2][3][4][5][6][7][8].\n\nCitations:  \n[1] https://www.github.com/TheNaiveSamosa  \n[2] https://github.com/TheNaiveSamosa  \n[3] https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset  \n[4] https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/s12911-023-02114-6  \n[5] https://www.mdpi.com/1999-4893/16/4/176  \n[6] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9468505  \n[7] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9854739  \n[8] https://www.nature.com/articles/s41598-024-57970-7\n\n## How to Use\n\n#### 1. Requirements:\n\nEnsure you have the necessary libraries and dependencies installed. You can find the list of required packages in the requirements.txt file.\n\n#### 2. Download Data:\n\nDownload the Brain Tumor MRI Dataset from Kaggle mentioned in the dataset section of the project.\n\n#### 3. Run the Jupyter Notebook:\n\nOpen the provided Jupyter Notebook file and run each cell sequentially. Make sure to update any file paths or configurations as needed for your environment.\n\n#### 4. Training and Evaluation:\n\nTrain the models using the provided data and evaluate their performance using metrics such as accuracy and loss.\n\n#### 5. Interpret Results:\n\nAnalyze the model's performance using the visualizations and metrics provided in the notebook.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitsharma-tech%2Fbrain-tumor-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitsharma-tech%2Fbrain-tumor-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitsharma-tech%2Fbrain-tumor-detection/lists"}