title: Convert Pytorch Yolact (.pth) model for deployment in C++
body: <p>I am using <a href="https://github.com/dbolya/yolact" rel="nofollow noreferrer">YOLACT++</a> and I want to deploy it using C++. Originally the model is saved as yolact.pth file and I realized from the issues that I couldn't directly convert .pth to .pt file that can be called in C++ <a href="https://github.com/dbolya/yolact/issues/59" rel="nofollow noreferrer">see this issue</a> and I would need to do convert it first to ONNX which gives out yolact.onnx as the output. I converted it to ONNX using <a href="https://github.com/dbolya/yolact/issues/74#issuecomment-510713725" rel="nofollow noreferrer">this</a> solution in the issues and in the comments below this one you can see the terminal commands he uses to achieve the yolact.onnx converted model from yolact.pth.</p>
  <p>So my issue is I don't really understand what to do next to deploy it using C++. Should I be looking for solutions to convert from yolact.onnx to yolact.pt or can yolact.onnx be called from C++? There's an interesting direction given in one of the issues <a href="https://github.com/dbolya/yolact/issues/59#issuecomment-501609792" rel="nofollow noreferrer">here</a> for this work flow: <strong>Pytorch-&gt;ONNX-&gt;NCNN</strong> which he tested with C++ inference on ARM device. Is this what I am looking for. I am not very familiar with C++ so I dont know the direction.</p>
  <p>I also tried adding this to end of of eval.py where model is being called:</p>
  <pre><code>    sm = torch.jit.script(net)
      sm.save(&quot;Yolact.pt&quot;)
      
  </code></pre>
  <p>and I got error:</p>
  <pre><code>    torch.jit.frontend.UnsupportedNodeError: with statements aren't 
      supported: (line 570 in yolact.py)
  </code></pre>
  <p>and line 570 is:</p>
  <pre><code>     with timer.env('backbone'):
  </code></pre>
  <p>I commented it out and it gave error on the next &quot;timer.env&quot; in line 574 and so on!</p>