Sign in

Sharing my journey with Python, Computer Vision, Deep Learning and everything related to it. This includes the good, the bad and the ugly.
Photo by Szabolcs Varnai on Unsplash


Before we jump to how part, Let us discuss the negative consequence of choosing the wrong size. After we pick a fixed width and height, the standard procedure is to resize all the images to this fixed size. So, now every image falls into one of the two buckets.

  • Downscaling: Bigger images will be down scaled, this makes it harder for CNN to learn the features required for classification or detection as the number of pixels where the vital feature will be present is significantly reduced.
  • Upscaling: When small images are upscaled and padded with zero, then NN has to…

Photo by Startup Stock Photos from Pexels

In software development when something is wrong, usually we get an error, but with data science this is not the case. If the model is not performing well, then the general approach is to alter the model architecture or tune hyperparameters and train more. Yes, these are good options, but making sure that the data is correct should be the priority.

From the television series The Newsroom¹:

The first step in solving a problem is to recognize that it does exist.

Difference in train vs test data is the single biggest reason for low performing models. Image augmentations help to…

Photo by Garvit Jagga on Unsplash


A friend of mine reach out and asked me whether I could write a program to detect the number of Rubber stamps in an image. Apparently, these invoice receipts will be categorized based on the number of stamps on them. Initially, I thought of building a Deep Learning Segmentation model, but soon I realized that it is not worth the effort.

The images are generated in a controlled environment so few computer vision algorithms should do the trick. To illustrate the computer vision algorithms used in detecting the stamps, I will be using a sample image downloaded from Google as…


Partial functions allow us to fix values for some arguments of a function and generate a new function. The common example for partial function would be:

This example is a solid starter example for partial functions, but feels more like a syntactic sugar rather than functionality gain. Partial function shines, when you are restricted by third party modules or code which you have no control over.

Example Brief

I was playing around with Matplotlib Animation module and found that save method has a progress callback function. Callback function takes two arguments (current_frame & total_frames), but a progress bar without metadata like…


Type hints are great, they help you to write better code and reduce documentation required for external users or downstream software developers. However, type hints do not validate the input from the user. In my opinion, without any validation, you are playing the odds, but if you are up for a gamble then good luck to you! For the non-gamblers, we will explore how to do this with an example.

To validate type-hint or not


Let us write a simple function (add) which has a single argument vals. The logic for the function is:

  • Validate that the input for valsargument is a List of either…

Photo by Suzy Hazelwood from Pexels

1. Align Images Horizontally

Want to display images side by side for comparison?

  • Place the images inside a table.
  • Have the image caption as the title.
Image Source

2. Using Reference for Links

Don’t repeat yourself by typing the URL multiple times in the same Markdown file. With the help of reference, we can define the link once and reuse it as many times as required.

3. Comment

You can add comments by wrapping the comment inside [] and following it with # or go with <!--Comment Here-->.

4. Embed Video with Thumbnail

Let the reader know that this is a video by having the screenshot (with video control buttons) as the thumbnail. …

Gist Intro

Gist is a GitHub repository where you can store & share code/data with others. A single gist can store multiple files. Syntax highlighting is supported based on the file extension type, so be careful when you name the file. Gists can be public or secret. Do note that secret gists aren’t private, meaning anyone with the URL would be able to view the code/data.

Why to use gist?

  • Supports GitHub repository functionalities like version control, fork & clone.
  • Ability to subscribe, star and comment makes gist easy to collaborate with others.
  • Gist can be shared in multiple ways without any dependency or installation.

Why the hell build UI in Notebook?

Short Answer:

Share the Deep Learning model notebook with colleagues from different teams like Business, Data Science, Front End developer, DevOps for their opinion before the real software development takes place.

Jupyter notebook is meant for quick prototyping and everyone knows this but what many misses is we can also do a quick prototype of UI as well. Many data scientists are quick to start building the big deep learning model with whatever little data they have without even thinking about what they are developing and for whom 🤷‍♂️. Trust me, the first model you are satisfied with (based on…

Deep dive

No matter what happened previously, the final-block is executed once the code block is complete and any raised exceptions handled. Even if there’s an error in an exception handler or the else-block and a new exception is raised, the code in the final-block is still run.

This quote from the python documentation is absolutely correct but the execution behavior is little tricky when try and finally blocks are encapsulated within a function which has a return statement. Let me explain with examples. See if you could guess the output of the following functions.

Example 1:

# Both the try & final blocks…

Getting Started

Before we get into what is Type Dispatch? or How Type dispatch can make you a better Python programmer, let us get some basics out of the way like What is a good python function? To be honest, I would rather let Jeff Knupp explain it.

I truly believe that the only way to really understand howsomething works is by breaking it into granular pieces and putting it back together or building it from scratch. Let us take a very well-defined use case and write a function for it from scratch. …

Aravind Ramalingam

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