#VS2019 – Visual Studio Launch event on the next April 2nd, 9:00am PT

 

visual studio 2019 launch event

Hi !

You may want to get your 2nd monitor ready on the next April 2nd, 9:00am PT, because is the official launch of Visual Studio 2019 !

Scott Hanselman and other amazing set of speakers will host a 7 hour session introducing the latest version of Visual Studio. So, go to https://visualstudio.microsoft.com/vs2019-launch/ , add the reminder to your calendar and get ready also for some local launch events !

Greetings @ Burlington

El Bruno

Advertisements

#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

#Docker – Container dies immediately upon successful start in a #RaspberryPi. Of course, it’s all about #TensorFlow dependencies

Hi !

Creating Docker images is a fun process. When I created the CustomVision.ai custom image to be executed in my Raspberry Pi, I faced a couple of errors, so now it’s time to save / share some lessons learned.

One of the most frustrating steps was after my 15 min wait time to build an image to find that the image was successfully built, however it dies after I run the image with a command like this one

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

There are a couple of options to understand what’s happen here. I decided to launch and trace the live events from Docker with the command

sudo docker events&

01 docker events

This windows is a full buffer of Docker events, after a while I detected that after I tried to start my docker image I got 2 messages similar to this one

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)

As you probably detected (much faster than me!) the events were container start and container die. But the docker events does not display much more information with details of the event.

What we can use is the <LOG ID> included in the event line. And with the following command we can get more details of the event.

sudo docker logs cdcdcc410518db46e09967412bd583c33cff6f4e8eee0f10e8baeec860f9c9a2

02 docker event details

This is much better! Now I know that we can’t import a Python module named PIL on the file [app.py], in the line 10. When I open the file, it all makes sense.

03 app python details

So now it’s time to check the dependencies and tools required to use TensorFlow in a Raspberry Pi. I’ll write more about this tomorrow 😀

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

#CustomVision – Compilar el proyecto de CustomVision en #Docker en una #RaspberryPi

Buenas !

Después de compilar y utilizar el modelo exportado de CustomVision.ai en Windows y Linux, el siguiente paso es intentarlo en una RaspberryPi (RPI). Desde hace un tiempo RPI soporta docker, así que intentare tomar la imagen de Linux y modificar la misma para que funcione en la RPI.

Este es el contenido del [DockerFile] original que se ha exportado para Linux

FROM python:3.5

ADD app /app

RUN pip install --upgrade pip
RUN pip install -r /app/requirements.txt

# Expose the port
EXPOSE 80

# Set the working directory
WORKDIR /app

# Run the flask server for the endpoints
CMD python app.py

En este archivo se utiliza una imagen base de python 3.5 para Linux. Navegando en los repositorios de Docker Hub y leyendo en la comunidad de Docker, he encontrado algunas imágenes base para RPI de Balena (link), see references.

La imagen que utilizare se llama [balenalib/raspberrypi3]. La misma solo posee Linux, sin nada de software instalado. Me he basado en parte  de los ejemplos de [Custom Vision + Azure IoT Edge on a Raspberry Pi 3] para instalar a mano el software necesario para que un proyecto de CustomVision.ai funcione en RPI.

FROM balenalib/raspberrypi3

RUN apt-get update &&  apt-get install -y \
        python3 \
        python3-pip \
        build-essential \
        python3-dev \
        libopenjp2-7-dev \
        libtiff5-dev \
        zlib1g-dev \
        libjpeg-dev \
        libatlas-base-dev \
        wget 

RUN pip3 install --upgrade pip 
RUN pip3 install pillow numpy flask tensorflow

RUN pip3 install flask 
RUN pip3 install pillow
RUN pip3 install numpy
RUN pip3 install tensorflow

ADD app /app

EXPOSE 80

WORKDIR /app

CMD python3 app.py

El proceso completo de compilación de la imagen en la RPI tarda unos 10 o 15 minutos, así que es la excusa perfecta para tomar un café, un te, o lo que gustes.

01 docker raspberry pi build

Una vez que el proceso esta completo, ya podemos ver la imagen en la lista de imágenes locales en Docker en RPI. Es el momento de ejecutar la misma, en el puerto 8080

02 docker raspberry pi image built

Y utilizando un comando cURL podemos probar el análisis de la imagen en local en la RPI!

