Skip to content

Commit 67ba9a2

Browse files
authored
deeplabv3 bug fix (#754)
Co-authored-by: Fzilan <[email protected]>
1 parent 9c6dc67 commit 67ba9a2

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

examples/seg/deeplabv3/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This example provides implementations of DeepLabV3 and DeepLabV3+ using backbone
5151

5252
* Download Pascal VOC 2012 dataset, [VOC2012](http://host.robots.ox.ac.uk/pascal/VOC/voc2012/) and Semantic Boundaries Dataset, [SBD](https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic_contours/benchmark.tgz).
5353

54-
* Prepare training and test data list files with the path to image and annotation pairs. You could simply run `python examples/seg/deeplabv3/preprocess/get_dataset_list.py --data_root=/path/to/data` to generate the list files. This command results in 5 data list files. The lines in a list file should be like as follows:
54+
* Prepare training and test data list files with the path to image and annotation pairs. You could simply run `python examples/seg/deeplabv3/preprocess/get_data_list.py --data_root=/path/to/data` to generate the list files. This command results in 5 data list files. The lines in a list file should be like as follows:
5555

5656
```
5757
/path/to/data/JPEGImages/2007_000032.jpg /path/to/data/SegmentationClassGray/2007_000032.png
@@ -116,20 +116,20 @@ python examples/seg/deeplabv3/train.py --config [the path to the config file]
116116

117117
```shell
118118
# for deeplabv3
119-
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/deeplabv3_s16_dilated_resnet101.yaml
119+
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/config/deeplabv3_s16_dilated_resnet101.yaml
120120

121121
# for deeplabv3+
122-
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/deeplabv3plus_s16_dilated_resnet101.yaml
122+
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/config/deeplabv3plus_s16_dilated_resnet101.yaml
123123
```
124124

125125
- Step 2: Employ output_stride=8, fine-tune model from step 1 on *trainaug* dataset with smaller base learning rate. In config file, please specify the path of checkpoint from previous step in `ckpt_path`, set `ckpt_pre_trained` to `True` and set `output_stride` to `8` .
126126

127127
```shell
128128
# for deeplabv3
129-
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/deeplabv3_s8_dilated_resnet101.yaml
129+
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/config/deeplabv3_s8_dilated_resnet101.yaml
130130

131131
# for deeplabv3+
132-
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/deeplabv3plus_s8_dilated_resnet101.yaml
132+
mpirun -n 8 python examples/seg/deeplabv3/train.py --config examples/seg/deeplabv3/config/deeplabv3plus_s8_dilated_resnet101.yaml
133133
```
134134

135135
### Test
@@ -138,7 +138,7 @@ For testing the trained model, first specify the path to the model checkpoint at
138138

139139
For example, after replacing `ckpt_path` in config file with [checkpoint](https://download.mindspore.cn/toolkits/mindcv/deeplabv3/deeplabv3_s8_resnet101-a297e7af.ckpt) from 2-step training of deeplabv3, commands below employ os=8 without left-right filpped or muticale inputs.
140140
```shell
141-
python examples/seg/deeplabv3/eval.py --config examples/seg/deeplabv3/deeplabv3_s8_dilated_resnet101.yaml
141+
python examples/seg/deeplabv3/eval.py --config examples/seg/deeplabv3/config/deeplabv3_s8_dilated_resnet101.yaml
142142
```
143143

144144
## Results

examples/seg/deeplabv3/config/deeplabv3plus_s8_dilated_resnet101.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ image_std: [57.375, 57.120, 58.395]
1818
max_scale: 2.0
1919
min_scale: 0.5
2020
ignore_label: 255
21-
num_classes: 21x
21+
num_classes: 21
2222
shuffle: True
2323

2424
# backbone

examples/seg/deeplabv3/eval.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import yaml
55
from addict import Dict
66
from data import create_segment_dataset
7-
from deeplabv3 import DeeplabInferNetwork, DeepLabV3, DeeplabV3Plus
7+
from deeplabv3 import DeepLabInferNetwork, DeepLabV3, DeepLabV3Plus
88
from dilated_resnet import * # noqa: F403, F401
99
from postprocess import apply_eval
1010

@@ -34,11 +34,11 @@ def eval(args):
3434
if args.model == "deeplabv3":
3535
deeplab = DeepLabV3(backbone, args, is_training=False)
3636
elif args.model == "deeplabv3plus":
37-
deeplab = DeeplabV3Plus(backbone, args, is_training=False)
37+
deeplab = DeepLabV3Plus(backbone, args, is_training=False)
3838
else:
3939
NotImplementedError("support deeplabv3 and deeplabv3plus only")
4040

41-
eval_model = DeeplabInferNetwork(deeplab, input_format=args.input_format)
41+
eval_model = DeepLabInferNetwork(deeplab, input_format=args.input_format)
4242

4343
param_dict = load_checkpoint(args.ckpt_path)
4444
net_param_not_load, _ = load_param_into_net(eval_model, param_dict)

0 commit comments

Comments
 (0)