#AI – Exporting #CustomVision projects to #docker for #RaspberryPi, the extra 2 steps

Hi !

I wrote several posts on how to create a image analysis solution using CustomVision.ai and how to export and use the project in a Raspberry Pi with Docker.

In my posts, I created a custom docker file for RPI using as a base the Linux one, from CustomVision.ai.

There is a new feature in Custom Vision, which allows us to directly export the docker image for Raspberry Pi.

This is amazing, and because I’m going to use it on Chicago CodeCamp, I decided to test it. And, of course, I got a couple of ugly errors when I try to build my image in the device.

Once I edit and read the docker file content, I realized that I need to disable the CROSS-BUILD option

And that’s it, now I’m waiting for the image to finish and I’ll be ready to test it!

Happy coding!

Greetings @ Toronto

El Bruno

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi
  12. Average response times using a CustomVision.ai docker container in a RaspberryPi and a PC

Windows 10 and YOLOV2 for Object Detection Series

Advertisements

#AI – Mis posts sobre CustomVision.ai, exportando y utilizando ONNX, Docker, en PC, RaspberryPi, MacOS y más !

Buenas !

Ahora que tengo una pausa entre eventos en Canada y USA, y ya he escrito varios posts al respecto, es el tiempo ideal para compilar y compartir los posts que he escrito sobre CustomVision.ai. Sobre como crear un proyecto de reconocimiento de objectos, como utilizar el mismo en modo web, invocando un HTTP Endpoint desde una app de consola. Y también desde aplicaciones en Windows 10 exportando el proyecto a formato ONNX y utilizando Windows ML. Finalmente, un par de post donde explico como utilizar CV.ai con docker en PC, Mac y Raspberry Pi.

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi
  12. Average response times using a CustomVision.ai docker container in a RaspberryPi and a PC

Windows 10 and YOLOV2 for Object Detection Series

Greetings @ Burlington

El Bruno

#AI – My posts on CustomVision.ai, running on ONNX, Docker, on PC, RaspberryPi, MacOS and more !

Hi !

After the events in Canada and USA, and several posts, I think it’s time to make a recap of the posts I’ve wrote about CustomVision.ai and how I created a custom object recognition project. And later used this as a web HTTP Endpoint in a Console application. And also in Windows 10 with ONNX using Windows ML; and finally running the Object Recognition project inside a Container in Docker on PC, Mac and Raspberry Pi.

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi
  12. Average response times using a CustomVision.ai docker container in a RaspberryPi and a PC

Windows 10 and YOLOV2 for Object Detection Series

Greetings @ Burlington

El Bruno

#Docker – Tiempos de respuesta promedio utilizando #CustomVision.ai en un contenedor con Docker en #RaspberryPi u en PC

Buenas !

Alguien me pregunto por la performance de un proyecto de customvision.ai ejecutándose en una Raspberry Pi, y se me ocurrió que la mejor forma de explicarlo es mostrar las diferencias de tiempos de respuesta del mismo contenedor en Docker en PC y en una Raspberry Pi.

La PC donde haré la prueba tiene la siguiente configuración

w10 specs

Nota: Se que esto es bastante subjetivo, que para realizar una prueba real debería apuntar otros datos como el tipo de disco (SSD), apps en ejecución y más. La idea es tener un punto de referencia no una comparación completa.

El proceso de ejemplo para analizar 20 imágenes tarda unos 10.45 segundos en PC.

cv marvel docker local times

El mismo proceso en una RaspberryPi se ejecuta en 70.46 segundos.

cv marvel docker raspberry pi times times

Los tiempos promedio son

  • PC, 0.52 segundos
  • Raspberry Pi, 3.52 segundos

Y la conclusión es fácil: tener un device que permite analizar imágenes en 3.5 segundos por menos de $30 es impresionante!

Happy coding!

Saludos @ Toronto

El Bruno

References

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi

Windows 10 and YOLOV2 for Object Detection Series

#Docker – Average response times using a CustomVision.ai docker container in a #RaspberryPi and a PC

Hi !

I was testing the performance of the same customvision.ai exported project, running in a docker container in standard PC and a Raspberry Pi. And, I’m really surprised and happy about the RPI times.

Let’s start with the times for a container running in a PC with the following specs

w10 specs

Note: I know this is very subjective, because there is more information needed for a deep study. Like SSDs, Windows 10 version, apps running and more. This is just for reference.

A sample process to analyze 20 images tooks 10.45 seconds.

cv marvel docker local times
The same process using a container in a Raspberry Pi took 70.46 seconds.

cv marvel docker raspberry pi times times

The average time are

  • PC, 0.52 seconds
  • Raspberry Pi, 3.52 seconds

Again, amazing times for a 30 dollars device!

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies
  11. About ports, IPs and more to access a container hosted in a Raspberry Pi

Windows 10 and YOLOV2 for Object Detection Series

