Saturday, September 1, 2018

Using Multiple Cameras with OpenCV

As you know, OpenCV is capable of reading from any connected camera in your system, whether it's a built-in webcam (in a laptop) or a USB connected one.

But what if, you wanted to read from more than one cam at the same time?

Can OpenCV handle it?

OpenCV accessing 2 cameras at once
OpenCV accessing 2 cameras at once


Yes, it can!

It's quite simple. Here's how to do it.

Friday, August 31, 2018

Our YouTube Channel is Live!

We have a YouTube Channel now!

https://www.youtube.com/channel/UCRM3zD8oOHP7Epw6XVZ01ew


Don't forget to subscribe!
Fun and exciting Deep Learning experiments, Computer Vision, and Tech Tips too...

Thursday, August 23, 2018

Cleaning up your Anaconda installations

If you've been using Anaconda Python for a while, and been creating multiple environments and adding/removing packages, you may have noticed that it's starting to take up a lot of disk space (sometimes tens of GBs).

Anaconda installation can get big
Anaconda installation can get big


One reason is that anaconda environments are completely isolated workspaces from each other with their own copy of Python. So, the more environments you have, the larger the space needed by anaconda. But the other reason is that anaconda keeps a cache of the package files, tarballs etc. of the packages you've installed. This is great when you need to reinstall the same packages. But, over time, the space can add up.

So, how do we clean up this cache and regain some disk space?

Tuesday, July 10, 2018

Failed Attempts at Building TensorFlow GPU from Source

For the last 3 weeks, I've been trying to build TensorFlow from source. I wanted to get TensorFlow GPU version working on Windows with CUDA 9.2 and cuDNN 7.1. Since the pre-built wheels only work with CUDA 9.0, the only way we can get it working with 9.2 is to build it ourselves from source.

The Windows build of TensorFlow is done using CMake. The official instructions are here: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/cmake

Unfortunately, as I found out after multiple attempts, the build process is not as simple as it sounds.
Every attempt I have made to build it failed so far.

But, I decided to post the steps I took - which didn't work - so that you all may be able use it as a reference if you decided to try it out yourselves. Again, note that these steps did not work.

First, I started with gathering all the dependencies to build on Windows 10:
  • Visual Studio 2015 Community Edition With Update 3 (14.0.25431.01) with C++
  • Anaconda Python 3.6.5
  • Git for Windows 2.18.0
  • Swigwin 3.0.12
  • CUDA Toolkit 9.2
  • cuDNN 7.1
  • CMake 3.11.3

Sunday, June 3, 2018

Setting up the OpenMV Cam

Few weeks back, we talked about OpenMV - the small embedded computer vision module with a built-in camera, that can be programmed to perform various vision tasks. It gives you the ability to bring computer vision in to your embedded projects.

After I first read about it, I was eager to get my hands on a kit. Their official site - openmv.io - offers international shipping, as well as links to local distributes in some countries. The shipping was quite fast.

The OpenMV Cam M7
The OpenMV Cam M7

First Impressions


The cam comes with a really nice clear plastic case. The headers (used to connect other shields on to the board) comes separate (pictured above). This gives you the option to solder them - or other types of headers - yourself if needed. Headers aren't essential for the basic usage of OpenMV. Both the case and the board itself has an excellent build quality.

The cam itself is smaller than I expected: about 2/3 the size of a credit card.

The size of the OpenMV Cam
The size of the OpenMV Cam

Monday, May 14, 2018

Fixing the Matplotlib PyPlot import errors

About a week back, I was reinstalling Keras, TensorFlow and all the other libraries after a reformat of my PC. When I started verifying the library installations, I came across a strange error. When I tried to run a simple deep learning model, Python runtime crashed. As soon as I execute the script I was getting the "python.exe has stopped working" error message (I'm using Windows 10).

A little bit of debugging narrowed down the error to the following line in my script.

import matplotlib.pyplot as plt

(I was using matplotlib to graph the training history of the model. See "How to Graph Model Training History in Keras")

The error did not occur if I simply import matplotlib. It only occurred when specifically importing the pyplot module.

import matplotlib
# no errors

import matplotlib.pyplot as plt
# crash!!!

This is a known issue due to some library conflicts in the installation, which should hopefully be fixed in a future release. Until then, if you're getting this error, you can fix it by following the steps below.

Sunday, April 22, 2018

Embedded Computer Vision with OpenMV

Have you ever wanted to put computer vision into an embedded device? But wasn't sure whether it's possible to cram in a computer vision algorithm into a small hardware device?

Well, that's what the OpenMV project is all about.

OpenMV is a programmable embedded device, with a built-in camera, that you can program with variety of vision tasks.

The OpenMV Cam M7
The OpenMV Cam M7 (Image source)

The OpenMV project has been started back in 2013 with a goal of becoming the "Arduino of Machine Vision". They now have the The OpenMV Cam M7 (pictured above), powered by a 216MHz ARM Cortex M7 processor and 512KB.