Open diegogranziol opened 1 year ago
Hello, did you resolve the issue?
Hello @Razamalik4497, this model cannot be converted to CoreML. Even what you do manage ends up being complete garbage. Try the set of models on mmpose.
Thanks for a quick response, I just starting research on it if I found something related I will share with.
I believe you have searched a lot about it, I just trying myself.
You are right I will use either mmpose or movenet then.
On Mon, Feb 20, 2023, 4:56 PM Diego Granziol @.***> wrote:
Hello @Razamalik4497 https://github.com/Razamalik4497, this model cannot be converted to CoreML. Even what you do manage ends up being complete garbage. Try the set of models on mmpose.
— Reply to this email directly, view it on GitHub https://github.com/WongKinYiu/yolov7/issues/1266#issuecomment-1436856617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL3THUM4TM7ABLZKFSGX45LWYNLVLANCNFSM6AAAAAATCOKQKE . You are receiving this because you were mentioned.Message ID: @.***>
I would really like to convert https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6-pose.pt to CoreML but the output is incorrect. Essentially the model.model[-1].export = True, removes the 0th output which is what is used for predictions in https://github.com/WongKinYiu/yolov7/blob/main/tools/keypoint.ipynb. I have attempted some work arounds that have all met with failure.
For example, this is a work around
`
Wrap the Model to Allow Tracing*
from torch import nn class WrappedYolo(nn.Module):
Trace the Wrapped Model
traceable_model = WrappedYolo().eval() trace = torch.jit.trace(traceable_model, tensor_new) ct_model = ct.convert(trace, inputs=[ct.ImageType('image', shape=(640,640), scale=1 / 255.0, bias=[0, 0, 0])])
ValueError: Core ML only supports tensors with rank <= 5. Layer "model.model.118.anchor_grid", with type "const", outputs a rank 6 tensor.