#MacOS – Not so good with Screen Resolutions and “even better” at projection mode

Hi !

The first time I was doing a demo and connecting my MacBook Pro to a projector, I found out that the screen settings and configuration in a MacOS are completely different to the usual Windows experience. And, IMHO, not in a good way.

In Windows, when you are working with 2 or more screens (monitors / projectors) you have the chance to define specific settings for each one. This settings include orientation, resolution, and more.

MacOS display runs at its native resolution, which is the best resolution designed for the display. To change the resolution, you need to open System Preferences and select displays. Then in the [Display section], we can change the resolutions by selecting the [Scaled] option.

So far, so good. Each option also shows a “Looks like resolution …” options which is great. But, not good enough. Before a demo for a client or a user group, I like to dry run my presentations and demos using a custom resolution. You never know, which hardware is going to be at your final destination.

After testing a couple of apps, I finally found a very good one with the features I need:

Disable Monitor, https://github.com/Eun/DisableMonitor

Disable Monitor allows me to quickly change any screen resolution with 2 clicks; it also lock the screens and detect monitors.

Simple and easy. Happy coding!

Greeting @ Toronto

El Bruno

My posts on experiences in Mac from a Windows user

Advertisements

#Windows10 – Windows #VisionSkills sample UWP App

Hi!

Yesterday the Windows Team announced the preview version of Windows Vision Skills. So today I was browsing the samples in Github and I’ve created a simplified version of the Skeleton tracker using a live feed from a webcam.

Here are some notes about my GitHub sample

  • The UWP App must be Windows 10 version 1809
  • I added the NuGet packages [Microsoft.AI.Skills.Vision.SkeletalDetectorPreview] and [Microsoft.Toolkit.Uwp.UI.Controls]
  • The MainView uses the CameraPreview control from the [Microsoft.Toolkit.Uwp.UI.Controls] toolkit.
  • Each frame is processed and I use a SkeletalBinding to detect Skeletons / bodies
  • The core detection is performed here
        private async Task RunSkillAsync(VideoFrame frame, bool isStream)
        {
            m_evalPerfStopwatch.Restart();

            // Update input image and run the skill against it
            await m_skeletalDetectorBinding.SetInputImageAsync(frame);
            await m_skeletalDetectorSkill.EvaluateAsync(m_skeletalDetectorBinding);

            m_evalPerfStopwatch.Stop();
            m_skeletalDetectionRunTime = m_evalPerfStopwatch.ElapsedMilliseconds;

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                m_bodyRenderer.Update(m_skeletalDetectorBinding.Bodies, !isStream);
                m_bodyRenderer.IsVisible = true;
                UISkillOutputDetails.Text = $"Found {m_skeletalDetectorBinding.Bodies.Count} bodies (took {m_skeletalDetectionRunTime} ms)";
            });
        }
  • There is also a BodyRenderer.cs class used to draw the skeletons on top of the CameraPreview Image control. It draws lines in an empty canvas.

You can download the sample code from here https://github.com/elbruno/Blog/tree/master/20190501%20VisionSkills%20Skeleton%20Sample

Greetings @ Burlington

El Bruno

References

#Windows10 – Windows Vision Skills (Preview), an amazing set of AI APIs to run in the edge!

Hi!

Today’s announcement is a big one if you are interested on move AI capabilities to the Edge. The Windows team make public the preview of Windows Vision Skills framework:

Windows Vision Skills framework is meant to standardize the way AI and CV is put to use within a WinRT application running on the edge. It aims to abstract away the complexity of AI and CV techniques by simply defining the concept of skills which are modular pieces of code that process input and produce output. The implementation that contains the complex details is encapsulated by an extensible WinRT API that inherits the base class present in this namespace, which leverages built-in Windows primitives which in-turn eases interop with built-in acceleration frameworks or external 3rd party ones.

The official blog explain the basic features of the framework and describes a set of scenarios like Object Detector, Skeletal Detector, and Emotion Recognizer.

