How it works...

The functionality is as follows:

  1. The crop() function executes the following tasks:
    1. Multiplies all pixels with an intensity of 28 with a numpy array of 1s and stores in variable a.
    2. Checks for all instances where an entire column consists of only pixel intensities of 28 and stores in variable b.
    3. Deletes all columns (or Y axes) where pixel intensities are 28 for the entire column.
    4. Plots the resulting image. 
    1. Transposes the image in order to perform the preceding set of operations on all the rows (or X axes) in a similar manner.
    1. Multiplies all pixels with an intensity of 28 with a numpy array of 1s and stores in variable d.
    2. Checks for all instances where an entire column consists of only pixel intensities of 28 and ...

Get Apache Spark Deep Learning Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.