yyliu01 / PS-MT

[CVPR'22] Perturbed and Strict Mean Teachers for Semi-supervised Semantic Segmentation
https://arxiv.org/pdf/2111.12903.pdf
MIT License
186 stars 17 forks source link

How can I deploy the model to ONNX? #21

Closed Ruirui-Huang closed 1 year ago

Ruirui-Huang commented 1 year ago

I use import json, onnx, torch from Model.Deeplabv3_plus.EntireMode import EntireModel as model_deep path_pth = 'epoch1.pth' path_onnx = 'model.onnx' Input = torch.randn(1, 3, 256, 256) config = json.load(open('VocCode/configs/config.json')) config['model']['data_h_w'] = [256, 256] model = model_deep(num_classes=2, config=config['model']) checkpoint = torch.load(path_pth) model.load_state_dict(chekpoint['state_dict'], strict=True) torch.onnx.export(model, Input, path_onnx, verbose=True)

AttributeError: 'dict' object has no attribute 'training'

yyliu01 commented 1 year ago

Sorry, I'm not familiar with the deployment of ONNX. I'm afraid I cannot help with this question.

Ruirui-Huang commented 1 year ago

Thank you for your reply, this issue has been resolved. Also, I would like to ask why you did not choose SOTA supervised semantic segmentation models as backbone architectures? Or consider adding work to the ablation study.