{"id":20041729,"url":"https://github.com/ajithvcoder/unet-pytorch-customdataset","last_synced_at":"2025-05-05T08:32:27.024Z","repository":{"id":158818429,"uuid":"634258529","full_name":"ajithvcoder/UNet-Pytorch-Customdataset","owner":"ajithvcoder","description":"Unet pytorch on Custom dataset","archived":false,"fork":false,"pushed_at":"2023-05-07T08:35:00.000Z","size":24797,"stargazers_count":12,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T19:48:15.394Z","etag":null,"topics":["colab-notebook","deep-learning","pytorch","segmentation","unet-image-segmentation"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajithvcoder.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}},"created_at":"2023-04-29T14:54:20.000Z","updated_at":"2025-02-17T05:47:00.000Z","dependencies_parsed_at":"2023-05-20T18:34:01.682Z","dependency_job_id":null,"html_url":"https://github.com/ajithvcoder/UNet-Pytorch-Customdataset","commit_stats":null,"previous_names":["ajithvcoder/unet-pytorch-customdataset"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2FUNet-Pytorch-Customdataset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2FUNet-Pytorch-Customdataset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2FUNet-Pytorch-Customdataset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajithvcoder%2FUNet-Pytorch-Customdataset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajithvcoder","download_url":"https://codeload.github.com/ajithvcoder/UNet-Pytorch-Customdataset/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252466836,"owners_count":21752447,"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":["colab-notebook","deep-learning","pytorch","segmentation","unet-image-segmentation"],"created_at":"2024-11-13T10:47:38.376Z","updated_at":"2025-05-05T08:32:22.013Z","avatar_url":"https://github.com/ajithvcoder.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# U-Net: Semantic segmentation with PyTorch - Custom dataset\n\n**Offline Dataset preprocessing**\n\nMake sure the data you have satisfies following conditions\n\n- Directory tree\n```\n   - Data\n          -- imgs\n                  -- all train images\n          -- masks \n                  -- all masks (file names should be same as train images)\n```\n- Size and color space\n    - Make sure you have same size images\n    - Make sure you have RGB color space for all images\n    - if you need you can use ```utils\\\\resize_and_img_format.py`` file\n- Mask values (I have tested only for these values it might also work for multi labels but you need to adjust the classes)\n    - Make sure mask values are only two i.e either 0 or 255\n    - if you need you can use ```utils\\\\convert_to_binary.py``` file\n\n**Flood Area dataset**\n\nI have used all the offline dataset preprocessing for this [kaggle dataset](https://www.kaggle.com/datasets/faizalkarim/flood-area-segmentation) \n\n- data.zip holds the preprocessed images\n- ```unzip data.zip```\n\n**Installation**\n\n- ```pip install -r requirements```\n\n**Training**\n\n- ```python train.py --epochs 100 --batch-size 16```\n\n**Prediction**\n\n\n- Visuvalize - ```python predict.py --model ./checkpoints/checkpoint_epoch100.pth -i ./data/imgs/0.jpg --viz --output ./0_OUT.jpg```\n\n- You can use utils/blending.py to create blended image\n\nImage and mask\n\n\u003cimg src=\"./asset/0.jpg\"  width=\"250\" height=\"150\"\u003e\n\u003cimg src=\"./asset/0_OUT.jpg\"  width=\"250\" height=\"150\"\u003e\n\nBlended Segmentation : \n\n\u003cimg src=\"./asset/blended_image.jpg\"  width=\"250\" height=\"150\"\u003e\n\n\n**Colab NoteBook**\n\n- [Link](https://colab.research.google.com/drive/1aM2VOqfhwo84zSe-MS_i2JyWO8bgouqD?usp=sharing)\n\n**Credits**\n\n- [Pytorch-Unet](https://github.com/milesial/Pytorch-UNet)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajithvcoder%2Funet-pytorch-customdataset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajithvcoder%2Funet-pytorch-customdataset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajithvcoder%2Funet-pytorch-customdataset/lists"}