How to convert images from AWS to OpenCV/NumPy

Today, since I need to store a large dataset and to access it like I am on my local machine, I explored AWS S3. After having created a bucket, I had a look at the official guide of boto3. The guide suggests to download the files to your local HD and then processing them. This brings to a continuous download and delete files that is not healthy for your hard drive.

Read More

How automatically check if a git repo is up-to-date

If you, like me, are looking for an automatic way for checking if a github repository is up-to-date because you cannot setup a Continuous Deployment (CD) environment, this is the right place. I made a set of bash scripts together with a cron job for solving such a problem. Let’s start from the script: #!/bin/bash FOLDER=${1:-'@{u}'} cd $FOLDER git fetch LOCAL=$(git rev-parse @) REMOTE=$(git rev-parse @{u}) if [ $LOCAL = $REMOTE ]; then echo "The branch is Up-to-date" else echo "The branch Needs to pull" git pull origin master && \ do stuff with your docker container or your code fi If we analyze the above bash script, we can see that it supposes to check if the master brach is up-to-date.

Read More

Color Quantization

In this post, we are going to talk about color quantization. Color quantization is a technique for reducing the number of used in an image and, as stated in Wikipedia “this is important for displaying images on devices that support a limited number of colors and for efficiently compressing certain kinds of images. This also leads to a less variance in the colors. In other terms, if we want that an image is made of just 5 colors, a color quantization technique analyzes the image pixel by pixel in order to fit those pixels in the range defined by the 5 colors and so, rearranging the image.

Read More