We have UWP Apps in the repo samples, and it only took 1 min to setup everything to get the App up and running. In the following image, it smoothly detects a person and a chair.

The next image is the sample for Skeletal detector (as a old Kinect dev, this really makes me happy!)

This is an big announcement, because all of this APIs are native , and that means we can easily use them in

Greetings @ Toronto

El Bruno

References


#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

#CustomVision – Analizando imágenes en una Console App utilizando un proyecto de #CustomVision en #Docker Container

Buenas !

Este es un post especial, ya que es el 1ro que escribo completamente desde mi . Estoy seguro que  Javier (@jsuarezruiz), Yeray (@JosueYeray), Braulio (@braulio_sl), Luis, Sara, Roberto y otros mac users estarían orgullosos de mi 😀

Basado en el post anterior, he compilado y ejecutado mi proyecto Custom Vision Marvel en Docker para Mac. La experiencia es buenísima, y bash también es una novedad interesante!

docker build -t elbruno/cvmarvel:3.0 .

01 doker build on mac

El siguiente paso es obtener en ID y ejecutar la misma.

03 docker list images and run image

El paso final es utilizar CURL para hacer una petición HTTP Post con una imagen para analizar. Es muy simple, salvo que me tomo unos minutos y unas búsquedas en bing el darme cuenta que hay utilizar el prefijo @ en la llamada desde la consola! Iron Fist detected !

curl -X POST http://127.0.0.1:8080/image -F imageData=@img1.jpg 

05 docker bash ls image analyzed and source image.png

Ok, el entorno de pruebas con Docker esta funcionando, así que ahora es momento de utilizar Visual Studio for Mac. En realidad la app es una .Net Core Console App, que podría crear en Visual Studio Code, pero esta es la excusa perfecta para comenzar a conocer Visual Studio for Mac.

Mi codigo de pruebas esta en Azure DevOps, así que después de sincronizar los repositorios, ya pude crear un nuevo proyecto a mi solución.

06 new netcore project in visual studio for mac

Un par de lineas de código C# en la console app y ya pude realizar el análisis de la imagen utilizando el contenedor con el proyecto de Custom Vision

07 console app in vs for mac detected image

El código es muy simple:

Happy coding!

Saludos @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Analyzing images in a Console App using a #CustomVision project in a #Docker Container

Hi !

This is a special post. It’s the 1st one I write completely in my MacBook, so I’m sure that Javier (@jsuarezruiz), Yeray (@JosueYeray), Braulio (@braulio_sl), Luis, Sara, Roberto and other mac users will be proud of me 😀

So, I build and run my Custom Vision Marvel project in Docker for Mac. Smooth build and also a fast one!

docker build -t elbruno/cvmarvel:3.0 .

01 doker build on mac

Then get the image id and run the image

03 docker list images and run image

Final step is to play around with curl in bash to post the image (the file name with @ prefix took me some bing searches). Iron Fist detected !

curl -X POST http://127.0.0.1:8080/image -F imageData=@img1.jpg 

05 docker bash ls image analyzed and source image.png

Ok, the environment is working, so it’s time to create a .NetCore Console App to test this using amazing C# code. I have all my code in Azure Dev Ops, so I sync my repo and  added a new project in my current solution

06 new netcore project in visual studio for mac

Some C# lines in my console app and I was able to analyze a local picture using the Custom Vision Model in a container

07 console app in vs for mac detected image

The source code is very simple

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Utilizando un proyecto Custom Vision en un #Docker Container local

Buenas !

Ahora que ya tengo en funcionamiento Docker en Windows 10 es tiempo de exportar un proyecto de CustomVision y ejecutarlo dentro de un container.

Cuando exportamos hay 2 version disponibles: Linux or Windows

00 CV exported to docker

