Category Archives: Machine Learning

Extended Kalman Filter Explained with Python Code

In the following code, I have implemented an Extended Kalman Filter for modeling the movement of a car with constant turn rate and velocity. The code is mainly based on this work (I did some bug fixing and some adaptation such that the code runs similar to the Kalman filter that I have earlier implemented).

Extended Kalman filter

Trajectory of the car, click on the image for large scale



References: [1] [2] [3] [4] [5]

Parcticle Filter Explained With Python Code From Scratch

In the following code I have implemented a localization algorithm based on particle filter.

I have used conda to run my code, you can run the following for installation of dependencies:


and the code:

 

Kalman Filter Explained With Python Code From Scratch

This snippet shows tracking mouse cursor with Python code from scratch and comparing the result with OpenCV. The CSV file that has been used are being created with below c++ code. A sample could be downloaded from here 1, 2, 3.

Python Kalman Filter

C++ and OpenCV Kalman Filter

Rapidcsv has been downloaded from here


 

Camera Calibration Based on Zhang’s Algorithm (Chess Board) Explained

Human detection and Pose Estimation with Deep Learning for Sport Analysis

Pose estimation and tracking human is one the key step in sports analysis. Here is in this work I used openpose for analysis of player in a Bundesliga game HSV Hamburg vs Bayer München. Warning: the video might be disturbing for HSV fans 🙂

 

Original Video

Analyzed Video

Original Video

Analyzed Video

Original Video

Analyzed Video

Original Video

Analyzed Video

Vaganova_Ballet_Academy from Behnam Asadi on Vimeo.

 

Original Video

Analyzed Video

 

 

Thiem_Zverev from Behnam Asadi on Vimeo.

Deep Dreams with Caffe on Ubuntu 16.04

First, install caffe as being explained in my other post here.

Googlenet Model

Download the bvlc_googlenet.caffemodel from https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet

and put it in
caffe/models/bvlc_googlenet/

PIP

IPython, scipy, Jupyter, protobuf, scikit-image

Always install in the user space with –user

Running  jupyter notebook

open  a new notebook and paste the following into it and correct the “model_path” and

img = np.float32(PIL.Image.open(‘/home/behnam/Downloads/fractal.jpg’)) according to your setup.


 

Installing NVIDIA DIGIST Ubuntu 16.04

Prerequisite

Protobuf 3

caffe

Install caffe as being explained in my other post here.

DIGITS

visit https://github.com/NVIDIA/DIGITS/

Dependencies

# Install repo packages

Building DIGITS

Open in the browser:

http://localhost:5000/

Installing Caffe on Ubuntu 16.04

CUDA Toolkit 9.1

visit https://developer.nvidia.com/cuda-downloads and download the correct deb file then:

Basic Linear Algebra Subprograms (BLAS)

Protocol Buffers

or you can install protobuf v3  it from source:

Lightning Memory-Mapped Database

LevelDB

Hdf5

gflags

glog

Snappy

Caffe

Breadth-first search (BFS) and Depth-first search (DSF) Algorithm in Python

BFS traverse:

DFS traverse:



RANSAC Algorithm parameter explained

In this tutorial I explain the RANSAC algorithm, their corresponding parameters and how to choose the number of samples:

N = number of samples
e = probability that a point is an outlier
s = number of points in a sample
p = desired probability that we get a good sample
N =log(1-p) /log(1- (1- e) s )

ref: 1