Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use MediaPipeTasksVision with OpenCV on iOS. #5834

Open
v-hogood opened this issue Jan 21, 2025 · 3 comments
Open

Can't use MediaPipeTasksVision with OpenCV on iOS. #5834

v-hogood opened this issue Jan 21, 2025 · 3 comments
Assignees
Labels
platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe type:support General questions

Comments

@v-hogood
Copy link

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

No

OS Platform and Distribution

iOS 15.0

MediaPipe Tasks SDK version

0.10.14

Task name (e.g. Image classification, Gesture recognition etc.)

MediaPipeTasksVision

Programming Language and version (e.g. C++, Python, Java)

Swift

Describe the actual behavior

Build fails with 346 duplicate symbols.

Describe the expected behaviour

Build succeeds.

Standalone code/steps you may have used to try to get what you need

https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/image_classification/ios

Other info / Complete Logs

In the image_classification example add:
pod 'OpenCV-Dynamic-Framework'
to the Podfile.
Then try to build in Xcode and get:
duplicate symbol '_OBJC_CLASS_$_MatOfPoint3f' in:
    /Users/howardgood/Library/Developer/Xcode/DerivedData/ImageClassifier-dkioidhfgemwblbcqjglkdhicnlo/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/MediaPipeTasksCommon/MediaPipeTasksCommon.framework/MediaPipeTasksCommon[1628](MatOfPoint3f.o)
    /Users/howardgood/Library/Developer/Xcode/DerivedData/ImageClassifier-dkioidhfgemwblbcqjglkdhicnlo/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/OpenCV-Dynamic-Framework/opencv2.framework/opencv2[arm64][1006](MatOfPoint3f.o)
etc. etc.
@v-hogood
Copy link
Author

MediaPipeTasksCommon xcframework should hide its public symbols like TensorFlowLite xcframework does:

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/ios/ios.bzl#L93

@kuaashish kuaashish assigned kuaashish and unassigned kalyan2789g Jan 22, 2025
@kuaashish kuaashish added platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe type:support General questions labels Jan 22, 2025
@schmidt-sebastian
Copy link
Collaborator

Hello - unfortunately, our setup makes hiding the symbols quite difficult since we need to reference the symbols from multiple Pods (MediaPipeTasksCommon and MediaPipeTasksVisions are the main ones). Are you able to build from source and create a single static library? Then symbol hiding becomes much more feasible.

@v-hogood
Copy link
Author

v-hogood commented Feb 5, 2025

I looked and all 346 OpenCV symbols are coming from MediaPipeTasksCommon, so I guess they need to be hidden there and whatever functionality MediaPipeTasksVision etc. uses needs to be wrapped with MediaPipe functions right?

I can try building from source but I'm sure I'm not the only one who's going to want MediaPipe with OpenCV. Can you point me at build instructions or even better build scripts for iOS and Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:ios MediaPipe IOS issues task::all All tasks of MediaPipe type:support General questions
Projects
None yet
Development

No branches or pull requests

4 participants