lufficc / SSD

High quality, fast, modular reference implementation of SSD in PyTorch
MIT License
1.52k stars 384 forks source link

The problem of conversion from pth format model to onnx model #176

Open NOBUGW opened 4 years ago

NOBUGW commented 4 years ago

Hello, I hope there is a problem in the process of converting your pre training model to onnx. Can you help me solve it? I used: torch.onnx.export For weights / vgg ssd300 Voc0712.pth,But,The program Display"RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported type Container"

zcf2020DPL commented 3 years ago

hi,man,have you solved this question? I have the same question.

zcf2020DPL commented 3 years ago

I have solved the question,and it is not a question, postprocessor has unsupported type Container... no need postprocessor in convert to onnx, so #detections = self.post_processor(detections) in box_head.py

SamSamhuns commented 3 years ago

@zcf2020DPL , the onnx conversion can be done including the self.post_processor(detections) call in the box_head.py if the container class is not used in the Postprocessor object in ssd/modeling/box_head/inference.py.

I have created a onnx conversion script for the networks, it works for the mobilenets properly right now. @lufficc , if you check out my pull request now