{"id":26060410,"url":"https://github.com/pramodyasahan/unet-biomedical-segmentation","last_synced_at":"2026-05-30T04:31:28.653Z","repository":{"id":254570048,"uuid":"846927976","full_name":"pramodyasahan/unet-biomedical-segmentation","owner":"pramodyasahan","description":"The U-Net architecture is a convolutional neural network designed for precise segmentation of biomedical images. It consists of a contracting path to capture context and a symmetric expanding path that enables precise localization. This implementation is based on the original paper and is adapted for the Carvana Image Masking Challenge dataset.","archived":false,"fork":false,"pushed_at":"2024-09-09T15:44:46.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T16:16:21.829Z","etag":null,"topics":["computer-vision","convolutional-neural-networks","deep-learning","python"],"latest_commit_sha":null,"homepage":"","language":"Python","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/pramodyasahan.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":"2024-08-24T10:56:53.000Z","updated_at":"2025-08-22T02:19:43.000Z","dependencies_parsed_at":"2024-08-24T12:36:40.295Z","dependency_job_id":"774f6ba8-4111-4a73-ac06-b279984cd829","html_url":"https://github.com/pramodyasahan/unet-biomedical-segmentation","commit_stats":null,"previous_names":["pramodyasahan/unet-biomedical-segmentation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pramodyasahan/unet-biomedical-segmentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Funet-biomedical-segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Funet-biomedical-segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Funet-biomedical-segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Funet-biomedical-segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pramodyasahan","download_url":"https://codeload.github.com/pramodyasahan/unet-biomedical-segmentation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Funet-biomedical-segmentation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33680522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["computer-vision","convolutional-neural-networks","deep-learning","python"],"created_at":"2025-03-08T14:08:14.184Z","updated_at":"2026-05-30T04:31:28.638Z","avatar_url":"https://github.com/pramodyasahan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n---\n\n# U-Net: Convolutional Networks for Biomedical Image Segmentation\n\nThis repository contains an implementation of the U-Net architecture for biomedical image segmentation, inspired by the seminal paper [\"U-Net: Convolutional Networks for Biomedical Image Segmentation\"](https://arxiv.org/abs/1505.04597) by Olaf Ronneberger, Philipp Fischer, and Thomas Brox.\n\nI’ve written a detailed article on Medium that explains the UNet model in-depth, including its implementation in Python. You can read it here:\n\n[Understanding and Implementing the UNet Model](https://medium.com/@pramodyasahan.edu/understanding-and-implementing-the-unet-model-for-biomedical-image-segmentation-abedfd3be3d7) on Medium.\n\n\n## Overview\n\nThe U-Net architecture is a convolutional neural network designed for precise segmentation of biomedical images. It consists of a contracting path to capture context and a symmetric expanding path that enables precise localization. This implementation is based on the original paper and is adapted for the Carvana Image Masking Challenge dataset.\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Dataset](#dataset)\n- [Training](#training)\n- [Results](#results)\n- [References](#references)\n- [Acknowledgments](#acknowledgments)\n\n## Features\n\n- **U-Net Architecture**: Implementation of the U-Net model with customizable depth and width.\n- **Carvana Dataset Integration**: Preprocessing and loading of the Carvana Image Masking Challenge dataset.\n- **Training \u0026 Validation Loop**: Customizable training loop with real-time loss monitoring.\n- **Model Saving**: Save the trained model to a specified path for later use.\n\n## Installation\n\n1. **Clone the repository**:\n    ```bash\n    git clone https://github.com/pramodyasahan/unet-biomedical-segmentation.git\n    cd unet-biomedical-segmentation\n    ```\n\n2. **Create a virtual environment** (optional but recommended):\n    ```bash\n    python3 -m venv venv\n    source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n    ```\n\n\n## Usage\n\n### 1. Dataset Preparation\n\n- Download the [Carvana Image Masking Challenge](https://www.kaggle.com/c/carvana-image-masking-challenge) dataset.\n- Place the dataset in the `data/` directory, with the following structure:\n    ```\n    data/\n    ├── train/\n    ├── train_mask/\n    ├── manual_test/\n    └── manual_test_mask/\n    ```\n\n### 2. Training the Model\n\nRun the training script:\n```bash\npython main.py\n```\n\n- **Adjust Parameters**: Modify the `LEARNING_RATE`, `BATCH_SIZE`, and `EPOCHS` directly in the `train.py` script.\n\n### 3. Model Inference\n\nTo use the trained model for inference:\n```python\nimport torch\nfrom unet import UNet\nfrom carvana_dataset import CarvanaDataset\n\nmodel = UNet(in_channels=3, n_classes=1)\nmodel.load_state_dict(torch.load('unet.pth'))\nmodel.eval()\n\n# Load and preprocess your image, then pass it through the model\n```\n\n## Dataset\n\nThe model was trained and evaluated on the [Carvana Image Masking Challenge](https://www.kaggle.com/c/carvana-image-masking-challenge) dataset, which consists of high-resolution images of cars and their corresponding masks.\n\n### Preprocessing\n\n- Images are resized to `256x256` pixels.\n- The dataset is split into training (80%) and validation (20%) sets.\n\n## Training\n\n- **Optimizer**: `AdamW` with a learning rate of `3e-4`.\n- **Loss Function**: `Binary Cross-Entropy with Logits` (`BCEWithLogitsLoss`).\n- **Batch Size**: `8` (modifiable)\n- **Epochs**: `2` (modifiable)\n\n## Results\n\nResults can be monitored during training with loss values printed for both training and validation datasets. Final model weights are saved as `unet.pth`.\n\n## References\n\n- [Original U-Net Paper](https://arxiv.org/abs/1505.04597)\n- [Carvana Image Masking Challenge](https://www.kaggle.com/c/carvana-image-masking-challenge)\n\n## Acknowledgments\n\nThis implementation is inspired by the U-Net model described by Ronneberger et al. (2015). Special thanks to the authors and the open-source community for making such implementations accessible.\n\n---\n\n### Additional Notes:\n\n- Customize the above sections based on your specific implementation details.\n- If you have more sections (e.g., about performance metrics, or additional datasets), feel free to add them to the README.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramodyasahan%2Funet-biomedical-segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpramodyasahan%2Funet-biomedical-segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramodyasahan%2Funet-biomedical-segmentation/lists"}