Data sources
In this section, we introduce how to use data source in ML to load data. Beside some general data sources such as Parquet, CSV, JSON and JDBC, we also provide some specific data sources for ML.
Table of Contents
Image data source
This image data source is used to load image files from a directory, it can load compressed image (jpeg, png, etc.) into raw image representation via ImageIO
in Java library.
The loaded DataFrame has one StructType
column: “image”, containing image data stored as image schema.
The schema of the image
column is:
- origin:
StringType
(represents the file path of the image) - height:
IntegerType
(height of the image) - width:
IntegerType
(width of the image) - nChannels:
IntegerType
(number of image channels) - mode:
IntegerType
(OpenCV-compatible type) - data:
BinaryType
(Image bytes in OpenCV-compatible order: row-wise BGR in most cases)
ImageDataSource
implements a Spark SQL data source API for loading image data as a DataFrame.
ImageDataSource
implements Spark SQL data source API for loading image data as DataFrame.
In PySpark we provide Spark SQL data source API for loading image data as DataFrame.
In SparkR we provide Spark SQL data source API for loading image data as DataFrame.