I’m converting an ocr model to onnx through script-based onnx exporter like https://pytorch.org/docs/stable/onnx.html#tracing-vs-scripting
But I met this error:
Traceback (most recent call last):
File "ocr.py", line 52, in <module>
class OCR(nn.Module):
File "ocr.py", line 59, in OCR
@torch.jit.script
File "/home/dai/py36env/lib/python3.6/site-packages/torch/jit/__init__.py", line 1226, in script
fn = torch._C._jit_script_compile(qualified_name, ast, _rcb, get_default_args(obj))
RuntimeError:
Unknown builtin op: aten::east.
Here are some suggestions:
aten::hash
aten::wait
aten::dist
aten::list
aten::cat
The original call is:
at ocr.py:75:16
TGT_WIDTH = 800
if w_raw > TGT_WIDTH:
ratio = w_raw / TGT_WIDTH
img_tensor = torch.ops.my_ops.resize(img_tensor.float(),TGT_WIDTH, int(h_raw / ratio),3)
img_tensor = resize_img(img_tensor)
# self.show(img_tensor)
img_tensor_ = (img_tensor - 0.5) / 0.5
img_tensor_ = img_tensor_.permute(2,0,1).unsqueeze(0) # --> n x c x h x w
boxes = self.east(img_tensor_)
~~~~~~~~~ <--- HERE
# self.show(img_tensor,boxes)
new_boxes = []
pass_list:List[int] = []
for i in range(boxes.size(0)):
for j in range(i+1,boxes.size(0)):
if i in pass_list or j in pass_list:
continue
cx1,cy1,angle1 = box_analyse(boxes[i])
cx2,cy2,angle2 = box_analyse(boxes[j])
self.east is a detection model, how can I export the whole ocr model(detection and recognition model) to onnx?