This article explains the ASMNet, a lightweight Convolutional Neural Network (CNN) for facial landmark points detection (a.k.a Face Alignment) and face pose estimation in the wild.

The code and the pre-trained models are available on Github here. You can also read the original paper here.


Facial Landmark Points Detection is an essential task in many facial image analyses and applications. It is crucial for facial image alignment, face recognition, pose estimation, and facial expression recognition. Several methods have been proposed for facial landmark points detection such as Constrained Local ModelBased Methods [1, 2], AAM [3, 4], part models [5], and…

How to generate a histogram for an image, how to equalize the histogram, and finally how to modify your image histogram to be similar to another histogram.

The code is available here on Github.

What is an image histogram?

Before start defining the histogram, for simplicity, we use grayscales images. Then later I explain the process for the color images as well.

The image histogram indicates the intensity distribution of an image. In other words, the image histogram shows the number of pixels in an image having a specific intensity value. As an example, assume a normal image with pixel intensities varies from 0 to 255. In order to generate its histogram we only need to count the number of pixels having intensity value 0, then 1 and continue to the 255…

Sample Residual Network
Sample Residual Network
Figure.1: Sample Residual Network.(model is depicted using Netron)

The code with an explanation is available at GitHub.

ResNet, was first introduced by Kaiming He[1]. If you are not familiar with Residual Networks and why they can more likely improve the accuracy of a network, I recommend you to take a look at the paper here.

While creating a Sequential model in Tensor flow and Keras is not too complex, creating a residual network might have some complexities. In this article, I show you how to create a residual network from scratch.


  • Task type: classifying handwritten digits.
  • Dataset: THE MNIST DATABASE(available here).
  • Network Architecture: a small residual network shown in Figure 1.
  • Optimizer: Adam
  • Loss function: categorical_crossentropy

Code directory structure:


Image Demosaicing: Bilinear Interpolation VS High-Quality Linear Interpolation

you can download the code here.

In this story, I will explain two different algorithms in order to demosaic the images captured by a CCD camera and save based on the Bayer filter. In Fig.1, we show a bggr pixel arrangement according to the Bayer filter. As shown, for the red as well as the blue channel, we keep only 25% of the pixels. For the green channel, 50% of the pixels are kept. By demosaicing the image, we are going to interpolate the missed pixels. We use two different algorithms to demosaic a Beyer image.

Figure.1: Pixels arrangement based on the Bayer filter. (Image source.)
Figure.1: Pixels arrangement based on the Bayer filter. (Image source.)
Figure.1: Pixels arrangement based on the Bayer filter. (Image source.)

Bilinear Interpolation

Bilinear interpolating is the…

Ali Pourramezan Fard

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store