Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
wuliChengKun 77af4433b0 | 1 year ago | |
---|---|---|
.gitignore | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
convert_deeplab_resnet.py | 1 year ago | |
create_h5.py | 1 year ago | |
deeplab_resnet.py | 1 year ago | |
dummy_list.txt | 1 year ago | |
evalpyt.py | 1 year ago | |
evalpyt2.py | 1 year ago | |
init_net_surgery.py | 1 year ago | |
test.prototxt | 1 year ago | |
test_513.prototxt | 1 year ago | |
test_Scale1.prototxt | 1 year ago | |
train.py | 1 year ago |
DeepLab resnet v2 model implementation in pytorch.
The architecture of deepLab-ResNet has been replicated exactly as it is from the caffe implementation. This architecture calculates losses on input images over multiple scales ( 1x, 0.75x, 0.5x ). Losses are calculated individually over these 3 scales. In addition to these 3 losses, one more loss is calculated after merging the output score maps on the 3 scales. These 4 losses are added to calculate the total loss.
18 July 2017
evalpyt2.py
. The old evaluation script evalpyt.py
uses a different methodoloy to take mean of IOUs than the one used by authors. Results section has been updated to incorporate this change.24 June 2017
The older version (prior to 24 June 2017) is available here.
Note that this repository has been tested with python 2.7 only.
To convert the caffemodel released by authors, download the deeplab-resnet caffemodel (train_iter_20000.caffemodel
) pretrained on VOC into the data folder. After that, run
python convert_deeplab_resnet.py
to generate the corresponding pytorch model file (.pth). The generated .pth snapshot file can be used to get the exsct same test performace as offered by using the caffemodel in caffe (as shown by numbers in results section). If you do not want to generate the .pth file yourself, you can download it here.
To run convert_deeplab_resnet.py
, deeplab v2 caffe and pytorch (python 2.7) are required.
If you want to train your model in pytorch, move to the next section.
Step 1: Convert init.caffemodel
to a .pth file: init.caffemodel
contains MS COCO trained weights. We use these weights as initilization for all but the final layer of our model. For the last layer, we use random gaussian with a standard deviation of 0.01 as the initialization.
To convert init.caffemodel
to a .pth file, run (or download the converted .pth here)
python init_net_surgery.py
To run init_net_surgery .py
, deeplab v2 caffe and pytorch (python 2.7) are required.
Step 2: Now that we have our initialization, we can train deeplab-resnet by running,
python train.py
To get a description of each command-line arguments, run
python train.py -h
To run train.py
, pytorch (python 2.7) is required.
By default, snapshots are saved in every 1000 iterations in the data/snapshots.
The following features have been implemented in this repository -
poly
lr decay policy. A weight decay has been used. The last layer has 10
times the learning rate of other layers.use_global_stats = True
is reproduced during training. Running mean and variance are not calculated during training.When run on a Nvidia Titan X GPU, train.py
occupies about 11.9 GB of memory.
Evaluation of the saved models can be done by running
python evalpyt.py
To get a description of each command-line arguments, run
python evalpyt.py -h
When trained on VOC augmented training set (with 10582 images) using MS COCO pretrained initialization in pytorch, we get a validation performance of 72.40%(evalpyt2.py
, on VOC). The corresponding .pth file can be downloaded here. This is in comparision to 75.54% that is acheived by using train_iter_20000.caffemodel
released by authors, which can be replicated by running this file . The .pth
model converted from .caffemodel
using the first section also gives 75.54% mean IOU.
A previous version of this file reported mean IOU of 78.48% on the pytorch trained model which is caclulated in a different way (evalpyt.py
, Mean IOU is calculated for each image and these values are averaged together. This way of calculating mean IOU is different than the one used by authors).
To replicate this performance, run
train.py --lr 0.00025 --wtDecay 0.0005 --maxIter 20000 --GTpath <train gt images path here> --IMpath <train images path here> --LISTpath data/list/train_aug.txt
The model presented in the results section was trained using the augmented VOC train set which was released by this paper. You may download this augmented data directly from here.
Note that this code can be used to train pytorch-deeplab-resnet model for other datasets also.
A part of the code has been borrowed from https://github.com/ry/tensorflow-resnet.
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》