Skip to content

Commit

Permalink
Fix the bug that CityscapesSOTA is incompatible with paddle2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LutaoChu committed Dec 6, 2021
1 parent a423815 commit a976956
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
15 changes: 10 additions & 5 deletions contrib/CityscapesSOTA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ mkdir -p data/cityscapes
```

Firstly please download 3 files from [Cityscapes dataset](https://www.cityscapes-dataset.com/downloads/)
- leftImg8bit_trainvaltest.zip
- gtFine_trainvaltest.zip
- leftImg8bit_trainextra.zip
- leftImg8bit_trainvaltest.zip (11GB)
- gtFine_trainvaltest.zip (241MB)
- leftImg8bit_trainextra.zip (44GB)

Run the following commands to do the label conversion:
```shell
Expand All @@ -48,8 +48,13 @@ python ../../tools/convert_cityscapes.py --cityscapes_path data/cityscapes --num
```
Where 'cityscapes_path' should be adjusted according to the actual dataset path. 'num_workers' determines the number of processes started and the size can be adjusted according to the actual situation.

Then download Autolabelled-Data from [google drive](https://drive.google.com/file/d/1DtPo-WP-hjaOwsbj6ZxTtOo_7R_4TKRG/view?usp=sharing)
- refinement_final_v0.zip
Then download and uncompress Autolabelled-Data from [google drive](https://drive.google.com/file/d/1DtPo-WP-hjaOwsbj6ZxTtOo_7R_4TKRG/view?usp=sharing)
- refinement_final_v0.zip # This file is needed for autolabelled training for recreating SOTA

Delete useless `tmp` directory in `refinement_final` directory.
```
rm -r tmp/
```

Convert autolabelled data according to PaddleSeg data format:
```shell
Expand Down
2 changes: 1 addition & 1 deletion contrib/CityscapesSOTA/models/mscale_ocrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,5 @@ def scale_as(x, y, align_corners=False):
'''
y_shape = paddle.shape(y)
x_scaled = nn.functional.interpolate(
x, size=(y_shape[2], y_shape[3]), mode='bilinear', align_corners=align_corners)
x, size=y_shape[2:], mode='bilinear', align_corners=align_corners)
return x_scaled
4 changes: 2 additions & 2 deletions contrib/CityscapesSOTA/scripts/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def train(model,
if (iter % save_interval == 0
or iter == iters) and (val_dataset is not None):
num_workers = 1 if num_workers > 0 else 0
metircs = evaluate(
metrics = evaluate(
model,
val_dataset,
aug_eval=aug_eval,
Expand All @@ -218,7 +218,7 @@ def train(model,
stride=None,
crop_size=None,
num_workers=num_workers)
mean_iou, acc = metircs[0], metrics[1]
mean_iou, acc = metrics[0], metrics[1]
model.train()

if (iter % save_interval == 0 or iter == iters) and local_rank == 0:
Expand Down

0 comments on commit a976956

Please sign in to comment.