djukicn / loca

LOCA - A Low-Shot Object Counting Network With Iterative Prototype Adaptation (ICCV 2023)
MIT License
44 stars 4 forks source link

onnx #5

Open lcx1874000 opened 9 months ago

lcx1874000 commented 9 months ago

Hello author, there was a problem converting the onnx modelraise RuntimeError("Unsupported: ONNX export of convolution for kernel " RuntimeError: Unsupported: ONNX export of convolution for kernel of unknown shape. how should this situation be resolved,Can l provide conversion onnx scripts?

djukicn commented 9 months ago

Hi @lcx1874000, I'm not an expert on ONNX, but it seems that it doesn't like lines 97 -- 99 in loca.py because of the dynamic size. Explicitly providing the size of prototypes seems to solve the problem. Of course, you will have to do this manually for every model you want to export, but if you just want to export the provided pretrained models, adding prototypes = prototypes.view(768, 1, 3, 3) to line 100 should help.