hailo-ai / hailo-rpi5-examples

MIT License
341 stars 53 forks source link

Hailo AI Kit + Rpi 5 + Text Prompt FastSAM Segment anything model (Meta) #49

Open agronomofiorentini opened 3 weeks ago

agronomofiorentini commented 3 weeks ago

Dear contributors, I have bought and installed the Hailo AI kit on rpi 5 by following this article https://www.raspberrypi.com/documentation/accessories/ai-kit.html

but when i try to use it with the following code.

from fastsam import FastSAM, FastSAMPrompt

model = FastSAM('./weights/FastSAM.pt')
IMAGE_PATH = './images/dogs.jpg'
everything_results = model(IMAGE_PATH, retina_masks=True, imgsz=1024, conf=0.4, iou=0.9,)
prompt_process = FastSAMPrompt(IMAGE_PATH, everything_results)

ann = prompt_process.text_prompt(text='a photo of a dog')

prompt_process.plot(annotations=ann, output_path='./output/dog.jpg',)

it's still using the cpu without any AI acceleration.

Could you help me to solve this?

giladnah commented 3 weeks ago

Hi @agronomofiorentini, I order to execute the model on Hailo it has to be first compiled and than executed using Hailo tools. If you need more information and got more questions please join the community in https://community.hailo.ai/

agronomofiorentini commented 3 weeks ago

I signed in the community hailo but i have to wait for approval. Anyone tried to use the FastSam with text prompt in hailo? How to compile it and use it?

Anyone has an example that i can follow?