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

Cannot use MediaPipeTasksVision pod alongside TensorFlowLiteSwift pod with Metal backend #5783

Open
babldev opened this issue Dec 16, 2024 · 1 comment
Assignees
Labels
platform:ios MediaPipe IOS issues type:bug Bug in the Source Code of MediaPipe Solution

Comments

@babldev
Copy link

babldev commented Dec 16, 2024

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

No

OS Platform and Distribution

iOS 18.1.1

Mobile device if the issue happens on mobile device

iPhone 15

Browser and version if the issue happens on browser

No response

Programming Language and version

Swift

MediaPipe version

0.10.20

Bazel version

No response

Solution

Object Detection (any)

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

No response

Xcode & Tulsi version (if issue is related to building for iOS)

16.1

Describe the actual behavior

Runtime error: "objc[1064]: Class TFLBufferConvert is implemented in both /private/var/containers/Bundle/Application/D3732F45-70C8-458D-8BD7-3A8E99C8BB47/ObjectDetector.app/ObjectDetector.debug.dylib (0x106250610) and /private/var/containers/Bundle/Application/D3732F45-70C8-458D-8BD7-3A8E99C8BB47/ObjectDetector.app/ObjectDetector.debug.dylib (0x1062526e0). One of the two will be used. Which one is undefined."

Describe the expected behaviour

I should be able to use "pod 'TensorFlowLiteSwift', '~> 0.0.1-nightly', :subspecs => ['Metal']"

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

Use this Podfile

target 'ObjectDetector' do

  use_frameworks!
  pod 'MediaPipeTasksVision', '0.10.20'
  pod 'TensorFlowLiteSwift', '~> 0.0.1-nightly', :subspecs => ['Metal']
  
  # Pods for ObjectDetector
end

pod install

Build & run iOS app

Other info / Complete Logs

Most developers considering using Mediapipe in iOS apps will have separate TFLite models executed using TensorFlowLiteSwift directly. However, once the Mediapipe pod (eg MediaPipeTasksVision) is added to your podfile, existing usage of TensorFlowLiteSwift + Metal delegate will cause runtime errors. They both link to the same Obj-C code.

The Mediapipe iOS Pod should support a configuration that does not collide with TensorFlowLiteSwift Pod + Metal to allow greater iOS adoption with apps already using TFLite.

objc[1064]: Class TFLBufferConvert is implemented in both /private/var/containers/Bundle/Application/D3732F45-70C8-458D-8BD7-3A8E99C8BB47/ObjectDetector.app/ObjectDetector.debug.dylib (0x106250610) and /private/var/containers/Bundle/Application/D3732F45-70C8-458D-8BD7-3A8E99C8BB47/ObjectDetector.app/ObjectDetector.debug.dylib (0x1062526e0). One of the two will be used. Which one is undefined.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
I0000 00:00:1734382404.659640  236024 gl_context.cc:369] GL version: 3.0 (OpenGL ES 3.0 Metal - 101), renderer: Apple A16 GPU
@babldev babldev added the type:bug Bug in the Source Code of MediaPipe Solution label Dec 16, 2024
@babldev
Copy link
Author

babldev commented Dec 16, 2024

Related #3936 #2378

@kalyan2789g kalyan2789g added the platform:ios MediaPipe IOS issues label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:ios MediaPipe IOS issues type:bug Bug in the Source Code of MediaPipe Solution
Projects
None yet
Development

No branches or pull requests

2 participants