#MacOs – Where is my Putty? Utilizando SSH y RealVNC para conectar con #RaspberryPi [experiencias en Mac de un long time #Windows user]

Buenas !

En mi post anterior escribí sobre mis experiencias en el nuevo mundo de MacOS. Soy un novato total en este mundo y estoy aprendiendo sobre la marcha para poder ser productivo en mi día a día en Avanade y en mis hobbies y actividades personales.

Al igual que en mi post anterior, la siguiente necesidad surge para una demo en un evento de Machine Learning: conectar con una Raspberry Pi utilizando SSH. Esto lo hago como parte de mis demos de Custom Vision. (Y una vez mas, comentare que Custom Vision es uno de los mejores servicios de la familia de Cognitive Services)

En una parte de mi demo exporto un proyecto de Custom Vision como un proyecto de Docker para Linux. Luego modifico el mismo para poder compilarlo en Docker en Raspberry Pi.

En casa y en modo de prueba, suelo acceder a la Raspberry PI utilizando RealVNC, y por suerte, este producto esta disponible en ambas plataformas Windows y Mac. Otra opción es acceder a la Raspberry Pi utilizando SSH (SSH stands for Secure Shell). Esta opción es mas útil en demos, ya que es mas simple de compartir y explicar el paso a paso que se sigue en una consola de comandos.

En Windows, he sido un usuario longevo de Putty. Poco hay que decir al respecto, es una aplicación simple y poderosa para conexiones SSH, Telnet y puertos series. Al momento de ver si estaba disponible para MacOS, la descripción del producto dejo claro que NO.

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

Llego el momento de realizar un par de búsquedas en Bing para ver alternativas de Putty para MacOS. Fue mucho mas simple de lo que pensaba. Pocos minutos después, pude ver que con la app Terminal de MacOS me podía conectar rápidamente a mi Raspberry Pi con el siguiente comando

MACTERMINAL:~ bruno.capuano$ ssh <DEVICE IP> -l <LOGIN NAME>

Fue utilizar el comando, con la dirección IP y las credenciales de acceso a mi device y listo. Prompt para la contraseña y ya estaba conectado a mi Raspberry Pi.

01 doker build on mac

Espero que las próximas también sean así de fáciles !

Happy coding!

Greetings @ Burlington

El Bruno

References

#MacOs – Where is my Putty? Need for SSH and RealVNC to connect to #RaspberryPi [experiences in Mac from a #Windows user]

Hi !

In my previous post I share the context on why I’m a total newbie into the MacOS world. So today, I want to share another experience when switching from Windows to Mac.

As my previous content, the need for a SSH client is based on my live demos on my Custom Vision event. (Remember, Custom Vision is one of the most amazing services in the Cognitive Services family)

At some part on my demo, I create a new Custom Vision project, I export the project as a Docker for Linux, and I make some changes to the Docker Image to be compiled and used on a Raspberry Pi.

I can access and control the Raspberry PI using RealVNC, which is available for for Windows and Mac, or I can also access the device using SSH (SSH stands for Secure Shell). The second option is usually more appealing, because is just a big console app and everyone can read the commands sent to the device.

So, on Windows I was using Putty for a long time. It’s very light and easy to use. However, the description of the product makes a very clear statement about the supported OS of Putty.

PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers.

It was time to hit Bing and search for options or alternatives to Putty on MacOS. And this one was easy. After a couple of minutes I realized that I can use the standard MacOS terminal to connect to my device using SSH with a command like this one

MACTERMINAL:~ bruno.capuano$ ssh <DEVICE IP> -l <LOGIN NAME>

Once you enter the ssh command, with the IP and and the login name, it will promtp for the password and that’s it! I’m now connected to my device

 

01 doker build on mac

This one was easy !

Happy coding!

 

Greetings @ Burlington

El Bruno

References

#Docker – Sobre puertos, IPs y mas para acceder a un container alojado en #RaspberryPi

Buenas !

Mi proyecto de CustomVision.ai esta compilado y ejecutándose en Docker en Raspberry Pi 3. Ahora llega el momento de utilizar el mismo desde aplicaciones en otros dispositivos, y para este caso, todos en la misma red.

Cuando ejecute mi imagen, utilice parámetros para definir la IP y los mapeos de los puertos de la misma. El siguiente comando es muy útil para ver esta información en un container.

sudo docker port <CONTAINER ID>

01 docker port

Mi container esta registrado en la dirección IP 127.0.0.1 y utiliza el puerto 80. Esto es genial para procesos locales, sin embargo no permite que este container sea accedido desde otros devices.

Lo ideal es no registrar la direccion IP local 127.0.0.1 y solo definir el mapeo de puertos 80:80. En este caso ejecuto mi imagen con el siguiente comando

sudo docker run -p 80:80 -d <IMAGE ID>

02 docker port 80 and success run

