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.79k stars 5.18k forks source link

Crash on run when loading from cache #4539

Closed Perezmarc closed 1 year ago

Perezmarc commented 1 year ago

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

None

OS Platform and Distribution

iOS Safari & Chrome

Mobile device if the issue happens on mobile device

No response

Browser and version if the issue happens on browser

No response

Programming Language and version

Javascript & Typescript

MediaPipe version

@latest

Bazel version

No response

Solution

FaceLandmarker

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)

No response

Describe the actual behavior

When Running the the models face_landmarker_with_blendshapes.task and latest vision, the app crashes like half or more of the times with the following error:

[Warning] E0000 00:00:1686677186.069000 1686816 calculator_graph.cc:851] INTERNAL: CalculatorGraph::Run() failed in Run: 
Calculator::Process() for node "mediapipe_tasks_vision_face_landmarker_facelandmarkergraph__mediapipe_tasks_vision_face_detector_facedetectorgraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageToTensorCalculator" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0. [type.googleapis.com/mediapipe.StatusList='\n\x95\x03\x08\r\x12\x90\x03\x43\x61lculator::Process() for node \"mediapipe_tasks_vision_face_landmarker_facelandmarkergraph__mediapipe_tasks_vision_face_detector_facedetectorgraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageToTensorCalculator\" failed: RET_CHECK failure (third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56) roi->width > 0 && roi->height > 0 ROI width and height must be > 0.']
=== Source Location Trace: ===
third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:56
third_party/mediapipe/calculators/tensor/image_to_tensor_calculator.cc:223
third_party/mediapipe/framework/calculator_node.cc:948

If I Disable cache through the console it always works.

Describe the expected behaviour

It should run without failing.

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

async loadModels() {
    if (
      this.$store.state.company &&
      this.$store.state.company.verification_type == "VIDEO"
    ) {
      // Load Vision and facematcher
      try {
        const vision = await FilesetResolver.forVisionTasks(
          "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm"
        );
        this.faceMesh = await FaceLandmarker.createFromOptions(vision, {
          baseOptions: {
            modelAssetPath:
              "https://storage.googleapis.com/mediapipe-assets/face_landmarker_with_blendshapes.task",
            //"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task",
            //" 0.1.0-alpha-11 "
            delegate: "GPU"
          },
          runningMode: "VIDEO",
          outputFaceBlendshapes: true,
          numFaces: 1
        });
        this.$store.commit(mutationsT.UPDATE_LOADED_MODELS, true);
      } catch (error) {
        error.name = "ErrorLoadingModels: " + error.name;
        Sentry.captureException(error);
        this.$emit("manualCapture");
      }
    }
  }

Other info / Complete Logs

No response

kuaashish commented 1 year ago

Hello @Perezmarc,

We are not able to reproduce the issue. Please provide the reproducible steps to understand the issue. Thank you

github-actions[bot] commented 1 year ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 year ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No

Affan007 commented 2 months ago

@Perezmarc facing the same issue with WASM files, if loaded from the network, it worked fine, but it failed if loaded from cache. using version 0.10.13. and failing specifically on Safari 17.6