Machine Learning

Image compression

Rahav Dor comprssed image

This mini-project deals with a cool application of machine learning to image compression. In particular the K-means algorithm is used to learn the most common color of different areas of a source image. Of course, part of the challenge is that we do not want to assume any prior knowledge of what defines an area in a picture. The learned-most-common-color is then used by the system to repaint the image.

The image does not have to be as pixelated as it appears on the left, I just happen to like the artistic result when I restricted the number of clusters that the algorithm is allowed to learn. I am interested in bio-inspired machine learning algorithms because I believe that there are applications in which they will be more useful than the current mathematics based learning. (at K-means designers had that intension) A compressed image that is also an authentic representation of the original image is given in the Israeli salad picture below.

This is an application of unsupervised learning. It used the K-means algorithm to learn how pixels should be clustered into zones in the image, where each zone has a "similar" or characteristic color. To understand the difficulty that the algorithm solves, think about the fact that K-means is not being given any data about where in the image it can find a zone.
In the particular image shown below the file was compressed by 45.0% which is impressive for two facts. (1) The original image already uses compression (its a .png format); and (2) The original image was already small in size (it is 132 x 128 pixels and takes only 46,467 bytes), has rich color palette, and numerous color zones.

Original image before compression
Original image before compression.
Image after compression
Image after compression (45%).



Back to projects page