En mi caso no pude compilar la versión de Windows, asi que trabajare con la versión de Linux. El zip que descargamos tiene varios archivos, como el DockerFile con la definición del container, el modelo de ML, los archivos python para leer y realizar análisis de imagenes y varios archivos mas.

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

Esta imagen utiliza Python 3.5, y el comando para compilar la imagen es

docker build -t elbruno/cvmarvel:3.0 .

05 CV docker build image in windows

Un par de segundos después, la imagen esta compilada y disponible en la store local

docker image ls

07 Docker local images

Ahora que se mi IMAGE ID, ya puedo iniciar la ejecución de la imagen. En este caso, utilizare el puerto 8080

docker run -p 127.0.0.1:8080:80 -d ddd1623ee694

En este ejemplo utilizare PowerShell y el comando Invoke-WebRequest para realizar una petición HTTP Post con una imagen

Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -ContentType ‘image/jpg’

06 CV running and testing an image on docker

El resultado detecta una imagen, sin embargo no tengo todo el resultado Json disponible. Para esto, agregare un archivo de salida en la petición para guardar en el mismo el resultado del análisis de la imagen. Ahora ya puedo ver que detecta Iron Fist y a Venom!

Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -Outfile “D:\docker\result.json” -ContentType ‘image/jpg’

08 docker results in visual studio code

Happy coding!

Greetings @ Burlington

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

#CustomVision – Running a Custom Vision project in a local #Docker Container

Hi !

So now that I have Docker running in Windows 10, it’s time to use a Custom Vision model in Windows hosted in Docker container.

There are 2 version available to export from CustomVision.ai for each one the projects: Linux or Windows

00 CV exported to docker

I could not sucessfully built the Windows version, so I’ll work with the Linux one. Once exported the zip file have a set of python files to tun the model, the model file (model.pb) and a Dockerfile to build the docker image.

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

The image uses Python 3.5, and the build command is as simple as

docker build -t elbruno/cvmarvel:3.0 .

05 CV docker build image in windows

After a couple of seconds, the image is build in the local store

docker image ls

07 Docker local images

Once I have my IMAGE ID, it’s time to start the image. For this demo, I’ll use the port 8080

docker run -p 127.0.0.1:8080:80 -d ddd1623ee694

And then I can submit an image using Invoke-WebRequest and view the results directly in PowerShell

Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -ContentType ‘image/jpg’

06 CV running and testing an image on docker

In order to get the complete output of the POST request, I must add an OutFile into the PowerShell comand. And in the complete output we can see some Iron Fist and Venom results!

Invoke-WebRequest -uri “http://127.0.0.1:8080/image” -Method Post -Infile “D:\docker\test01.jpg” -Outfile “D:\docker\result.json” -ContentType ‘image/jpg’

08 docker results in visual studio code

Happy coding!

Greetings @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series

#Windows10 – Problemas al instalar #docker en Windows 10 Home, necesitas Pro o Enterprise

Buenas !

Voy a poner on hold mis posts sobre Custom Vision para agregar un pequeño ayuda memoria para mi:

No instales Windows 10 Home si piensas utilizar Docker!

Hace poco instale un nuevo entorno de desarrollo y al momento de instalar Docker Desktop me encontré con el siguiente mensaje

Docker Desktop requires Windows 10 Pro or Enterprise version 14393 to run.

cant install docker 2.0.0.2 on win10 1903 18329

La primera idea que vino a mi mente era alguna incompatibilidad entre Windows Insider y Docker, y luego de un par de búsquedas en Bing me di cuenta que no es posible instalar Docker Desktop en Windows 10 Home edition.

win 10 home edition

Por suerte, el upgrade de Windows 10 Home a Pro es bastante simple. Busque en mis MSDN Product Keys una licencia valida de Windows 10 Pro y actualice mi entorno de desarrollo

upgrading windows

Happy coding!

Saludos @ Toronto

El Bruno

References

My Posts

Windows 10 and YOLOV2 for Object Detection Series