Interviews

Michael Tesař Talks About AI, and his Colour Recognizer Project.

Knowing Python programming, AI, data science, machine learning etc is great.

But coming up with useful projects can be a bit tough.

Today’s guest,  Michael Tesař, has done a lot of projects and he shares them on his Instagram account and my favourite is the colour recognizer program he wrote.

So if you want to find out how Michael Tesař overcame the challenge of coming up with smart projects that require Artificial Intelligence, Machine Learning and data science. I  suggest you sit back, get a glass of wine or juice if available, and enjoy the details of this educative and motivational interview.

Interview with  Michael Tesař.

Godson: First of all, I would like to sincerely thank you for devoting time for this interview. Kindly tell us about yourself?

Michael Tesař: Thank you, I am glad to do this interview with you, Godson.

My name is Michael Tesař. I am a PhD student at Czech technical university (Prague, Czechia) in robotics and artificial intelligence. I am also a psychologist with neuroscience (mainly electroencephalography) background. I do some smart home DIY projects in free time.

Godson: Can you narrate your first programming experience and what got you to start learning to program?

Michael Tesař: My first programming project was about the analysis of brain signals from EEG. I started from scratch with MATLAB, Fourier transformation, and some advanced data visualization. In that point, I had to learn programming and quite soon I realized I absolutely like it.

Godson:  Which programming language do you know and which is your favourite? 

Michael Tesař: As I said earlier, I began with MATLAB, then I moved to Python.

I consider Python as a significantly stronger tool than MATLAB for machine learning. I favour Python because of its versatility and rich community (all kinds of different backgrounds and approaches). There exist plenty of easy to get libraries.

I also did some projects in C/C++, OpenGL2 and Java. My last smart home projects went completely in NodeJS.

Godson: What inspired you to venture into the world of programming and drove you to learn a handful of programming languages?

Michael Tesař: I have always got fascinated with programming, but I was afraid. When I started with programming I discovered that it is a pretty fun process. I constantly learn new languages or programming paradigm when I need to do the job, e.g. I choose the programming language based on its strengths and weaknesses. I essentially work in science so Python is the language of my choice for most of my projects.

Godson: What is your blog about?

Michael Tesař: Well, time to time I struggle with some kinds of obstacles. I share the solution to those obstacles on my blog with the hope that it can be of help to someone just like me.

Godson: Can you tell us about your colour recognizer?

Michael Tesař: This is my neuronal network playground.

I began to learn some machine learning libraries for Python and I wanted to do some meaningful project. I mean, we all start with Iris flower and Mnist dataset. I desired to do as much as I could do by myself to understand what is under the hood in those example codes.

ColorRecognizer has only one goal, to identify the colour presented to a web camera. I use Python 3.6, OpenCV2 and Scikit-learn library under the macOS 10.13.

Idea is to connect web camera to GUI with OpenCV2 which is essentially pretty simple and straightforward. Then I calculate an average value for R, G, and B for my screen (height x width). One hook is that OpenCV2 uses BGR format, so you have to keep that in mind.

Each time you run the program, a new session is started with training dataset and trained model loaded into the system.

If you run it for the first time it will automatically build it for you.

Maybe you’re asking, how does the computer know which colour is which?

This is up to the user to teach it (since it is machine learning).

You have to annotate some frames with the colour. The user can do it by pressing keyboard (k for black, w for white, r for red etc.).

I have run about 1500 training sets and each time you close the app you also save your classification model and your annotation. It means it is basically smarter with every new session (in case you show something new to the computer).

Even though I use a very elementary algorithm called Decision Tree Model, you can see on demo video that is quite accurate when the screen is filled with some colour.

Currently, I am working on a new deep learning version to learn a bit from image processing with TensorFlow. This time I won’t compute the mean of R, G, and B value – eventually, the computer would learn by itself (i.e. we will only care about the main colour on screen).

It has its own limits in adding new colours. Every time you have to teach it manually. I mean, you have to tell it that we have a new colour, its name and show some samples. Since I use usual web camera, I cannot recognize smaller nuances in colours due to lighting, brightness and saturation setup. It still has some problem to recognize red from orange in bad lighting.

Godson: You mentioned earlier that your first programming project was about the analysis of brain signals from EEG. Can you tell us more uses of Python or programming languages in the science community?

Michael Tesař: My first project ended to be FAA toolbox for MATLAB which has more than 100 unique downloads today. This little toolbox computes spectral density from the scalp and distils from the EEG data an emotion valence. This value can be used (and it is actually used in many studies) to the classification of emotions – you feel good or feel bad.

In both, MATLAB and Python are great communities. For example, now an outstanding tool called Python MNE rose all of the sudden and it is a powerful tool for EEG data analysis in Python.

Further, a package from Sebastiaan Mathôt OpenSesame for developing the psychophysical experiment with precise timing and rich GUI.

There are many libraries out there in Python. Nearly for anything you name it, for instance, bots for liking images based on keywords on Instagram or Twitter, game development etc.

What matters is that this kind of educational project needs to be alive. To be shared and maintained by people with similar interests.

Godson: What are the smart home DIY projects you have done so far?

Michael Tesař: I do some crazy stuff all the time but only some of them I complete to the let’s say production level. I have to admit I am pretty proud of my smart desk.

The smart desk of Michael Tesař

The smart desk of Michael Tesař

This project is all Homekit ready so you can control anything from your Apple device such as iPhone, Watch, TV and so on. It can be invoked by Siri or simply in the Home application. I have a 12V RGB LED strip in this system mainly in some bluish colour which helps me to concentrate on a task I am working. Then a computer fan hooked up in the Arduino with the same purpose, and it has a feature to regulate a speed by PWM.

