-
-
Notifications
You must be signed in to change notification settings - Fork 38
Converted mediapipe palm detection coreml model cannot be deployed on IOS app #27
Comments
Sad to say, I don't own an IOS environment, so I can't test it. I'm not entirely sure if it will work, but could you please check if the CoreML model you downloaded from the following URL works? docker run -it --rm \
-v `pwd`:/home/user/workdir \
ghcr.io/pinto0309/tflite2tensorflow:latest
wget https://github.com/google/mediapipe/raw/master/mediapipe/modules/palm_detection/palm_detection_full.tflite
tflite2tensorflow \
--model_path palm_detection_full.tflite \
--flatc_path ../flatc \
--schema_path ../schema.fbs \
--output_pb
tflite2tensorflow \
--model_path palm_detection_full.tflite \
--flatc_path ../flatc \
--schema_path ../schema.fbs \
--output_coreml |
Thanks for the reply. Just test the model on the IOS, still get the same error.
I checked the layer 240 of the graph, pretty sure the ResizeBilinear caused this problem, as it has also been mentioned in many onnx->coreml conversion, e.g. : (onnx/onnx-coreml#474) I also noticed that the new height and new width in resizebilinear layer are all 0. Is that something related? Thanks |
Thanks for the reply. I also think it's a bug in coremltool. However, I try
to find a way to work around it. My initial thinking is to use upsample2d
to replace image.resize method in ResizeBilinear Op. Currently, got the
model deployed on iOS, but the size of the final output is incorrect. I
will keep tracking and let u know once I sort it out.
Katsuya Hyodo ***@***.***> 于 2022年2月16日周三 下午2:34写道:
… I don't think the number 240 in the error message is directly related to
the error. The error occurs in the operation named
*model_1/model/add_24/add*.
[Exception from layer 240: model_1/model/add_24/add]Espresso exception: "Invalid blob shape": elementwise_kernel_cpu: Cannot broadcast [12, 2, 1, 256, 1] and [12, 1, 1, 256, 1] status=-1
[image: image]
<https://user-images.githubusercontent.com/33194443/154284738-9a42f361-3645-4248-983c-df8bad275b36.png>
The shape of the tensor shown in the error message is obviously wrong.
Cannot broadcast [12, 2, 1, 256, 1] and [12, 1, 1, 256, 1]
This is because there are no operations in this model that process in 5
dimensions.
I also noticed that the new height and new width in resizebilinear layer
are all 0. Is that something related?
No, not at all. It is correct that *new_height* and *new_width* are set
to zero, as per the specification. Since the second input is set to *[24,
24]*, *ResizeBilinear (upsample)* will produce an output of size 24 in
height and width.
[image: image]
<https://user-images.githubusercontent.com/33194443/154285717-5a510b64-e6f6-4bf0-8fcd-240956d6df76.png>
The way I see it, it's a bug in CoreML.
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AV7EQ3SUWDMYQY3PDEUKVZLU3OYV7ANCNFSM5ORKIUNQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi, Katsuya I am glad to tell you I find a way to work around. I was inspired by this article https://machinethink.net/blog/coreml-upsampling/ (go to the Cheatsheet section)
|
I see. I will add an option to enable CoreML optimization. Thank you for doing some meaningful research! 😸 |
Issue Type
Bug
OS
Mac OS
OS architecture
x86_64
Programming Language
Python
Framework
CoreML
Download URL for tflite file
https://github.com/google/mediapipe/blob/master/mediapipe/modules/palm_detection/palm_detection_full.tflite
Convert Script
Description
when I deployed the converted mp palm detection coreml model on IOS app, I got error like:
seems like the resizeBilinear op causes this problem. Is there any way to fix this issue? Thanks in advance.
The related code in tflite2tensorlfow.py is:
Relevant Log Output
Source code for simple inference testing code
No response
The text was updated successfully, but these errors were encountered: