{"id":15029297,"url":"https://github.com/meetps/pytorch-semseg","last_synced_at":"2025-05-14T19:08:30.233Z","repository":{"id":40438386,"uuid":"85873012","full_name":"meetps/pytorch-semseg","owner":"meetps","description":"Semantic Segmentation Architectures Implemented in PyTorch","archived":false,"fork":false,"pushed_at":"2023-10-11T05:27:04.000Z","size":279,"stargazers_count":3415,"open_issues_count":133,"forks_count":792,"subscribers_count":104,"default_branch":"master","last_synced_at":"2025-05-14T19:08:26.860Z","etag":null,"topics":["deep-learning","fully-convolutional-networks","pytorch","semantic-segmentation"],"latest_commit_sha":null,"homepage":"https://meetshah.dev/semantic-segmentation/deep-learning/pytorch/visdom/2017/06/01/semantic-segmentation-over-the-years.html","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/meetps.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":"2017-03-22T20:28:59.000Z","updated_at":"2025-05-07T13:40:22.000Z","dependencies_parsed_at":"2024-01-07T16:23:47.914Z","dependency_job_id":null,"html_url":"https://github.com/meetps/pytorch-semseg","commit_stats":{"total_commits":181,"total_committers":17,"mean_commits":"10.647058823529411","dds":"0.22099447513812154","last_synced_commit":"801fb200547caa5b0d91b8dde56b837da029f746"},"previous_names":["meetshah1995/pytorch-semseg"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meetps%2Fpytorch-semseg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meetps%2Fpytorch-semseg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meetps%2Fpytorch-semseg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meetps%2Fpytorch-semseg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meetps","download_url":"https://codeload.github.com/meetps/pytorch-semseg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254209859,"owners_count":22032897,"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":["deep-learning","fully-convolutional-networks","pytorch","semantic-segmentation"],"created_at":"2024-09-24T20:10:15.040Z","updated_at":"2025-05-14T19:08:29.168Z","avatar_url":"https://github.com/meetps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytorch-semseg\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/meetshah1995/pytorch-semseg/blob/master/LICENSE)\n[![pypi](https://img.shields.io/pypi/v/pytorch_semseg.svg)](https://pypi.python.org/pypi/pytorch-semseg/0.1.2)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1185075.svg)](https://doi.org/10.5281/zenodo.1185075)\n\n\n\n## Semantic Segmentation Algorithms Implemented in PyTorch\n\nThis repository aims at mirroring popular semantic segmentation architectures in PyTorch. \n\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.youtube.com/watch?v=iXh9aCK3ubs\" target=\"_blank\"\u003e\u003cimg src=\"https://i.imgur.com/agvJOPF.gif\" width=\"364\"/\u003e\u003c/a\u003e\n\u003cimg src=\"https://meetshah1995.github.io/images/blog/ss/ptsemseg.png\" width=\"49%\"/\u003e\n\u003c/p\u003e\n\n\n### Networks implemented\n\n* [PSPNet](https://arxiv.org/abs/1612.01105) - With support for loading pretrained models w/o caffe dependency\n* [ICNet](https://arxiv.org/pdf/1704.08545.pdf) - With optional batchnorm and pretrained models\n* [FRRN](https://arxiv.org/abs/1611.08323) - Model A and B\n* [FCN](https://arxiv.org/abs/1411.4038) - All 1 (FCN32s), 2 (FCN16s) and 3 (FCN8s) stream variants\n* [U-Net](https://arxiv.org/abs/1505.04597) - With optional deconvolution and batchnorm\n* [Link-Net](https://codeac29.github.io/projects/linknet/) - With multiple resnet backends\n* [Segnet](https://arxiv.org/abs/1511.00561) - With Unpooling using Maxpool indices\n\n\n#### Upcoming \n\n* [E-Net](https://arxiv.org/abs/1606.02147)\n* [RefineNet](https://arxiv.org/abs/1611.06612)\n\n### DataLoaders implemented\n\n* [CamVid](http://mi.eng.cam.ac.uk/research/projects/VideoRec/CamVid/)\n* [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/segexamples/index.html)\n* [ADE20K](http://groups.csail.mit.edu/vision/datasets/ADE20K/)\n* [MIT Scene Parsing Benchmark](http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip)\n* [Cityscapes](https://www.cityscapes-dataset.com/)\n* [NYUDv2](http://cs.nyu.edu/~silberman/datasets/nyu_depth_v2.html)\n* [Sun-RGBD](http://rgbd.cs.princeton.edu/)\n\n\n### Requirements\n\n* pytorch \u003e=0.4.0\n* torchvision ==0.2.0\n* scipy\n* tqdm\n* tensorboardX\n\n#### One-line installation\n    \n`pip install -r requirements.txt`\n\n### Data\n\n* Download data for desired dataset(s) from list of URLs [here](https://meetshah1995.github.io/semantic-segmentation/deep-learning/pytorch/visdom/2017/06/01/semantic-segmentation-over-the-years.html#sec_datasets).\n* Extract the zip / tar and modify the path appropriately in your `config.yaml`\n\n\n### Usage\n\n**Setup config file**\n\n```yaml\n# Model Configuration\nmodel:\n    arch: \u003cname\u003e [options: 'fcn[8,16,32]s, unet, segnet, pspnet, icnet, icnetBN, linknet, frrn[A,B]'\n    \u003cmodel_keyarg_1\u003e:\u003cvalue\u003e\n\n# Data Configuration\ndata:\n    dataset: \u003cname\u003e [options: 'pascal, camvid, ade20k, mit_sceneparsing_benchmark, cityscapes, nyuv2, sunrgbd, vistas'] \n    train_split: \u003csplit_to_train_on\u003e\n    val_split: \u003cspit_to_validate_on\u003e\n    img_rows: 512\n    img_cols: 1024\n    path: \u003cpath/to/data\u003e\n    \u003cdataset_keyarg1\u003e:\u003cvalue\u003e\n\n# Training Configuration\ntraining:\n    n_workers: 64\n    train_iters: 35000\n    batch_size: 16\n    val_interval: 500\n    print_interval: 25\n    loss:\n        name: \u003closs_type\u003e [options: 'cross_entropy, bootstrapped_cross_entropy, multi_scale_crossentropy']\n        \u003closs_keyarg1\u003e:\u003cvalue\u003e\n\n    # Optmizer Configuration\n    optimizer:\n        name: \u003coptimizer_name\u003e [options: 'sgd, adam, adamax, asgd, adadelta, adagrad, rmsprop']\n        lr: 1.0e-3\n        \u003coptimizer_keyarg1\u003e:\u003cvalue\u003e\n\n        # Warmup LR Configuration\n        warmup_iters: \u003citers for lr warmup\u003e\n        mode: \u003c'constant' or 'linear' for warmup'\u003e\n        gamma: \u003cgamma for warm up\u003e\n       \n    # Augmentations Configuration\n    augmentations:\n        gamma: x                                     #[gamma varied in 1 to 1+x]\n        hue: x                                       #[hue varied in -x to x]\n        brightness: x                                #[brightness varied in 1-x to 1+x]\n        saturation: x                                #[saturation varied in 1-x to 1+x]\n        contrast: x                                  #[contrast varied in 1-x to 1+x]\n        rcrop: [h, w]                                #[crop of size (h,w)]\n        translate: [dh, dw]                          #[reflective translation by (dh, dw)]\n        rotate: d                                    #[rotate -d to d degrees]\n        scale: [h,w]                                 #[scale to size (h,w)]\n        ccrop: [h,w]                                 #[center crop of (h,w)]\n        hflip: p                                     #[flip horizontally with chance p]\n        vflip: p                                     #[flip vertically with chance p]\n\n    # LR Schedule Configuration\n    lr_schedule:\n        name: \u003cschedule_type\u003e [options: 'constant_lr, poly_lr, multi_step, cosine_annealing, exp_lr']\n        \u003cscheduler_keyarg1\u003e:\u003cvalue\u003e\n\n    # Resume from checkpoint  \n    resume: \u003cpath_to_checkpoint\u003e\n```\n\n**To train the model :**\n\n```\npython train.py [-h] [--config [CONFIG]] \n\n--config                Configuration file to use\n```\n\n**To validate the model :**\n\n```\nusage: validate.py [-h] [--config [CONFIG]] [--model_path [MODEL_PATH]]\n                       [--eval_flip] [--measure_time]\n\n  --config              Config file to be used\n  --model_path          Path to the saved model\n  --eval_flip           Enable evaluation with flipped image | True by default\n  --measure_time        Enable evaluation with time (fps) measurement | True\n                        by default\n```\n\n**To test the model w.r.t. a dataset on custom images(s):**\n\n```\npython test.py [-h] [--model_path [MODEL_PATH]] [--dataset [DATASET]]\n               [--dcrf [DCRF]] [--img_path [IMG_PATH]] [--out_path [OUT_PATH]]\n \n  --model_path          Path to the saved model\n  --dataset             Dataset to use ['pascal, camvid, ade20k etc']\n  --dcrf                Enable DenseCRF based post-processing\n  --img_path            Path of the input image\n  --out_path            Path of the output segmap\n```\n\n\n**If you find this code useful in your research, please consider citing:**\n\n```\n@article{mshahsemseg,\n    Author = {Meet P Shah},\n    Title = {Semantic Segmentation Architectures Implemented in PyTorch.},\n    Journal = {https://github.com/meetshah1995/pytorch-semseg},\n    Year = {2017}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeetps%2Fpytorch-semseg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeetps%2Fpytorch-semseg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeetps%2Fpytorch-semseg/lists"}