IBM / MAX-Object-Detector

Localize and identify multiple objects in a single image.
https://developer.ibm.com/exchanges/models/all/max-object-detector/
Apache License 2.0
289 stars 225 forks source link

Support for ARM #72

Closed corvy closed 4 years ago

corvy commented 4 years ago

Hello, will you add support for ARM CPU so we can run it on for instance Raspberry Pi 4? Is there a guide to build it manually for RPI4? I tried the run locally but it fails due to usage of some prebuilt binaries not supported on arm.

bdwyer2 commented 4 years ago

Hi @corvy it would be awesome to be able to run MAX models on a Raspberry Pi. We would need to change the base image in order to do this and we already have an issue open for that (https://github.com/IBM/MAX-Base/issues/6).

corvy commented 4 years ago

Perfect, thanks for swift reply @bdwyer2. Is there any progress on this considering the issue is 10 months old? Is there any way to build this manually that you know of.

bdwyer2 commented 4 years ago

The easiest thing to do would be to install the requirements and run the code in this repo directly on the Raspberry Pi outside of Docker.

If you want you can join our slack workspace and we can walk you through the steps.

corvy commented 4 years ago

Great, I will do this, but stil I want it on docker as I have other workloads on the same Pi running. This is to become an appliance type device for automation and monitoring of a boat. ⚓🤠

Let me look into it and I will join slack over the next few days.

bdwyer2 commented 4 years ago

Oh cool! What kind of boat? I would love to learn more about what you are doing

corvy commented 4 years ago

I have been using Home Assistant on the boat for a few years. My setup includes the use of Hass.IO, Node-Red, InfluxDB, MQTT, SignalK and ZigBee ZHA. This enable the use of sensors like water leak, vibration, temperature, moisture and various switches. I use Node-Red for automation of the battery charging and solar charge monitoring. There is a Victron battery monitor and MPPT solar charge controller, both which are connected to the Pi with USB serial cables. These feed data to Node-Red and automate the charge of my LiFePo4 battery bank. SignalK is reading NMEA data from my AIS tranceiver which provides location information (GPS). The network is provided by a WiFi router with SIM CARD and 4G support.

Also I have two cameras setup, currently using Dafang Hacked Xiaomi cameras. This summer I migrated to a Raspberry Pi 4 and I want to integrate my cameras with Tensorflow to reduce the false-positive motion messages. On a boat there is allways some motion, but 99% of this is not interesting so I need to use some ML to make sure I only get interesting alerting. Cloud integration is of course an option as long as I only use capture single images but if I could retain it all on the Pi I save data on my GSM SIM card.

Functionality that I am working at is for instance:

Working:

In progress:

So ... a lot of ideas still :)

Screenshot 2019-10-18 07 35 57
bdwyer2 commented 4 years ago

Hi @corvy if you change FROM codait/max-base:v1.1.3 to FROM codait/max-base:arm-arm32v7-v1.3.0 in the Dockerfile and tensorflow==1.12.2 to tensorflow==1.13.1 in requirements.txt you should be able to run this model on a Raspberry Pi. I've tested this on a Raspberry Pi 4 and it works

corvy commented 4 years ago

Ok, I will give it a go :) Thanks!

corvy commented 4 years ago

It works! :) Just created an image with your suggested changes and uploaded to the docker hub registry.

https://hub.docker.com/repository/docker/sbarmen/max-object-detector

Note I had to pull from console on portainer. Timeout problem? Took 10-15 minutes to pull it. This is a working solution for me! Thanks @bdwyer2 👍

Screenshot 2019-11-12 16 28 06
bdwyer2 commented 4 years ago

Glad you got it working. We hope to iron out the bugs and have an official build soon.

corvy commented 4 years ago

Perfect 👍 we should maybe consider a model specifically for low performance systems with less resource requirements. I am looking forward to trying some of the pretrained models. Right now it uses 10-15 seconds and for instance restrictions to only detection of humans would perhaps reduce the processing time?

bdwyer2 commented 4 years ago

You can now pull directly from docker hub

docker pull codait/max-object-detector:arm-arm32v7-latest
corvy commented 4 years ago

Grand @bdwyer2. Will you keep updating this going forward?

xuhdev commented 4 years ago

We have set up CI for ARM. I think we will in the foreseeable future.