google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.41k stars 5.15k forks source link

XCode iOS - ERROR: The model is not a valid Flatbuffer buffer #5138

Open blaiseliou opened 8 months ago

blaiseliou commented 8 months ago

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

None

OS Platform and Distribution

iOS / Xcode

MediaPipe Tasks SDK version

0.10.9

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

HandLandmarker

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

Swift 5

Describe the actual behavior

The model is not getting loaded by the HandLandmarker initializer

Describe the expected behaviour

It should not throw an error

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

 let modelPath = Bundle.main.path(forResource: "hand_landmarker",
                                            ofType: "task")

      let options = HandLandmarkerOptions()
      options.baseOptions.modelAssetPath = modelPath!
      options.runningMode = .image
      options.minHandDetectionConfidence = 0.5
      options.minHandPresenceConfidence = 0.5
      options.minTrackingConfidence = 0.5
      options.numHands = 1

      do {
          let handLandmarker = try HandLandmarker(options: options)
      } catch {
          print(error)
      }

Other info / Complete Logs

hand_landmarker.task is correctly added to the project and to the target (Bundle.main.path is not nil and I can see the path), however when trying to init the HandLandmarker object I get the following error: The model is not a valid Flatbuffer buffer ERROR: The model is not a valid Flatbuffer buffer

kuaashish commented 8 months ago

Hi @blaiseliou,

Could you please provide additional information about the problem. Include the following details:

Providing this information will help us better understand and address the issue.

Thank you!!

blaiseliou commented 8 months ago

Hi @kuaashish , Thanks for coming back on it!

blaiseliou commented 8 months ago

@schmidt-sebastian @kuaashish Let me know if you need any other information from my end.

kuaashish commented 8 months ago

Hi @priankakariatyml,

Could you please take a look into this issue?

Thank you!!

BaronWj commented 3 months ago

Have you solved this problem?

priankakariatyml commented 3 months ago

Have you solved this problem?

We have not been able to reproduce this issue. Could you check if you are facing this with the latest version and if your model file is not corrupted?

We use https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/latest/hand_landmarker.task for our tests.

BaronWj commented 3 months ago

Have you solved this problem?

We have not been able to reproduce this issue. Could you check if you are facing this with the latest version and if your model file is not corrupted?

We use https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/latest/hand_landmarker.task for our tests.

I have been able to reproduce this issue。 I also rely on MediaPipeTasksVision and MNNFaceDetection。 s.dependency 'MediaPipeTasksVision', '~> 0.10.14' s.dependency 'MNNFaceDetection', '~> 0.0.4'

As you can see, I don't know what caused it?