01 raspberry pi docker image analyzed

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

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Building the CustomVision project in #Docker in a #RaspberryPi

Hi !

So my next step in my build process is to host the CustomVision.ai exported model in a RaspberryPi (RPI). RPI supports docker, so it should be easy to work with the exported Linux image.

So let’s take a look at the original [DockerFile] in the Linux export

FROM python:3.5

ADD app /app

RUN pip install --upgrade pip
RUN pip install -r /app/requirements.txt

# Expose the port
EXPOSE 80

# Set the working directory
WORKDIR /app

# Run the flask server for the endpoints
CMD python app.py

This file uses a standard python 3.5 linux image as base. However browsing in the docker community, I found a specific set of base image for RaspberryPi in the Docker Hub from Balena (link), see references.

So, using this base image and some resources from [Custom Vision + Azure IoT Edge on a Raspberry Pi 3] I make some changes to the DockerFile to create a running image for RPI.

FROM balenalib/raspberrypi3

RUN apt-get update &&  apt-get install -y \
        python3 \
        python3-pip \
        build-essential \
        python3-dev \
        libopenjp2-7-dev \
        libtiff5-dev \
        zlib1g-dev \
        libjpeg-dev \
        libatlas-base-dev \
        wget 

RUN pip3 install --upgrade pip 
RUN pip3 install pillow numpy flask tensorflow

RUN pip3 install flask 
RUN pip3 install pillow
RUN pip3 install numpy
RUN pip3 install tensorflow

ADD app /app

EXPOSE 80

WORKDIR /app

CMD python3 app.py

The full build process takes a couple of minutes, so you may want to have a coffee or a tea during the build process.

01 docker raspberry pi build

Once the process is complete, we can find the built and run the image from the docker image list

02 docker raspberry pi image built

Next step is to try the remote container with a single cURL command and done!

01 raspberry pi docker image analyzed

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

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Analizando imágenes con PostMan con un proyecto de #CustomVision en un #Docker Container

Buenas !

El post de hoy es uno simple, y que tengo que apuntar para el futuro:

Utilizar PostMan para realizar una petición HTTP POST para analizar una imagen con un proyecto de Custom Vision alojado en un Docker container.

En mis post anteriores escribí sobre como crear y exportar un proyecto en CustomVision.ai; y también sobre como ejecutar el mismo en un contenedor Docker,  y analizar una imagen desde una aplicación de Consola .NetCore.

En el post de hoy utilizare el mismo entorno, y analizare una imagen utilizando una de las herramientas mas populares entre los web developers: Postman.

Vamos a ello. Creamos una sesión en Postman y definimos la URL y el tipo POST de http request. Para enviar una imagen, debemos agregar un nuevo header para definir el Content-Type como image/jpg.

01 postman header image jpg

La imagen sera enviada en modo binary content en el body de la petición. Selecciono la imagen con la que realizare la prueba.

02 postman body raw file

Una vez realizada la petición, podemos ver el resultado en formato JSON, con las entidades detectadas y sus frames.

03 postman json results

Adicionalmente, podemos exportar esta sesión en código en diferentes lenguajes. Por ejemplo: C#, Java, Go o Python.

04 postman generate code

El código en python de ejemplo:

Happy coding!

Saludos @ Burlington

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Analyzing images using PostMan from a #CustomVision project hosted in a #Docker Container

Hi !

Today’s post is a simple one that I’ll use for sure in the future:

How to make an HTTP Post Request using Postman to analyze an image using a Custom Vision project hosted in a docker container.

In my previous posts I share the necessary steps to export a CustomVision.ai project and run the project in docker. I also show how to send images for analysis from a .NetCore Console App.

Today I’ll use another popular tool to perform the Http call to the docker container: Postman. This is one of the most popular tools in the web development world, and for sure is a good one if even myself knows how to use it!

So, once we have our session in Postman the container URL and POST are very straightforward. We are going to send an image, so we need to add a header with the Content-Type as image/jpg.

01 postman header image jpg

The image will be sent as binary content in the body. With 2 clicks we can select the file to use for testing.

02 postman body raw file

And finally, the result is an amazing JSON that we can analyze and see how our model performs

03 postman json results

And as a bonus, once we have a test defined in PostMan, we can easily export the test as code in different programming languages like C#, Java, Go or Python.

04 postman generate code

Here is a sample of the generated python code

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series