Lecture: Machine vision in Python
From data acquisition to image analysis
This talk explores how we, at KardioMe, build computer vision systems that help reducing waste in industrial production.
We will first have a look at wrapping of C++ interfaces of industrial cameras in Cython.
We will then explore development machine learning models that are able to interpret the image content, and detect failures early.
Writing reusable modules in libraries with dynamic code execution (like Gluon) can make such task much simpler.
The first step in almost any automated inspection system is data acquisition.
In visual inpection, this often means getting access to pixel data from cameras.
Not all camera vendors supply Python interfaces to their devices and sometimes only C or C++ interfaces are available, though.
However, there are several good ways to wrap these for Python. Cython is one of those good options. We will see how it can be done.
To teach the computer how to see, hardcoding some rules is rarely a robust option. Whereas, learning those rules from data can yield a more resilient system.
You might have already heard of Tensorflow, a wonderful machine learning framework from Google. It is packed with tools for construction of computational graphs,
their differentiation, and fast evaluation. Yet, writing Tensorflow code is quite a shift from traditional coding in Python.
Special operations are needed even for looping and branching, and traditional debugging tools as we know them do not work.
Instead, in Gluon (Chainer, PyTorch...), the network is written almost like a regular python program.
However, the program's parameters can become trainable and the execution output can get better with more data.
Writing smaller reusable (and differentiable) machine learning modules makes the code not only more understandable, but also easier to debug and to maintain.
Code, that is more pythonic.
Finally, we will briefly see we apply similar techniques in medicine to better understand anatomy of our hearts.
This talk aims to discuss the practical parts of my PyCon SK talk on differentiable programming in Gluon in more detail.
Plus, you will get to hold a heart...