mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Providing loading progress for the Web version API for Wasm and Model card

Open edankwan opened this issue 1 year ago • 4 comments

MediaPipe Solution (you are using)

All

Programming language

Javascript

Are you willing to contribute it

None

Describe the feature and the current behaviour/state

The file sizes of both wasm and model cards can be massive. Around 10MB each. It will be great if the web user can get the current loading progress

Will this change the current API? How?

No response

Who will benefit with this feature?

Any web user

Please specify the use cases for this feature

Anyone who are not one a ultra fast internet can have like 10 seconds load time for the library to be ready to use. Having an API to allow developers to implement the loading bar to show the progress of their application would be a great help.

Any Other info

No response

edankwan avatar Feb 25 '24 11:02 edankwan

I got this problem as well. However, we can use assets preload library and track the progress without relying on Mediapipe, then convert the loaded assets to blob urls. Similar to this:

await preload.start()

holistic = new Holistic({
          locateFile: function (file) {
                    const binary = preload.binary(file);
                    const blob = new Blob([binary], { type: "application/wasm" })
                    return URL.createObjectURL(blob)
          },
        });

Some solution loading .wasm file needs the mimetype to be "application/wasm"

hohoaisan avatar Feb 26 '24 10:02 hohoaisan

I got this problem as well. However, we can use assets preload library and track the progress without relying on Mediapipe, then convert the loaded assets to blob urls. Similar to this:

await preload.start()

holistic = new Holistic({
          locateFile: function (file) {
                    const binary = preload.binary(file);
                    const blob = new Blob([binary], { type: "application/wasm" })
                    return URL.createObjectURL(blob)
          },
        });

Some solution loading .wasm file needs the mimetype to be "application/wasm"

Is it the legacy API? I am using the faceLandmarker at the moment, I can only manage to preload the model but not the wasm.

edankwan avatar Feb 26 '24 20:02 edankwan

Hello @edankwan Thank you for suggesting this feature! It aligns well with current web development trends and presents a valuable addition to MediaPipe. We'll discuss it with the team and prioritize it in our roadmap. (As a side note, the API being used by @hohoaisan is legacy API)

ayushgdev avatar Feb 28 '24 06:02 ayushgdev

@ayushgdev Any update?

galharth avatar Apr 18 '24 11:04 galharth