#Event – Materials and Resources used during my #CustomVision and #AI session at #CDC2019

Hi!

Drafting these in the airplane, and also drafting a bigger post about the full and amazing experience at the Caribbean Developer Conference. So, I’ll start with the usual slides and materials, and also use this post later as reference for the full experience

Slides

Code

https://github.com/elbruno/events/tree/master/2019%2010%2004%20CDC

Links

Tweets

Greetings @ Toronto

El Bruno

References

My posts on Raspberry Pi

Advertisements

#VSCode – Let’s do some #FaceRecognition with 20 lines in #Python (4/N)

Hi !

Quick post today. I’ll pickup yesterday demo, showing the facial features and adding Face Recognition on top of that. In other words, we’ll move from this

To this

With a couple of extra lines for face recognition

There is some room for performance improvement, so I’ll focus on this in next posts.

The complete project is available here https://github.com/elbruno/Blog/tree/master/20190528%20Python%20FaceRecognition

Happy Coding!

Greetings @ Burlington

El Bruno

Resources

My Posts

  1. Detecting Faces with 20 lines in Python
  2. Face Recognition with 20 lines in Python
  3. Detecting Facial Features with 20 lines in Python

#VSCode – Let’s do some #FaceRecognition with 20 lines in #Python (3/N)

Hi !

In my previous posts I explained how to detect faces and perform face recognition in python. Today I’ll explore another feature in the face_recognition package: Find Facial Features.

The live camera output will be something like this:

Note: Special thanks to my daughter who is always OK to help me with this.

The main sample in the source code uses a photo to detect facial features and creates a new one with the features detected. In the following sample, is amazing to check that it detect a far away face behind the main ones and also, somehow, it detect some landmarks behind my girl glasses:

I wanted to see how fast this library work to perform this with a live camera feed, and the results are very good.

I spend sometime figuring out the best way to draw lines with OpenCV, at the end the PolyLine() function is the one doing all the magic (lines 14 to 17). It took me sometime, to find the best way to deal with matrix transformations and some other performance tricks, but at the end I get this up and running in 25 lines which is kind of amazing. And the final code is very simple:

The complete project is available here https://github.com/elbruno/Blog/tree/master/20190528%20Python%20FaceRecognition

Happy Coding!

Greetings @ Burlington

El Bruno

Resources

My Posts

  1. Detecting Faces with 20 lines in Python
  2. Face Recognition with 20 lines in Python

#VSCode – Let’s do some #FaceRecognition with 20 lines in #Python (2/N)

Hi !

Yesterday I explained how to write a couple of lines in Python to perform live face detection in a webcam feed [Post]. Check the resources section to find more about the tools I’m using.

Today, I’ll add some more code to perform face recognition. And as usual, I’ll work with my kids to test this out. I’ll start adding 2 face encodings for Valentino and myself. The code is simple enough, and I use a simple 300×300 head-shot photo to train and get the face encoding.

The previous function returns an set of arrays with the face encodings and the face names. In the complete file, I’ll use this to analyze the camera frame (line 31) and later to check the matches for faces (lines 34 * 36)

Last lines are cosmetic to mostly draw the frames for the detected faces, and show the names.

The complete project is available here https://github.com/elbruno/Blog/tree/master/20190521%20Python%20FaceRecognition

Happy Coding!

Greetings @ Burlington

El Bruno

Resources

My Posts

#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

#AI – Multi-Task Deep Neural Networks para Natural Language Understanding

goku at keyboard

Buenas !

Un equipo de Microsoft Research ha lanzado una nueva Deep Neural Network para el aprendizaje de universal language embbedings: Multi-Task Deep Neural Networks for Natural Language Understanding (MT-DNN).  Language embbedings es un proceso que se utiliza para asignar elementos en sentencias o párrafos a representaciones vectoriales. Esto se utiliza principalmente en herramientas como LUIS (Language Understanding) para analizar texto e identificar intenciones, entidades y más.

Una descripción completa de MT-DNN se puede encontrar en el blog oficial de Microsoft Research (ver referencias). Me pareció interesante que el enfoque es añadir un modelo de lenguaje transformador bidireccional pre-entrenado, conocido como BERT, desarrollado por Google AI.

Como de costumbre, el código, basado en PyTorch, está disponible en GitHub: https://github.com/namisan/MT-DNN. El repositorio contiene los modelos previamente entrenados, el código fuente y el archivo Léame que describe paso a paso cómo reproducir los resultados notificados en el MT-DNN paper,

Más información: Towards universal language embeddings

Saludos @ Toronto

El Bruno

References

#AI – Multi-Task Deep Neural Networks for Natural Language Understanding

goku at keyboard

Hi !

One team in Microsoft Research have released a new Deep Neural Network for learning universal language embeddings: Multi-Task Deep Neural Networks for Natural Language Understanding (MT-DNN).  Language embeddings is a process used to map elements in sentences to vector representations. This is mostly used in tools like LUIS (Language Understanding) to analyze sentences and identify intentions, entities and more.

A complete description of MT-DNN could be found in the official Microsoft Research Blog. I found interesting that the approach is to add a pre-trained bidirectional transformer language model, known as BERT, developed by Google AI.

