{"id":13546195,"url":"https://github.com/pfnet-research/chainer-segnet","last_synced_at":"2025-04-13T10:27:17.415Z","repository":{"id":86583100,"uuid":"71959639","full_name":"pfnet-research/chainer-segnet","owner":"pfnet-research","description":"SegNet implementation \u0026 experiments in Chainer","archived":false,"fork":false,"pushed_at":"2017-01-05T08:30:21.000Z","size":103,"stargazers_count":42,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-21T18:08:35.934Z","etag":null,"topics":["chainer","computer-vision","deep-learning","segnet","semantic-segmentation"],"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/pfnet-research.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":"2016-10-26T02:48:59.000Z","updated_at":"2024-01-04T16:08:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"40549fa1-31c3-48c8-93e3-5b7ff999f232","html_url":"https://github.com/pfnet-research/chainer-segnet","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/pfnet-research%2Fchainer-segnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet-research%2Fchainer-segnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet-research%2Fchainer-segnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pfnet-research%2Fchainer-segnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pfnet-research","download_url":"https://codeload.github.com/pfnet-research/chainer-segnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248697478,"owners_count":21147333,"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":["chainer","computer-vision","deep-learning","segnet","semantic-segmentation"],"created_at":"2024-08-01T12:00:33.759Z","updated_at":"2025-04-13T10:27:17.394Z","avatar_url":"https://github.com/pfnet-research.png","language":"Python","funding_links":[],"categories":["Preferred Networks Research"],"sub_categories":["Services using Chainer"],"readme":"# SegNet\n\nSegNet implementation \u0026 experiments written in Chainer\n\nThis is an unofficial implementation of SegNet. This implementation doesn't use L-BFGS for optimization. This uses Adam with the default settings.\n\n## Requirements\n\n- Python 2.7.12+, 3.5.1+\n- Chainer 1.17.0+\n- scikit-learn 0.17.1\n- NumPy 1.11.0+\n- six 1.10.0\n- OpenCV 3.1.0\n  - `conda install -c https://conda.binstar.org/menpo opencv3`\n- Graphviz (To execute tests)\n  - `sudo apt-get install -y graphviz`\n\n## Download Dataset\n\n```\nbash experiments/download.sh\n```\n\nThis shell script performs download CamVid dataset from [SegNet-Tutorial](https://github.com/alexgkendall/SegNet-Tutorial) repository owned by the original auther of the SegNet paper.\n\n## Calculate dataset mean\n\n```\npython lib/calc_mean.py\n```\n\nIt produces `train_mean.npy` and `train_std.npy` to normalize inputs during training and also `train_freq.csv` to weight the softmax cross entropy loss.\n\n## Training\n\n```\nCUDA_VISIBLE_DEVICES=0 bash experiments/train.sh\n```\n\nYou can specify which GPU you want to use by using `CUDA_VISIBLE_DEVICES` environment variable. Or if you directory use `train.py` instead of prepared training shell scripts in `experimetns` dir, you can easily specify the GPU ID by using `--gpu` argment.\n\n### About train.sh\n\nTo use the preliminarily calculated coefficients to weight the softmax cross entropy in class-wise manner, add `--use_class_weight` option to the above command.\n\nWhat the shell script `train.sh` do is a simple sequential training process. Once the first training for a most outer encoder-decoder pair, start the training for the next inner pair from the saved model state of the previous training process.\n\nIf you would like to change the training settings and hyper parameters, please see the output of `python train.py --help` to check the argments it can take.\n\n## Prediction\n\nUse `predict.py` to create prediction results on the test dataset. The below script executes the prediction script for all result dirs.\n\n```\npython experiments/batch_predict.py\n```\n\n## Evaluation\n\n```\npython experiments/batch_evaluate.py\n```\n\n# Results\n\nThe below table shows the evaluation results. Each column means:\n\n- **Class weight**: It means the weight for softmax cross entropy. If class weight calculated from training labels using `lib/calc_mean.py`, it shows `Yes`. If a set of class weights copied from the original implementation (from a caffe protobuf file) are used, it shows `Original`. If no class weight is used, it shows `No`.\n- **Standardization**: It means mean subtraction and stddev division.\n- **Data Aug.**: Data augmentation by random rotation and flipping left/right, and random translation and scale jittering.\n- **# conv channels**: The number of convolution filters used for all convolutional layers in the SegNet model.\n- **End-to-End**: `Pairwise` means the way to train the SegNet in encoder-decoder pairwise manner. `Finetune` means that the model was finetuned after the pairwise training of encoder-decorder pairs in end-to-end manner. `End-to-End` means that the model was trained in end-to-end manner from the beggining to the end.\n\n**Please find the more detailed results here: [`experiments/README.md`](https://github.com/mitmul/chainer-segnet/tree/master/experiments/README.md)**\n\nThe bold numbers are better than the paper result, and bold and italic ones are the top scores in this table.\n\n| Model | Opt | Class weight | Standardization | Data Aug. | # conv channels | End-to-End | Class avg. | Global avg. |\n|:-----:|:---:|:------------:|:---------------:|:---------:|:---------------:|:----------:|:----------:|:-----------:|\n| SegNet - 4 layer (from paper) | L-BFGS   | Original | ?   | ?   | 64  | Pairwise   | 62.9 | 84.3 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | Yes | 128 | Pairwise   | _**69.8**_ | **86.0** |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 64  | Pairwise   | **68.6** | 82.2 |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 64  | Finetune   | **68.5** | 83.3 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | No  | Yes | 64  | Pairwise   | **68.0** | 82.3 |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 128 | Pairwise   | **67.3** | **86.5** |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | Yes | 128 | Finetune   | **67.3** | **86.4** |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | No  | Yes | 64  | Finetune   | **66.9** | 83.5 |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 128 | Finetune   | **66.3** | **86.2** |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | Yes | 64  | Finetune   | **65.5** | 82.9 |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 64  | Finetune   | **65.1** | 80.5 |\n| chainer-segnet | Adam (alpha=0.0001)     | Original | Yes | Yes | 64  | Pairwise   | **64.8** | 79.8 |\n| chainer-segnet | MomentumSGD (lr=0.0001) | Yes      | Yes | Yes | 64  | Pairwise   | **64.8** | 76.9 |\n| chainer-segnet | MomentumSGD (lr=0.0001) | Yes      | Yes | Yes | 64  | Finetune   | **64.7** | 79.8 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | Yes | 64  | Pairwise   | **64.4** | 81.1 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | Yes | 64  | End-to-End | 62.6 | 82.3 |\n| chainer-segnet | Adam (alpha=0.0001)     | No       | No  | Yes | 64  | Pairwise   | 58.9 | _**86.9**_ |\n| chainer-segnet | Adam (alpha=0.0001)     | No       | Yes | Yes | 64  | Finetune   | 58.0 | **85.5** |\n| chainer-segnet | Adam (alpha=0.0001)     | No       | No  | Yes | 64  | Finetune   | 57.2 | **87.0** |\n| chainer-segnet | Adam (alpha=0.0001)     | No       | Yes | Yes | 64  | Pairwise   | 56.3 | **85.8** |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | No  | 64  | Pairwise   | 56.2 | 83.9 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | No  | 64  | Finetune   | 54.1 | 83.3 |\n| chainer-segnet | Adam (alpha=0.0001)     | Yes      | Yes | No  | 64  | End-to-End | 47.0 | 80.6 |\n\n## Discussion\n\n- Several models exceeded the accuracy described in the original paper.\n- Larger number of channels leads better results.\n- The original class weights seem to be better than the ones calculated using `lib/calc_mean.py` in this repository.\n- Finetuning the model after enc-dec pairwise training improves global average accuracy but it decreases the class average accuracy in many cases.\n- Pairwise (w/ or w/o finetuning) is almost always better than completely end-to-end training.\n- Data augmentation is necessary.\n- Standardization decreases both accuracy (class avg. and global avg.) in several cases.\n\n# License\n\nMIT License (see LICENSE file).\n\n# Reference\n\n\u003e Vijay Badrinarayanan, Alex Kendall and Roberto Cipolla \"SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation.\" arXiv preprint arXiv:1511.00561, 2015\\. [PDF](http://arxiv.org/abs/1511.00561)\n\n## Official Implementation with Caffe\n\n- [alexgkendall/SegNet-Tutorial](https://github.com/alexgkendall/SegNet-Tutorial)\n- [alexgkendall/caffe-segnet](https://github.com/alexgkendall/caffe-segnet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet-research%2Fchainer-segnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpfnet-research%2Fchainer-segnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpfnet-research%2Fchainer-segnet/lists"}