Browse by category

K-Nearest Neighbours: Classify (recognize) things

Recognizing things is a common problem in machine learning. Even in the SuDoKu Solver demo, we require a mechanism to identify digits in the SuDoKu grid. To do this, we’ll use a simple algorithm called K-Nearest. It’s one of the simplest machine learning algorithms. The results aren’t going to be robust, but we’ll get some […]

Read more

Obstacle avoidance with the Bug-1 algorithm

Obstacle avoidance is an indispensable behavior in mobile robots. If a robot has no sensors, it’s a blind robot. If it has proximity sensors but still it keeps hitting whatever comes in its way, then it’s a ‘’brainless’’ robot. Imagine an ant or any insect walking on the ground. The insect is heading towards a […]

Read more

Timing macros in C/C++

Often you need to calculate the time it takes to execute a certain set of operations. And if you’re trying to optimize your code, you’ll need this even more. So here’s a set of useful  macros that can help you do that (without any plumbing). The Timing Macros These macros use the OpenCV functions cvGetTickCount() […]

Read more

K-Means clustering in OpenCV

K-Means is an algorithm to detect clusters in a given set of points. It does this without you supervising or correcting the results. It works with any number of dimensions as well (that is, it works on a plane, 3D space, 4D space and any other finite dimensional spaces). And OpenCV comes with this algorithm […]

Read more

K-Means clustering

K-Means is a clustering algorithm. That means you can “group” points based on their neighbourhood. When a lot of points a near by, you mark them as one cluster. With K-means, you can find good center points for these clusters. This “clustering” is not limited to two dimensions. You can have points in 3 dimensions. […]

Read more

Linear separability

Linear separability is an important concept in neural networks. The idea is to check if you can separate points in an n-dimensional space using only n-1 dimensions. Lost it? Here’s a simpler explanation. One Dimension Lets say you’re on a number line. You take any two numbers. Now, there are two possibilities: You choose two […]

Read more

Solving for intersection of lines efficiently

One of the most common tasks done with lines is detecting their intersection. For some reason, not many people know how to do that on a computer. In this post, I assume you have some lines. You got them from some algorithm, or the user supplied them, or whatever. And you want to find the […]

Read more

Converting lines from normal to slope-intercept form

Several algorithms return lines in the normal form (like The Hough transform) while other algorithms may require these lines in another format (like drawing a line on screen). The slop-intercept form of lines is widely known, and you can easily convert a line in slope-intercept form to other forms. So knowing how to efficiently do […]

Read more

7 unique neural network architectures

They way you interconnect neurons plays an extremely important role. In fact, researchers try to find new architectures that can be used for many purposes. I’ll talk about a few architectures over here. The dictomizer You’ve already seen this one. It consists of a single neuron, and can classify between two different sets. Nothing fancy […]

Read more

Dictomizer examples: AND/OR gates

Now that you know how a dictomizer works, we’ll work on some more examples. I’ll leave the mathematical calculates for you. Make sure you do them! AND gate We’ll create a 2 input AND gate. Since there are two inputs, we can assume this to be a 2 dimensional Cartesian plane. Something like this: The […]

Read more