zhangboshen / A2J

Code for paper "A2J: Anchor-to-Joint Regression Network for 3D Articulated Pose Estimation from a Single Depth Image". ICCV2019
MIT License
289 stars 46 forks source link

How can I convert pre-trained model to coreml to use it on ios application? #62

Open sarojraut opened 1 year ago

sarojraut commented 1 year ago

I am using coremltools to do so.

import coremltools as ct
 import torch
 import torch.nn as nn

 model = torch.load('/Users/sarojraut/Downloads/side.pth',map_location=torch.device('cpu'))
 example_input = torch.rand(1, 3, 224, 224) 

 traced_model = torch.jit.trace(model, example_input)

But I get error

Traceback (most recent call last):
 File "<pyshell#34>", line 1, in <module>
 traced_model = torch.jit.trace(model, dummy_input)
 File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-   packages/torch/jit/_trace.py", line 846, in trace
 name = _qualified_name(func)
 File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site- packages/torch/_jit_internal.py", line 1145, in _qualified_name
 raise RuntimeError("Could not get name of python class object")
 RuntimeError: Could not get name of python class object