El container utilizar el puerto 80, y Docker toma control de este puerto en la RaspberryPI. La dirección IP de la raspberry pi es [192.168.1.58], así que ya puedo realizar pruebas con Postman para analizar imágenes en la RPI.

03 docker image analysis from postman

Super cool. Un potente y barato server de análisis de imágenes basado en un proyecto de CustomVision por menos de $30 !

Happy coding!

Greetings @ Burlington

El Bruno

References

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies

Windows 10 and YOLOV2 for Object Detection Series

#Docker – About ports, IPs and more to access a container hosted in a #RaspberryPi

Hi !

So, my CustomVision.ai image is build and running in a container in my Raspberry Pi 3. It’s time to see if I can use it from other devices in the same network. When I run my image I defined IP and Port, but if you want to know these information, the following command is very useful

sudo docker port <CONTAINER ID>

01 docker port

So, my container is listening at 127.0.0.1 in port 80. That’s cool for local processing, however I want to access my container from other devices in the same network. In order to do this, I’ll run my image with the following command (I’m not defining the IP, just the port 80)

sudo docker run -p 80:80 -d <IMAGE ID>

02 docker port 80 and success run

The container is using the port 80, and docker is taking over this port in my device. My Raspberry PI device IP is [192.168.1.58], so I can go back and make some tests using Postman to analyze images in the device.

03 docker image analysis from postman

That’s cool. A small CustomVision image analyzer server for less than $30 !

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi
  10. Container dies immediately upon successful start in a RaspberryPi. Of course, it’s all about TensorFlow dependencies

Windows 10 and YOLOV2 for Object Detection Series

#Docker – Container muere inmediatamente después de ser iniciado en #RaspberryPi. Obviamente, era un problema de dependencias de #TensorFlow

Buenas !

La creación de imágenes en Docker es un proceso divertido. Cuando cree la imagen de CustomVision.ai para ser ejecutada en Docker en Raspberry Pi, me encontré con unos errores interesantes, así que aprovechare este post para escribir sobre los mismos.

La compilación de cada imagen suele tardar alrededor de unos 15 minutos. Ver que la misma compila correctamente es un momento de alegría, que se veía arruinado cuando al momento intentar iniciarla, el container se destruía automáticamente. El comando con el que iniciaba el mismo es el siguiente

sudo docker run -p 127.0.0.1:8080:80 -d <IMAGE ID>

Estuve leyendo mucho y encontré varias opciones para intentar comprender que sucede. Al final opte por intentar analizar los eventos en tiempo real que Docker publica con el comando

sudo docker events&

01 docker events

En la consola podemos ver un buffer lleno de eventos de Docker. Después de varios intentos con mi imagen, me encontré con mensajes similares a los siguientes.

2019-02-12T07:34:46.195722938-05:00 container start cdcdcc410518db46e09967412bd583c33cff6f4e8eee0f10e8baeec860f9c9a2 (image=295, io.balena.architecture=armv7hf, io.balena.device-type=raspberry-pi2, io.balena.qemu.version=3.0.0+resin-arm, name=musing_zhukovsky)

2019-02-12T07:34:46.195722938-05:00 container die cdcdcc410518db46e09967412bd583c33cff6f4e8eee0f10e8baeec860f9c9a2 (image=295, io.balena.architecture=armv7hf, io.balena.device-type=raspberry-pi2, io.balena.qemu.version=3.0.0+resin-arm, name=musing_zhukovsky)

Es fácil interpretar que después de la fecha y hora del evento, la descripciones “container start” y “container die”, describen el comportamiento que estoy analizando. Estaba un poco mas cerca.

Sin embargo, el evento no presenta mucha información sobre el error. Es por esto, que utilizando el <LOG ID> podemos obtener mas información con el siguiente comando.

sudo docker logs cdcdcc410518db46e09967412bd583c33cff6f4e8eee0f10e8baeec860f9c9a2

02 docker event details

Esto ya es mucho mejor! Ya puedo ver un archivo de código fuente en python y ademas el error, que en este caso, se da al intentar importar el modulo Pillow. Ahora ya puedo abrir python y todo cobra sentido.

03 app python details

Pues bien, ahora solo queda ver las dependencias y herramientas que necesita TensorFlow para instalar las mismas en el orden correcto antes de compilar la imagen.

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

  1. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  2. Object recognition with Custom Vision and ONNX in Windows applications using WinML
  3. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, drawing frames
  4. Object recognition with Custom Vision and ONNX in Windows applications using Windows ML, calculate FPS
  5. Can’t install Docker on Windows 10 Home, need Pro or Enterprise
  6. Running a Custom Vision project in a local Docker Container
  7. Analyzing images in a Console App using a Custom Vision project in a Docker Container
  8. Analyzing images using PostMan from a Custom Vision project hosted in a Docker Container
  9. Building the CustomVision.ai project in Docker in a RaspberryPi

Windows 10 and YOLOV2 for Object Detection Series