问题在model_2,它使用
List[dict_1{}, dict_2{}]
作为输入,并且可以从模型中得到结果,但是当我使用相同的格式到onnx时,它只能得到dict_1{}
作为输入,并显示错误
from detectron2.modeling import build_model
model_2 = build_model(cfg)
from detectron2.checkpoint import DetectionCheckpointer
checkpointer = DetectionCheckpointer(model)
checkpointer.load(cfg.MODEL.WEIGHTS)
input_1 = {"image": torch.randn(3,1132,800), "height": 1200, "width": 1000}
input_2 = {"image": torch.randn(3,1132,800), "height": 1200, "width": 1000}
prediction = model_2([input_1, input_2]) #it can get results
torch.onnx.export(
model_2,
[input_1, input_2], #actually, it only get input_1, a dict, as input
"m2.onnx"
)
因此,我想知道如果我有相同输入格式的正确运行模型,我应该在导出 onnx 时选择哪种格式输入?