{"id":18790839,"url":"https://github.com/sdsubhajitdas/brain-tumor-segmentation","last_synced_at":"2025-04-07T07:17:57.004Z","repository":{"id":43248432,"uuid":"168741041","full_name":"sdsubhajitdas/Brain-Tumor-Segmentation","owner":"sdsubhajitdas","description":"Brain Tumor Segmentation done using U-Net Architecture.","archived":false,"fork":false,"pushed_at":"2023-07-21T04:01:11.000Z","size":38876,"stargazers_count":278,"open_issues_count":6,"forks_count":63,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T06:05:10.516Z","etag":null,"topics":["brain-tumor-segmentation","deep-learning","image-segmentation","pytorch","tumor-segmentation","unet","unet-image-segmentation","unet-pytorch"],"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/sdsubhajitdas.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}},"created_at":"2019-02-01T18:19:24.000Z","updated_at":"2025-03-09T00:45:14.000Z","dependencies_parsed_at":"2024-11-14T22:02:49.609Z","dependency_job_id":"06aea981-d34b-4820-a8f9-db37e99dc1af","html_url":"https://github.com/sdsubhajitdas/Brain-Tumor-Segmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsubhajitdas%2FBrain-Tumor-Segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsubhajitdas%2FBrain-Tumor-Segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsubhajitdas%2FBrain-Tumor-Segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdsubhajitdas%2FBrain-Tumor-Segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdsubhajitdas","download_url":"https://codeload.github.com/sdsubhajitdas/Brain-Tumor-Segmentation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608160,"owners_count":20965953,"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","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-segmentation","deep-learning","image-segmentation","pytorch","tumor-segmentation","unet","unet-image-segmentation","unet-pytorch"],"created_at":"2024-11-07T21:13:48.686Z","updated_at":"2025-04-07T07:17:56.984Z","avatar_url":"https://github.com/sdsubhajitdas.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Brain Tumor Segmentation\n[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://www.python.org/)\n[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://github.com/sdsubhajitdas)\n[![forthebadge](https://forthebadge.com/images/badges/check-it-out.svg)](https://github.com/Jeetu95/Brain-Tumor-Segmentation)\n[![forthebadge](https://forthebadge.com/images/badges/uses-badges.svg)](https://forthebadge.com)\u003cbr\u003e\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![Maintenance](https://img.shields.io/badge/Maintenance-No-lightgrey)](https://github.com/Jeetu95/Brain-Tumor-Segmentation/graphs/commit-activity)\n[![GitHub issues](https://img.shields.io/github/issues/Naereen/StrapDown.js.svg)](https://github.com/Jeetu95/Brain-Tumor-Segmentation/issues)\n\nThis project uses [U-Net Architecture](https://arxiv.org/abs/1505.04597) to create segmentation masks for brain tumor images.\n\n## Overview\n- [Dataset Used](#Dataset-Used)\n- [Data Augmentation](#Data-Augmentation)\n- [Model Architecture](#Model-Architecture)\n- [Training Process](#Training-Process)\n\n### Dataset Used\nDataset used in this project was provided by Jun Cheng.\u003cbr\u003e\nThis dataset contains 3064 T1-weighted contrast-enhanced images with three kinds of brain tumor. For a detailed information about the dataset please refer to this [site](https://figshare.com/articles/brain_tumor_dataset/1512427).\nVersion 5 of this dataset is used in this project. Each image is of dimension ```512 x 512 x 1``` , these are black and white images thus having a single channel.\u003cbr\u003e\nSome Data Samples\u003cbr\u003e\n\nOriginal Image             |  Mask Image\n:-------------------------:|:-------------------------:\n![](images/README/dataset_example.png)  |  ![](images/README/dataset_example_mask.png)\n\n\n### Data Augmentation\nThe basic forms of data augmentation are used here to diversify the training data.\nAll the augmentation methods are used from [Pytorch's](https://pytorch.org) [Torchvision](https://pytorch.org/docs/stable/torchvision/index.html) module.\n- [Horizontally Flip](https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.functional.hflip)\n- [Vertically Flip](https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.functional.vflip)\n- [Rotation](https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.functional.rotate) Between 75°-15°\n\nCode Responsible for augmentation\u003cbr\u003e\n![Augmentation Code](images/README/data_aug.svg)\u003cbr\u003e\nEach augmentation method has a probability of 0.5 and the order of application is also random. For Rotation Augmentation the degree of rotation is chosen randomly between 75°-15°.\n\n\n### Model Architecture\nThe model architecture is depicted in this picture.\n![Model Architecture](images/README/architecture.png)\n\n\n### Training Process\nThe model was trained on a [Nvidia GTX 1050Ti](https://www.geforce.com/hardware/desktop-gpus/geforce-gtx-1050-ti/specifications) 4GB GPU. Total time taken for model training was 6 hours and 45 minutes. We started with an initial learning rate of 1e-3 and reduced it by 85% on plateauing, final learning rate at the end of 100 epochs was 2.7249e-4.\u003cbr\u003e\nSome graphs indicating Learning Rate \u0026 Loss Value over 100 epochs are given below.\n\n![LR Graph](images/README/lr_graph.png)\nLearning Rate Graph in Tensorboard.\u003cbr\u003e\n\n![Loss Graph](images/README/loss_graph.png)\nLoss Graph Plotted in [Matplotlib](https://matplotlib.org)\u003cbr\u003e\n![Loss Graph](images/README/loss_graph_2.png)\nLoss Graph Plotted in Tensorboard\u003cbr\u003e\u003cbr\u003e\n\nTo see the complete output produced during the training process check [this](logs/05-47-51_PM_on_May_20,_2019/training_output_log.txt)\n\n## Installation\nThis project uses python3.\n\nClone the project.\n```bash\ngit clone https://github.com/Jeetu95/Brain-Tumor-Segmentation.git\n```\nInstall Pytorch from this [link](https://pytorch.org/get-started/locally/)\u003cbr\u003e\nUse pip to install all the dependencies\n```bash\npip install -r requirements.txt\n```\nTo open the notebook\n```bash\njupyter lab\n```\nTo see logs in Tensorboard\n```bash\ntensorboard --logdir logs --samples_per_plugin images=100\n```\nTo setup the project dataset\n```bash\npython setup_scripts/download_dataset.py\npython setup_scripts/unzip_dataset.py\npython setup_scripts/extract_images.py\n```\n\n## Usage\n\n```bash\npython api.py --file \u003cfile_name\u003e --ofp \u003coptional_output_file_path\u003e\npython api.py --folder \u003cfolder_name\u003e --odp \u003coptional_output_folder_path\u003e\npython api.py -h\n```\n\n```\nAvailable api.py Flags\n--file  : A single image file name.\n--ofp   : An optional folder location only where the output image will be stored. Used only with --file tag.\n\n--folder: Path of a folder containing many image files.\n--odp   : An optional folder location only where the output images will be stored. Used only with --folder tag.\n\n-h, --help : Shows the help contents.\n```\nSome results generated by API are [here](images/API)\n\n## Results\nThe mean [Dice Score](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient) our model gained was 0.74461 in testing dataset of 600 images.\u003cbr\u003e\nFrom this we can conclude that in our testing dataset our constructed mask has a similarity of about 74% with the original mask.\u003cbr\u003e\nSome samples from our training dataset output are below. The top best results are [here](images).To see all the results click on this [Google Drive link](https://drive.google.com/drive/folders/1vwwUipaH9Yb0NLelv3lW-04E6WnVJ3nh?usp=sharing)\u003cbr\u003e\n\n.             |  .\n:-------------------------:|:-------------------------:\n![](images/0.98010_423.png)  |  ![](images/0.97981_1172.png)\n![](images/0.97746_537.png)  |  ![](images/0.97623_636.png)\n![](images/0.97441_1247.png)  |  ![](images/0.97391_373.png)\n![](images/0.97316_425.png)  |  ![](images/0.97224_1400.png)\n![](images/0.97216_631.png)  |  ![](images/0.97097_50.png)\n![](images/0.97050_1465.png)  |  ![](images/0.96925_581.png)\n![](images/0.96848_390.png)  |  ![](images/0.96812_222.png)\n![](images/0.96669_14.png)  |  ![](images/0.96664_189.png)\n![](images/0.96626_408.png)  |  ![](images/0.96605_994.png)\n![](images/0.96603_170.png)  |  ![](images/0.96600_63.png)\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsubhajitdas%2Fbrain-tumor-segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdsubhajitdas%2Fbrain-tumor-segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdsubhajitdas%2Fbrain-tumor-segmentation/lists"}