This repository was archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
Add training part of PSPNet #634
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
1bacd45
add train
yuyu2172 5837310
add imagenet option to pretrained model
yuyu2172 32a7137
add imagenet support
yuyu2172 64bec89
add PSPNetResNet50
yuyu2172 77ecaf8
add eval_ade20k
yuyu2172 6cce889
delete eval_ade20k
yuyu2172 9700b6f
train_multi
yuyu2172 1b7e96f
merge
yuyu2172 1c50763
Merge remote-tracking branch 'yuyu2172/rotate-cv' into resnet-train
yuyu2172 e1ddd2d
fix train_multi
yuyu2172 570f2ed
Merge branch 'psp-50' into resnet-train
yuyu2172 3e8578d
delete polynomial_shift
yuyu2172 7482797
Merge remote-tracking branch 'yuyu2172/psp-50' into HEAD
yuyu2172 aa64842
update train
yuyu2172 885fd08
no weight decay for bn beta and gamma
yuyu2172 14c4bdd
fix
yuyu2172 f361c57
Merge remote-tracking branch 'yuyu2172/rotate-cv' into HEAD
yuyu2172 91ea07f
fix
yuyu2172 59b1615
Merge remote-tracking branch 'origin/master' into pspnet-train
yuyu2172 378c3ca
fix
yuyu2172 d8743d9
gradient scale layers that are not pretrained
yuyu2172 8f72cb7
fix validation score
yuyu2172 b219f5f
Merge remote-tracking branch 'yuyu2172/pspnet-train' into HEAD
yuyu2172 30d7473
add weight decay to aux convs
yuyu2172 1e9953d
Merge branch 'pspnet-train' of https://github.com/yuyu2172/chainercv …
yuyu2172 92a6fc3
fix arg order
yuyu2172 868dd6f
add cityscapes weights
yuyu2172 12b27c6
Merge remote-tracking branch 'yuyu2172/simplify-camvid' into HEAD
yuyu2172 dd1f730
update README
yuyu2172 8b3230e
flake8
yuyu2172 b60f3f5
fix README
yuyu2172 b70256c
Merge remote-tracking branch 'yuyu2172/ade20k-change-label' into pspn…
yuyu2172 abebe87
Merge remote-tracking branch 'yuyu2172/pspnet-train' into pspnet-train
yuyu2172 b9c5570
delete ignore_label option
yuyu2172 c5788af
Merge remote-tracking branch 'yuyu2172/simplify-camvid' into HEAD
yuyu2172 cf6d8da
add ade20k trained weights and fix tests
yuyu2172 cf2678e
Merge remote-tracking branch 'origin/master' into HEAD
yuyu2172 b139a60
add test_train_multi.py
yuyu2172 f43f891
support resnet101 in the test
yuyu2172 96c30e5
add ade20k description to the doc
yuyu2172 405b0af
remove cv2 workaround
yuyu2172 542ec0d
Merge remote-tracking branch 'origin/master' into pspnet-train
yuyu2172 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,71 @@ | ||
# Examples of Pyramid Scene Parsing Network (PSPNet) | ||
|
||
## Performance | ||
## Demo | ||
This demo downloads a pretrained model automatically if a pretrained model path is not given. | ||
``` | ||
$ python demo.py [--gpu <gpu>] [--pretrained-model <model_path>] [--input-size <size>] <image>.jpg | ||
``` | ||
|
||
## Weight Covnersion | ||
|
||
Convert `*.caffemodel` to `*.npz`. Some layers are renamed to fit ChainerCV. | ||
``` | ||
$ python caffe2npz.py <source>.caffemodel <target>.npz | ||
``` | ||
|
||
The converted weight can be downloaded from [here](https://chainercv-models.preferred.jp/pspnet_resnet101_cityscapes_converted_2018_05_22.npz). | ||
|
||
The performance on the Cityscapes dataset is as follows with single scale inference. | ||
Scores are measured by mean Intersection over Union (mIoU). | ||
|
||
| Model | Reference | ChainerCV (weight conversion) | | ||
|:-:|:-:|:-:| | ||
| Cityscapes (single scale) | 79.70 % [1] | 79.03 % | | ||
|
||
Scores are measured by mean Intersection over Union (mIoU). | ||
## Training model | ||
|
||
The model can be trained with a script `train_mutli.py`. | ||
When `cv2` and `MultiprocessIterator` are used together, the process stucks in some situation. | ||
In that case, the problem can be solved by setting the configuration of multi-threaded methods ([detail]( | ||
https://docs.chainer.org/en/stable/tips.html#my-training-process-gets-stuck-when-using-multiprocessiterator)). | ||
|
||
### Cityscapes | ||
|
||
The following table shows the performance of the models trained with our scripts. | ||
|
||
| Base model | Training Data | Reference | ChainerCV | | ||
|:-:|:-:|:-:|:-:| | ||
| Dilated ResNet50 | fine only (3K) | 76.9 % [2] | 73.99 % | | ||
| Dilated ResNet101 | fine only (3K) | 77.9 % [2] | 76.01 % | | ||
|
||
Here are the commands used to train the models included in the table. | ||
|
||
## Demo | ||
This demo downloads Cityscapes pretrained model automatically if a pretrained model path is not given. | ||
``` | ||
$ python demo.py [--gpu <gpu>] [--pretrained-model <model_path>] [--input-size <size>] <image>.jpg | ||
$ mpiexec -n 8 python3 train_multi.py --dataset cityscapes --model pspnet_resnet50 --iteration 90000 | ||
$ mpiexec -n 8 python3 train_multi.py --dataset cityscapes --model pspnet_resnet101 --iteration 90000 | ||
``` | ||
|
||
### ADE20K | ||
|
||
The following table shows the performance of the models trained with our scripts. | ||
|
||
| Base model | Reference | ChainerCV | | ||
|:-:|:-:|:-:| | ||
| Dilated ResNet50 | 41.68 % [1] | 34.97 % | | ||
| Dilated ResNet101 | | 36.55 % | | ||
|
||
Here are the commands used to train the models included in the table. | ||
|
||
## Convert Caffe model | ||
Convert `*.caffemodel` to `*.npz`. Some layers are renamed to fit ChainerCV. | ||
``` | ||
$ python caffe2npz.py <source>.caffemodel <target>.npz | ||
$ mpiexec -n 8 python3 train_multi.py --dataset ade20k --model pspnet_resnet50 --iteration 150000 | ||
$ mpiexec -n 8 python3 train_multi.py --dataset ade20k --model pspnet_resnet101 --iteration 150000 | ||
``` | ||
|
||
|
||
## Evaluation | ||
The evaluation can be conducted using [`chainercv/examples/semantic_segmentation/eval_cityscapes.py`](https://github.com/chainer/chainercv/blob/master/examples/semantic_segmentation). | ||
The evaluation can be conducted using [`chainercv/examples/semantic_segmentation/eval_semantic_segmentation.py`](https://github.com/chainer/chainercv/blob/master/examples/semantic_segmentation). | ||
|
||
|
||
## References | ||
1. Hengshuang Zhao et al. "Pyramid Scene Parsing Network" CVPR 2017. | ||
2. [chainer-pspnet by mitmul](https://github.com/mitmul/chainer-pspnet) | ||
2. https://github.com/holyseven/PSPNet-TF-Reproduce (Validation scores for Cityscapes are lacking in the original paper) | ||
3. [chainer-pspnet by mitmul](https://github.com/mitmul/chainer-pspnet) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about updating this block?
chainercv/chainercv/experimental/links/model/pspnet/pspnet.py
Lines 131 to 138 in f43f891
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it