As usual, the code, based on PyTorch, is available in GitHub: https://github.com/namisan/mt-dnn. The repo contains the pretrained models, the source code and the Readme that describes step by step how to reproduce the results reported in the MT-DNN paper,

More information: Towards universal language embeddings

Greetings @ Toronto

El Bruno

References

#OpenSource – Microsoft anuncia que ofrece la calculadora de Windows en modo Open Sources, y el source code es lo menos importante del anuncio

Buenas !

Hace un par de días, Microsoft anunció que ofrecería el código fuente de la calculadora de Windows en modo Open Source.

Official Blog Post, Announcing the Open Sourcing of Windows Calculator

Como era de esperar, hubo muchas opiniones diferentes. Hay que incluir a los [haters tiempo completo] que empezaron a soltar argumentos como: “esto es una vergüenza, no es suficiente“,  o “esto es una broma, liberar el código fuente de una app tan simple como la calculadora“.

calculator W10

Dejando de lado, esas opiniones haters sin fundamento, hay que leer entre lineas para darse cuenta que hay varios puntos muy importantes detrás de este anuncio.

Comencemos por el código fuente, disponible en Github bajo la licencia MIT, esto de por si es genial. Sin embargo, si has estudiado o aprendido a programar, es muy probable que en algún momento de tu carrera, hayas creado una calculadora. Es casi el 2do paso obligatorio después del Hello World, en mi caso la programé en Pascal, hace muchos pero muchos años.

Lo que seguramente no has hecho, cuando programaste tu calculadora, fue agregar telemetría de uso a la misma. Y, aunque no lo parezca, detrás de la calculadora de Windows, hay mucha información de telemetría. Este es un excelente ejemplo para comenzar a comprender como agregar telemetría a una aplicación. Inclusive si tomamos como referencia a una aplicación simple como la calculadora de Windows (sin ofender). Si además te aburres, puedes invertir un par de minutos en leer Microsoft Privacy Statement, un documento muy divertido para comprender como Microsoft maneja tu información personal.

Otro punto a importante a tener en cuenta en este anuncio, es la posibilidad de comenzar a comprender como se maneja un producto. Una vez más, inclusive uno tan “simple” como la calculadora de Windows. Tener acceso a los pasos necesarios para gestionar las Features por cada Release (Feature Process steps), o inclusive ver como el tablero Kanban de features es publico para los colaboradores del grupo, es un excelente recurso de aprendizaje.

calculator github feature tracking

Y sin olvidar, que la Calculadora es una Universal Windows Platform App, así que también esta la oportunidad de aprender un poco de desarrollo de Apps para Windows 10, Xaml, y conceptos de Fluent App Design !

Happy coding!

Saludos @ Burlington

El Bruno

References

#OpenSource – Microsoft open sources the Calculator, and the app is the less important part of this

Hi !

A couple of days ago Microsoft announced that they open sourced the Windows Calculator.

Official Blog Post, Announcing the Open Sourcing of Windows Calculator

And there were a lot of mixed opinions (as usual) about this. Of course, we have the [full time haters] with some arguments like, this is not enough or this is a joke, a so simple app.

calculator W10

However if you read between the lines, there are a couple of very important topics here, which are not related to the calculator at all.

Let’s start with the source code. It’s all available in Github under the MIT licence, and that’s great. If you ever studying CS, you probably already code a calculator, so there is nothing new here. Mine was in Pascal, a long time ago.

But, and this is a bit [But], I don’t think you never added Telemetry to your calculator. And this is the Windows Calculator, there is a lot of telemetry here. You can start to understand how to add Telemetry in a “simple App” (no offense here, please). So, as a bonus, you get access to this information. And if you are very bored, you may want to read the Microsoft Privacy Statement. A nice document around how Microsoft manage personal data.

The 2nd topic which you may learn from the Calculator, is how to manage a product. Again, the source code here is the less important part. But have access to the Feature Process steps, or even to the Feature Tracking Kanban, will give you a sense on how to work with product features, understand releases, and more.

calculator github feature tracking

And finally, this is a Universal Windows Platform App, so there is a huge opportunity here to learn Xaml, and it seems that there is some Fluent App Design concept around here. I’m assuming the conversation behind the app, should be amazing!

Happy coding!

Greetings @ Burlington

El Bruno

References

#Event – Materiales utilizados en la sesión [Getting Started with Machine Learning.Net & Windows Machine Learning] con el grupo de usuarios GLUG

Buenas!

Es momento de otro post para compartir los materiales utilizados durante la sesión con el grupo de usuarios GLUGnet User Group for .NET, Web, Mobile, Database. Especial agradecimiento para Joe Kunk (@JoeKunk) y a los asistentes al webcast vía Google Hangouts. Por cierto, la sesión fue con los materiales actualizados a la version 0.10 de ML.NetÑ Windows ML and Machine Learning.Net.

Como siempre, aquí están las slides.

Source Code GitHub https://github.com/elbruno/events/tree/master/2019%2002%2021%20GLUG%20NetUG%20MLNet

Y algunos links que comenté durante la sesión:

Resources

Happy Coding!

Saludos @ Toronto

El Bruno