Giter Site home page Giter Site logo

mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageToTensorCalculator about mediapipe HOT 9 OPEN

tarakang avatar tarakang commented on May 8, 2024
mediapipe_tasks_vision_image_segmenter_imagesegmentergraph__mediapipe_tasks_components_processors_imagepreprocessinggraph__ImageToTensorCalculator

from mediapipe.

Comments (9)

tarakang avatar tarakang commented on May 8, 2024

image_format = mp.ImageFormat.SRGB if numpy_image.shape[-1] == 4: image_format = mp.ImageFormat.SRGBA elif numpy_image.shape[-1] == 3: image_format = mp.ImageFormat.SRGB If I change this to mp.ImageFormat.SRGB, I get the following error: Traceback (most recent call last):
File "/Users/kangjian/media/mult_test.py", line 115, in
process(inputs)
File "/Users/kangjian/media/mult_test.py", line 61, in process
media_pipe_image = get_mediapipe_image(numpy_image=image)
File "/Users/kangjian/media/mult_test.py", line 53, in get_mediapipe_image
return mp.Image(image_format=image_format, data=numpy_image)
RuntimeError: float image data should be either VEC32F1, VEC32F2, or VEC32F4 MediaPipe image formats.

from mediapipe.

kuaashish avatar kuaashish commented on May 8, 2024

Hi @kinarr,

I can replicate the problem in Colab Gist, as indicated by @tarakang. I encounter the same error message: "failed: Unsupported format: 9". For now, this issue does not appear to be specific to macOS. Could you please have look into this issue? From our standpoint, it appears to be a legitimate bug.

Thank you!!

from mediapipe.

kinarr avatar kinarr commented on May 8, 2024

@kuaashish I believe it's caused by the limited Image formats supported by MediaPipe but there should be a way to normalize the inputs so that it can passed to the model. Lemme take a look.

from mediapipe.

kinarr avatar kinarr commented on May 8, 2024

Oh and there's no need to preprocess the inputs like this:

inputs = inputs.astype('float32')
inputs.shape = (1,) + inputs.shape
inputs /= 255

Please see the following for the correct usage of the API:

Image GetSRGBImage(const std::string& image_path) {

GetSRGBImage(JoinPath("./", kTestDataDirectory, "mozart_square.jpg"));

These are C++ API calls but it should be similar for Python.

from mediapipe.

kinarr avatar kinarr commented on May 8, 2024

@tarakang @kuaashish Here's the working notebook for your reference: https://colab.research.google.com/drive/1B0mPPfcWCyr07CBwXgraBIkdqri5BGff?usp=sharing

download (1)

from mediapipe.

kinarr avatar kinarr commented on May 8, 2024

The model card for the MediaPipe Selfie Segmentation model provides essential information about the expected input format for the model. So PTAL here for the respective model cards for each segmentation model: https://developers.google.com/mediapipe/solutions/vision/image_segmenter#multiclass-model

As for the input features this should be helpful: https://developers.google.com/mediapipe/solutions/vision/image_segmenter#features

from mediapipe.

kinarr avatar kinarr commented on May 8, 2024

@tarakang I've added your image utility (get_mediapipe_image) in the notebook so you can uncomment it and try it out too and it should work fine.

from mediapipe.

kuaashish avatar kuaashish commented on May 8, 2024

Hi @kinarr,

Thank you, @tarakang. It appears there may be an issue with the limited image format support in Mediapipe. Could you kindly test the provided working notebook and inform us if the issue persists?

Thank you!!

from mediapipe.

github-actions avatar github-actions commented on May 8, 2024

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.

from mediapipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.