Image-feature extraction

When dealing with unstructured data, be it text or images, we must first convert the data into a numerical representation that's usable by our machine learning model. The process of converting data that is non-numeric into a numerical representation is called feature extraction. For image data, our features are the pixel values of the image.

First, let's imagine a 1,150 x 1,150 pixel grayscale image. A 1,150 x 1,150 pixel image will return a 1,150 x 1,150 matrix of pixel intensities. For grayscale images, the pixel values can range from 0 to 255, with 0 being a completely black pixel, and 255 being a completely white pixel, and shades of gray in between.

To demonstrate what this looks like in code, let's extract ...

Get Python Machine Learning Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.