BACCMED
February 27, 2024, 1:12pm
1
Hi to All,
I have a workflow who execute a python code.
I invoked an IA Model with this code
base_options = python.BaseOptions(model_asset_path=‘pose_landmarker_heavy.task’)
It works fine.
But when i execute another workflow and re execute my precedent worklow it crashes
Unable to open file at C:\Users\User\AppData\Local\python-3.11.0-embed-amd64/C:\Users\User\AppData\Local\python-3.11.0-embed-amd64\pose_landmarker_heavy.task, errno=22
it seems that OpenRPA duplicate concaténation embeddeb path.
Please Help.
try setting model_asset_path
to the full path and filename, and not just the filename
( either ./pose_landmarker_heavy.task or C:\Users\User\AppData\Local\python-3.11.0-embed-amd64/pose_landmarker_heavy.task )
BACCMED
February 28, 2024, 1:35pm
3
Thank you for your help .
I tried to set the fuul path but the same error persist.
I think it’s a google MediaPipe issue
I taked a look on mediapipe github and i find this
opened 02:05AM - 07 Jun 23 UTC
closed 01:43AM - 12 Aug 23 UTC
platform:python
legacy:pose
type:bug
type:tasks
### Have I written custom code (as opposed to using a stock example script provi… ded in MediaPipe)
No
### OS Platform and Distribution
Macos or window
### 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
python 3.10.8
### MediaPipe version
_No response_
### Bazel version
_No response_
### Solution
all modules,such as facelandmark,pose
### 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
```shell
import mediapipe
import gc
###first load 《mediapipe.solutions.pose.Pose》 module
pos=mediapipe.solutions.pose.Pose(
static_image_mode=True,
model_complexity=1,
enable_segmentation=False,
min_detection_confidence=0.5)
del pos
del mediapipe
gc.collect()
###then load 《mediapipe.tasks.vision》 module
import mediapipe
model_path="D:/project/webui/extensions/aftk/extratool/keypose/pose_landmarker_heavy.task"
mediapipe.tasks.vision.PoseLandmarker.create_from_model_path(model_path)
```
### Describe the expected behaviour
```shell
import mediapipe
import gc
###first load 《mediapipe.solutions.pose.Pose》 module
pos=mediapipe.solutions.pose.Pose(
static_image_mode=True,
model_complexity=1,
enable_segmentation=False,
min_detection_confidence=0.5)
del pos
del mediapipe
gc.collect()
###then load 《mediapipe.tasks.vision》 module
import mediapipe
model_path="D:/project/webui/extensions/aftk/extratool/keypose/pose_landmarker_heavy.task"
mediapipe.tasks.vision.PoseLandmarker.create_from_model_path(model_path)
```
### Standalone code/steps you may have used to try to get what you need
```shell
import mediapipe
import gc
poes=mediapipe.solutions.pose.Pose(
static_image_mode=True,
model_complexity=1,
enable_segmentation=False,
min_detection_confidence=0.5)
del poes
del mediapipe
gc.collect()
import mediapipe
model_path="D:/project/webui/extensions/aftk/extratool/keypose/pose_landmarker_heavy.task"
mediapipe.tasks.vision.PoseLandmarker.create_from_model_path(model_path)
发生异常: RuntimeError
Unable to open file at D:\ProgramData\Miniconda3\envs\webui\lib\site-packages/D:\project\webui\extensions\aftk\extratool\keypose\pose_landmarker_heavy.task, errno=22
File "D:\project\webui\extensions\test\mm.py", line 66, in <module>
vision.PoseLandmarker.create_from_model_path(model_path)
RuntimeError: Unable to open file at D:\ProgramData\Miniconda3\envs\webui\lib\site-packages/D:\project\webui\extensions\aftk\extratool\keypose\pose_landmarker_heavy.task, errno=22
```
### Other info / Complete Logs
```shell
the task file path changed by base_vision_task_api.py ,unexpected prefix which is “D:\ProgramData\Miniconda3\envs\webui\lib\site-packages/” was added。
```
BACCMED
February 28, 2024, 3:59pm
4
I find a workaround for this
If you want to load a model you must use a buffer instead to call a model path like this
with open(r’C:\Users\User\AppData\Local\python-3.11.0-embed-amd64\pose_landmarker_heavy.task’, ‘rb’) as file:
model_data = file.read()
base_options=python.BaseOptions(model_asset_buffer=model_data)
1 Like
Thank you for sharing the solution.
system
Closed
March 2, 2024, 11:01pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.