January 2019
Intermediate to advanced
322 pages
7h 29m
English
Two strategies are possible for preprocessing images before we starting training on a Spark cluster. The first strategy is about preprocessing the images locally by using the SparkDataUtils class of dl4j-spark. For example:
import org.datavec.image.loader.NativeImageLoaderimport org.deeplearning4j.spark.util.SparkDataUtils...val sourcePath = "/home/guglielmo/trainingImages"val sourceDir = new File(sourcePath)val destinationPath = "/home/guglielmo/preprocessedImages"val destDir = new File(destinationPath)val batchSize = 32SparkDataUtils.createFileBatchesLocal(sourceDir, NativeImageLoader.ALLOWED_FORMATS, true, destDir, batchSize)
In this example, sourceDir is the root directory of the local images, destDir is the local directory ...
Read now
Unlock full access