Object detection on Raspberry PI using customvision.ai/.NET 5

430 Views Asked by At

We have written a x-plat worker service using .NET 5 that is running on a Raspberry PI 4 (Raspberry Pi OS). We have trained a custom vision object detection model on customvision.ai, exported it to ONNX and it all works well on Windows.

We are now struggling to get it running on the Pi. The ML.NET bits does not seem to work on the Pi. We're getting (with target runtime "linux-arm"):

Microsoft.ML currently supports 'x64' and 'x86' processor architectures. Please ensure your application is targeting 'x64' or 'x86'

We've searched hi and low for any working examples. We've also tried to export to Tensorflow format and explore Tensorflow.NET without any success.

Can anyone point to an example that is consuming a customvision.ai generated model in .NET Core/5 on a Raspberry PI? We are extending an existing prototype and would like to avoid rewriting it all in Python/C++ or create out of process calls.

Versions: ML.NET 1.6, Microsoft.ML.OnnxRuntime 1.8.1

Many thanks,

Mansos

2

There are 2 best solutions below

4
On BEST ANSWER

Just incase someone else lands here...

The release ML.Net NuGets (mid Dec 2021) now have support for linux-aarch64, linux-arm, linux-arm64, Windows-x64 etc.

If you're still interested I have have a couple of blog posts about my "learning journey" getting a pretrained ONNX model working on RPI4B + Bullseye and ASUS PE100A + Ubuntu

@KiwiBryn

1
On

Are you running an Uno Platform app to capture a picture from the camera module (or usb webcam) in your Pi4 and running ML.Net too?