Skip to content

Commit

Permalink
Remove redundancies in pytorch2onnx (open-mmlab#160)
Browse files Browse the repository at this point in the history
* rm redundancies

* re-add some packages
  • Loading branch information
yl-1993 authored Sep 30, 2020
1 parent cc01f0d commit 93a2456
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions tools/pytorch2onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
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

Expand Down Expand Up @@ -186,11 +186,6 @@ def parse_args():
# 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')

Expand Down

0 comments on commit 93a2456

Please sign in to comment.