Skip to content

wasi_nn_openvino.c: implement multiple models per instance #4380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yamt
Copy link
Collaborator

@yamt yamt commented Jun 17, 2025

tested with two models: (with #4379)

--load-graph=id=graph1,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.xml,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.bin \
--load-graph=id=graph2,file=classify/model.xml,file=classify/model.bin \
--init-execution-context=id=exec1,graph-id=graph1 \
--init-execution-context=id=exec2,graph-id=graph2 \
--set-input=context-id=exec1,dim=1,dim=24,dim=94,dim=3,file=out.bin \
--set-input=context-id=exec2,file=classify/banana-3x224x224-bgr.bin,dim=1,dim=3,dim=224,dim=224 \
--compute=context-id=exec1 \
--compute=context-id=exec2 \
--get-output=context-id=exec1,file=exec1-result.bin \
--get-output=context-id=exec2,file=exec2-result.bin

tested with two models:
```
--load-graph=id=graph1,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.xml,file=public/license-plate-recognition-barrier-0007/FP32/license-plate-recognition-barrier-0007.bin \
--load-graph=id=graph2,file=classify/model.xml,file=classify/model.bin \
--init-execution-context=id=exec1,graph-id=graph1 \
--init-execution-context=id=exec2,graph-id=graph2 \
--set-input=context-id=exec1,dim=1,dim=24,dim=94,dim=3,file=out.bin \
--set-input=context-id=exec2,file=classify/banana-3x224x224-bgr.bin,dim=1,dim=3,dim=224,dim=224 \
--compute=context-id=exec1 \
--compute=context-id=exec2 \
--get-output=context-id=exec1,file=exec1-result.bin \
--get-output=context-id=exec2,file=exec2-result.bin
```
Copy link
Collaborator

@lum1n0us lum1n0us left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind providing detailed instructions so people, like me, can reproduce it locally?

@yamt
Copy link
Collaborator Author

yamt commented Jun 19, 2025

Would you mind providing detailed instructions so people, like me, can reproduce it locally?

the classification model/input are taken from WasmEdge-WASINN-examples/openvino-mobilenet-raw.
i guess you are familiar with it.
(i think i transposed the input tensor manually to match the shape. but it isn't essential to test this PR.)

you can prepare license-plate-recognition-barrier-0007 model by

git clone https://github.com/openvinotoolkit/open_model_zoo

virtualenv venv
. ./venv/bin/activate

pip install openvino-dev
pip install -r open_model_zoo/tools/model_tools/requirements-tensorflow.in
pip install open_model_zoo/tools/model_tools

omz_downloader --name license-plate-recognition-barrier-0007
omz_converter --name license-plate-recognition-barrier-0007

i don't remember how i prepared out.bin.
i guess i cropped https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/license-plate-recognition-barrier-0007/assets/license-plate-recognition-barrier-0007.png manually and converted it with a one-time python script using opencv and numpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants