Skip to content

Commit dd0aadf

Browse files
committed
encoder_decoder modified to avoid bugs when running PSPNet.
getting_started.md bug fixed.
1 parent adb1f0d commit dd0aadf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ The final output filename will be `psp_r50_512x1024_40ki_cityscapes-{hash id}.pt
338338
We provide a script to convert model to [ONNX](https://github.com/onnx/onnx) format. The converted model could be visualized by tools like [Netron](https://github.com/lutzroeder/netron). Besides, we also support comparing the output results between Pytorch and ONNX model.
339339
340340
```shell
341-
python tools/pytorch2onnx.py ${CONFIG_FILE} --checkpoint ${CHECKPOINT_FILE} --output_file ${ONNX_FILE} [--shape ${INPUT_SHAPE} --verify]
341+
python tools/pytorch2onnx.py ${CONFIG_FILE} --checkpoint ${CHECKPOINT_FILE} --output-file ${ONNX_FILE} [--shape ${INPUT_SHAPE} --verify]
342342
```
343343
344344
**Note**: This tool is still experimental. Some customized operators are not supported for now.

mmseg/models/segmentors/encoder_decoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def slide_inference(self, img, img_meta, rescale):
196196
count_mat[:, :, y1:y2, x1:x2] += 1
197197
assert (count_mat == 0).sum() == 0
198198
# We want to regard count_mat as a constant while exporting to ONNX
199-
count_mat = torch.from_numpy(count_mat.detach().numpy())
199+
count_mat = torch.from_numpy(count_mat.cpu().detach().numpy())
200200
preds = preds / count_mat
201201
if rescale:
202202
preds = resize(

0 commit comments

Comments
 (0)