PySpark image-prediction application

In our Python-based image-prediction application, we go through the following steps (numbered to correspond to the numbered comments in our Python code file):

The following Python code file, called chp07-03-convolutional-neural-network-image-predictor.py, can be found in the GitHub repository accompanying this book.
  1. First, we import the required Python dependencies as usual, including the DeepImagePredictor class from the third-party sparkdl Spark package, as shown in the following code:
from sparkdl import DeepImagePredictorfrom pyspark.sql import SparkSessionfrom pyspark.ml.image import ImageSchema
  1. Next, we create a SparkSession that acts as an entry point into the Spark execution environment, as ...

Get Machine Learning with Apache Spark Quick Start Guide 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.