How to run a model from python with NPU

Hi,

Is there a way to run the model (mobilenet+ssd) from a python script?
I was able to run the converted model with c++ code, but my postprocessing is written in python and it will be hard to convert everything to c++

Thanks

@Ainfinum We are sorry that there is no Python interface available.

Will there be a python interface in the future…?

Thanks

@Archangel1235 We will discuss the feasibility of python, if it can be included in our plan, but there is no affirmative reply for you at present.

Hello,

I need a python interface too.

Please let me know about it.

Thanks,

1 Like

Hi,

Can you explain how you run the model inside C++ code?

Thanks,
Ehsan

@Ehsan Please follow our docs

@Frank

Over a year passed… still python is not supported? :slight_smile:

@Frank I just started using this Khadas VIM3 board. I’m a newbee here… Can you please tell me how can we use the NPU?
If i have to use a pre trained model which is written in python, can I use the NPU to accelerate the process? Or is it necessary to convert the model to C++?

@Akkisony You can follow our docs .

@mattias We have not done this support

@Frank Hi Frank, I am using a MobileNet v2 SSD pre trained model for one of my use case. I have written the script in Python.
My question is that:

  1. Since the script is in python, can this also be implemented in the Khadas VIM3 A311D AMU Logic board, may be using CPU?
  2. Since the code is in python, do I have to convert it into C++ or I heard there is something called Ctypes. By using Ctypes, can I use this code to utilize the NPU of the VIM3 board?

@Akkisony I think use CPU to run AI model not a good chooise

Yes. you can use ctypes to run it . I had try it last year

@Frank If there is a demo or if you have shared your code using Ctypes on GIT, can you please share the link. It will help me to get an idea how much and where I need to modify the code.

And how long is it going to take for the Khadas team to include python support on VIM3 board?

Thank you :slight_smile:

@Akkisony That is a code for commercial use, unfortunately I can’t share it with you

I have been preparing to start this work recently

2 Likes

Okay… No problem!

Thank you for the positive news. Is there an estimate how many days would it take? So once you release the new update, I think we can utilize NPU using Python scripts right?

@Akkisony I will probably start this in mid-June, or it may take some time, there will be a beta version first

2 Likes

So can you please tell us when can we expect it available for all the users?

@Akkisony

I should take about 2 months to complete, because there are many other things that need to be done simultaneously.

@Frank Thank you! Hoping to see it available ASAP! :slight_smile: