encoder_decoder modified to avoid bugs when running PSPNet.

getting_started.md bug fixed.
pull/58/head
johnzja 2020-08-18 18:43:55 +08:00
parent adb1f0d6b7
commit dd0aadfb04
2 changed files with 2 additions and 2 deletions
mmseg/models/segmentors

View File

@ -338,7 +338,7 @@ The final output filename will be `psp_r50_512x1024_40ki_cityscapes-{hash id}.pt
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.
```shell
python tools/pytorch2onnx.py ${CONFIG_FILE} --checkpoint ${CHECKPOINT_FILE} --output_file ${ONNX_FILE} [--shape ${INPUT_SHAPE} --verify]
python tools/pytorch2onnx.py ${CONFIG_FILE} --checkpoint ${CHECKPOINT_FILE} --output-file ${ONNX_FILE} [--shape ${INPUT_SHAPE} --verify]
```
**Note**: This tool is still experimental. Some customized operators are not supported for now.

View File

@ -196,7 +196,7 @@ class EncoderDecoder(BaseSegmentor):
count_mat[:, :, y1:y2, x1:x2] += 1
assert (count_mat == 0).sum() == 0
# We want to regard count_mat as a constant while exporting to ONNX
count_mat = torch.from_numpy(count_mat.detach().numpy())
count_mat = torch.from_numpy(count_mat.cpu().detach().numpy())
preds = preds / count_mat
if rescale:
preds = resize(