mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Impossible to download MP model using Streamlit

Open dflneoibnm opened this issue 1 year ago • 6 comments

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

None

OS Platform and Distribution

Web app on streamlit

MediaPipe Tasks SDK version

No response

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

Pose estimation

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

Python

Describe the actual behavior

Error13 : Permission denied

Describe the expected behaviour

Working well

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

https://github.com/dflneoibnm/stre

I made an app on streamlit using mediapipe pose estimation model.
But when Streamlit try to import the model (mp.solutions.pose.Pose(_download_model...)), it must have not the right to do so and I get an error of permission.
It works on local fine, others people managed to have it working aswell.
Is there a way to download it? Or is there a function to use mediapipe with the model directly (I downloaded the .tflite and .task files?

Thanks

Other info / Complete Logs

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script

    exec(code, module.__dict__)

  File "/mount/src/stre/0.py", line 12, in <module>

    pose = mp_pose.Pose(model_complexity=2)

  File "/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/pose.py", line 145, in __init__

    _download_oss_pose_landmark_model(model_complexity)

  File "/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/pose.py", line 100, in _download_oss_pose_landmark_model

    download_utils.download_oss_model(

  File "/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/download_utils.py", line 32, in download_oss_model

    with urllib.request.urlopen(model_url) as response, open(model_abspath,

PermissionError: [Errno 13] Permission denied: '/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/modules/pose_landmark/pose_landmark_heavy.tflite'

dflneoibnm avatar Feb 06 '24 11:02 dflneoibnm

Hi @dflneoibnm,

Currently, you are using the legacy pose solution, it has been upgraded and is now part of the Pose Landmarker Task API, offering enhanced capabilities. Please upgrade to the new API. Find documentation here and a Python implementation guide here.

For Legacy Solutions, the libraries, documentation, and source code will remain available on GitHub and through services like Maven and NPM. However, support for upgraded solutions has been discontinued. Refer to our documentation for more information. If you face issues with the new Pose Landmarker Task API implementation, report them here for assistance.

Thank you!!

kuaashish avatar Feb 06 '24 12:02 kuaashish

Do you have a real code exemple using poselandmarker task, because the one on the MP site that you sent is more than unuseful and can't be more unclear. Has someone actually used it instead of old solutions legacy? Thanks

dflneoibnm avatar Feb 06 '24 14:02 dflneoibnm

You can access the actual code examples using Colab, which are also available on the Python Overview Page. Furthermore, this platform provides information on community-reported issues on GitHub, where some may still be unresolved bugs or features, while others have already been addressed and closed.

kuaashish avatar Feb 06 '24 14:02 kuaashish

thanks, Btw, is there a way to use a model the old model .tflite if i have downloaded it. Like don't use solutions.pose.Pose() which will try to download the model but the same i will import before?

dflneoibnm avatar Feb 06 '24 14:02 dflneoibnm

Regrettably, the current functionality does not support the separation of the new .tflite from the bundle, identified as ".task". Referencing thread (https://github.com/google/mediapipe/issues/4939). we have categorized this as a feature request. It's worth noting that a similar situation may exist with the old .tflite as well.

kuaashish avatar Feb 07 '24 04:02 kuaashish

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] avatar Feb 15 '24 01:02 github-actions[bot]

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

github-actions[bot] avatar Feb 23 '24 01:02 github-actions[bot]

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

google-ml-butler[bot] avatar Feb 23 '24 01:02 google-ml-butler[bot]