Skip to content

Commit 79e13e5

Browse files
author
chenjun2hao
committed
onnx with cpu
1 parent 1daf52a commit 79e13e5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/to_onnx.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def parse_args():
2727

2828
parser.add_argument('--cfg',
2929
help='experiment configure file name',
30-
default="experiments/cityscapes/ddrnet23_slim.yaml",
30+
default="experiments/cityscapes/ddrnet23.yaml",
3131
type=str)
3232
parser.add_argument('opts',
3333
help="Modify config options using the command-line",
@@ -81,7 +81,7 @@ def main():
8181
# model_state_file = os.path.join(final_output_dir, 'final_state.pth')
8282
logger.info('=> loading model from {}'.format(model_state_file))
8383

84-
pretrained_dict = torch.load(model_state_file)
84+
pretrained_dict = torch.load(model_state_file, map_location='cpu')
8585
if 'state_dict' in pretrained_dict:
8686
pretrained_dict = pretrained_dict['state_dict']
8787
model_dict = model.state_dict()
@@ -100,8 +100,7 @@ def main():
100100
x = torch.randn((1,3,480,640))
101101
torch_out = net(x)
102102

103-
# output_path = "output/tensorrt/resnet50/resnet50_bilinear.onnx"
104-
output_path = "output/ddrnet23_slim.onnx"
103+
output_path = "output/ddrnet23.onnx"
105104
torch.onnx.export(net, # model being run
106105
x, # model input (or a tuple for multiple inputs)
107106
output_path, # where to save the model (can be a file or file-like object)

0 commit comments

Comments
 (0)