Michael Tesař working on a DIY project

Michael Tesař working on a DIY project

Last is something I call iBulb which is my favourite DIY gadget. It is a single RGB LED which creates ambient colouring of the scene. When I have time I’ll make the second generation wireless.

iBulb which is Michael Tesař favourite DIY gadget

Photo of iBulb

Also, I have done a real-time brain activity visualizer on sculpture with my friends Michal Lenc and Eva Matuchová. We won 2nd place at Hack-The-Brain hackathon in Prague in 2016.

Michael Tesař did a real-time brain activity visualizer on sculpture with his friends Michal Lenc and Eva Matuchová. They won 2nd place at Hack-The-Brain hackathon in Prague in 2016.

Real-time brain activity visualizer by Michael Tesař

Every time I saw my plant without hydration I felt ashamed.

No more I said to myself. The image below shows a fully automatic system for watering plants. In this case, it is growing two kinds of basil. It controls air humidity and temperature, soil humidity, light intensity and water pump. All this integrated into menu controlled by potentiometer from my electric guitar.

Fully automatic system for watering plants by Michael Tesař

Fully automatic system for watering plants by Michael Tesař

Godson: Am curious, How do you come up with all these amazing projects?

Michael Tesař: I apparently come with an idea and try to find a solution on how to make it a reality.

I normally get inspiration from Instagram, YouTube or some blogs.

First, I find an engaging problem, then a project in it that I am passionate about.

After then it is simple, I discover a way on how to make it work. It means searching libraries, buying some hardware and learning some new language or framework.

I presume, all big ideas always rise from some crazy idea transformed into useful product.

So the principal purpose here is not to set boundaries at the beginning. I always try to imagine how it would be the best way I would like to interact with a hardware or any software.
Strictly speaking, I build it just for myself with emotions and if someone finds it useful I would be so thrilled about it.

Godson: Will I be able to do AI and robotics without a PhD?

Michael Tesař: Of course, you will. It depends on a job you apply. Mostly you will need to have a PhD but in some cases, I believe Google pass it as optional because they want to see your skills and knowledge.

Godson: Do I need a background in mathematics to learn AI? Also which courses should I take if I want to learn AI?

Michael Tesař: AI is not always about technical and math abilities. You should also know something about human intelligence, memory or about cognitive function in general. I believe that a basic knowledge in cognitive science with programming and math skills are all that you need to learn Artificial Intelligence.

If you would like to learn about AI I recommend you start with a guy named Sentdex, he is awesome and has very informative videos. It starts with Python from scratch to building deep learning automotive car in Grand Theft Auto V which is kind of fun but still you will learn so many interesting things. I myself was inspired so much with him I started to teach my AI to play Doom 2.

In university, you would go for any other programming language. I don’t want to start a fight but maybe even C/C++. It is hard and you will have to spend extra time to learn at least some basic concepts and programming paradigms but then you will profit in any programming language you go for. But you won’t go wrong with Python.

Godson: What is the best way to learn AI for a beginner?

Michael Tesař: This is mostly about reading, programming and learning new things. I constantly try to make it exciting and fun. That’s why I use my own dataset, on-line analysis, even Doom implementation. It is harder without it but it motivates me. It is super cool to teach a computer how to play Doom 2, isn’t it? I guess you get the point.

Godson: Can you tell us why is Python widely used for AI instead of other programming languages?

Michael Tesař: I am not sure if Python is widely used than any other language. It depends on your needs and of course on your programming and math level.

There is no reason why not to write all AI in C++ or Java.

We also forget about R which is also one of the most used in machine learning and data analysis.

Python has an advantage that it is easy to read and easy to write. Even non-programmers have some clue what is going on but in C, I doubt if they can have.

Plus I think the most rational reason is that it has tons of libraries and for machine learning and AI especially.

Godson: For someone that might want to go into robotics, can you give them a quick guide on how they can start?

Michael Tesař: Well from me it wouldn’t be such as a cookbook. I started with psychology, then I worked in neuroscience several years and finished my MA in psychology.

After that, I decided that I should go for robotics since I was always fascinated by this brilliant science. Though, the ideal way to robotics is through computer science or mathematics.

Michael Tesař shares the importance of Instagram to programmers.

Godson: You are doing great work on your Instagram account; can you tell us the importance of being active on Instagram as a programmer?

Michael Tesař: I have to admit that I like the format of posting a picture with short caption more than the full-blown post or even article. This, let’s say it is more intuitive and quicker.

I get plenty of direct messages of people asking me some programming question like why this or that does not work, how can one solve this etc.

It is great to put something to the community back.

Plus I met there extraordinarily interesting people (mainly web developers but even some people with similar interests).

Godson: Any success stories you would love to share that you had with Instagram.

Michael Tesař: Instagram is more about sharing with people than collecting likes for me. I always feel pleased when I meet someone new solving a similar problem.

Some of the comments are also inspiring. And seldom, I feel some kind of commitment to my audience. So I am thinking about what should be my new post etc. In some way, it is productive to share a project and its progress with hundreds of people.

Godson: Which tools do you use to come up with amazing pictures and videos for Instagram.

Michael Tesař: I use iPhone and screen recording with QuickTime.

Godson: Thanks for your time, would you love to share your contact details with us?

Michael Tesař: You are welcome, I am happy to be your guest on Cool Python Codes.

Contact: Michael Tesar, michtesar@gmail.com, instagram: neuropacabra.

2 Comments

Leave a Comment