Remove redundancies in pytorch2onnx (#160)

* rm redundancies

* re-add some packages
This commit is contained in:
Lei Yang 2020-09-30 10:11:34 +08:00 committed by GitHub
parent e1f4f51dc6
commit f70507168f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,11 +5,11 @@ import mmcv
import numpy as np
import onnxruntime as rt
import torch
from torch import nn
import torch._C
import torch.serialization
from mmcv.onnx import register_extra_symbolics
from mmcv.runner import load_checkpoint
from torch import nn
from mmseg.models import build_segmentor
@ -186,11 +186,6 @@ if __name__ == '__main__':
# convert SyncBN to BN
segmentor = _convert_batchnorm(segmentor)
if isinstance(segmentor.decode_head, nn.ModuleList):
num_classes = segmentor.decode_head[-1].num_classes
else:
num_classes = segmentor.decode_head.num_classes
if args.checkpoint:
load_checkpoint(segmentor, args.checkpoint, map_location='cpu')