Package org.datavec.image.loader
Class LFWLoader
- java.lang.Object
-
- org.datavec.image.loader.BaseImageLoader
-
- org.datavec.image.loader.LFWLoader
-
- All Implemented Interfaces:
Serializable
public class LFWLoader extends BaseImageLoader implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.datavec.image.loader.BaseImageLoader
BaseImageLoader.MultiPageMode
-
-
Field Summary
Fields Modifier and Type Field Description static intCHANNELSstatic StringDATA_URLStringdataFilestatic intHEIGHTprotected InputSplit[]inputSplitstatic PathLabelGeneratorLABEL_PATTERNstatic StringLABEL_URLStringlabelFilestatic intNUM_IMAGESstatic intNUM_LABELSprotected static StringREGEX_PATTERNstatic intSUB_NUM_IMAGESstatic intSUB_NUM_LABELSstatic StringSUBSET_URLStringsubsetFileprotected booleanuseSubsetstatic intWIDTH-
Fields inherited from class org.datavec.image.loader.BaseImageLoader
ALLOWED_FORMATS, centerCropIfNeeded, channels, height, imageTransform, multiPageMode, rng, width
-
-
Constructor Summary
Constructors Constructor Description LFWLoader()LFWLoader(boolean useSubset)LFWLoader(int[] imgDim, boolean useSubset)LFWLoader(int[] imgDim, ImageTransform imgTransform, boolean useSubset)LFWLoader(long[] imgDim, boolean useSubset)LFWLoader(long[] imgDim, ImageTransform imgTransform, boolean useSubset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImageasImageMatrix(File f)As perBaseImageLoader.asMatrix(File)but as anImageImageasImageMatrix(File f, boolean nchw)As perBaseImageLoader.asMatrix(File, boolean)but as anImageImageasImageMatrix(InputStream inputStream)As perBaseImageLoader.asMatrix(InputStream)but as anImageImageasImageMatrix(InputStream inputStream, boolean nchw)As perBaseImageLoader.asMatrix(InputStream, boolean)but as anImageINDArrayasMatrix(File f)As perBaseImageLoader.asMatrix(File, boolean)but NCHW/channels_first formatINDArrayasMatrix(File f, boolean nchw)Load an image from a file to an INDArrayINDArrayasMatrix(InputStream inputStream)INDArrayasMatrix(InputStream inputStream, boolean nchw)Load an image file from an input stream to an INDArrayINDArrayasRowVector(File f)INDArrayasRowVector(InputStream inputStream)RecordReadergetRecordReader(long numExamples)RecordReadergetRecordReader(long batchSize, long numExamples, boolean train, double splitTrainTest)RecordReadergetRecordReader(long batchSize, long numExamples, int[] imgDim, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, int[] imgDim, long numLabels, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, int[] imgDim, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, long[] imgDim, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, long[] imgDim, long numLabels, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, long[] imgDim, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, long numLabels, Random rng)RecordReadergetRecordReader(long batchSize, long numExamples, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)booleanimageFilesExist()voidload()voidload(long batchSize, long numExamples, long numLabels, PathLabelGenerator labelGenerator, double splitTrainTest, Random rng)-
Methods inherited from class org.datavec.image.loader.BaseImageLoader
downloadAndUntar, getAllowedFormats
-
-
-
-
Field Detail
-
NUM_IMAGES
public static final int NUM_IMAGES
- See Also:
- Constant Field Values
-
NUM_LABELS
public static final int NUM_LABELS
- See Also:
- Constant Field Values
-
SUB_NUM_IMAGES
public static final int SUB_NUM_IMAGES
- See Also:
- Constant Field Values
-
SUB_NUM_LABELS
public static final int SUB_NUM_LABELS
- See Also:
- Constant Field Values
-
HEIGHT
public static final int HEIGHT
- See Also:
- Constant Field Values
-
WIDTH
public static final int WIDTH
- See Also:
- Constant Field Values
-
CHANNELS
public static final int CHANNELS
- See Also:
- Constant Field Values
-
DATA_URL
public static final String DATA_URL
- See Also:
- Constant Field Values
-
LABEL_URL
public static final String LABEL_URL
- See Also:
- Constant Field Values
-
SUBSET_URL
public static final String SUBSET_URL
- See Also:
- Constant Field Values
-
REGEX_PATTERN
protected static final String REGEX_PATTERN
- See Also:
- Constant Field Values
-
LABEL_PATTERN
public static final PathLabelGenerator LABEL_PATTERN
-
dataFile
public String dataFile
-
labelFile
public String labelFile
-
subsetFile
public String subsetFile
-
useSubset
protected boolean useSubset
-
inputSplit
protected InputSplit[] inputSplit
-
-
Constructor Detail
-
LFWLoader
public LFWLoader()
-
LFWLoader
public LFWLoader(boolean useSubset)
-
LFWLoader
public LFWLoader(int[] imgDim, boolean useSubset)
-
LFWLoader
public LFWLoader(long[] imgDim, boolean useSubset)
-
LFWLoader
public LFWLoader(int[] imgDim, ImageTransform imgTransform, boolean useSubset)
-
LFWLoader
public LFWLoader(long[] imgDim, ImageTransform imgTransform, boolean useSubset)
-
-
Method Detail
-
load
public void load()
-
load
public void load(long batchSize, long numExamples, long numLabels, PathLabelGenerator labelGenerator, double splitTrainTest, Random rng)
-
imageFilesExist
public boolean imageFilesExist()
-
getRecordReader
public RecordReader getRecordReader(long numExamples)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, long numLabels, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, boolean train, double splitTrainTest)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, int[] imgDim, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, long[] imgDim, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, int[] imgDim, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, long[] imgDim, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, int[] imgDim, long numLabels, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)
-
getRecordReader
public RecordReader getRecordReader(long batchSize, long numExamples, long[] imgDim, long numLabels, PathLabelGenerator labelGenerator, boolean train, double splitTrainTest, Random rng)
-
asRowVector
public INDArray asRowVector(File f) throws IOException
- Specified by:
asRowVectorin classBaseImageLoader- Throws:
IOException
-
asRowVector
public INDArray asRowVector(InputStream inputStream) throws IOException
- Specified by:
asRowVectorin classBaseImageLoader- Throws:
IOException
-
asMatrix
public INDArray asMatrix(File f) throws IOException
Description copied from class:BaseImageLoaderAs perBaseImageLoader.asMatrix(File, boolean)but NCHW/channels_first format- Specified by:
asMatrixin classBaseImageLoader- Throws:
IOException
-
asMatrix
public INDArray asMatrix(File f, boolean nchw) throws IOException
Description copied from class:BaseImageLoaderLoad an image from a file to an INDArray- Specified by:
asMatrixin classBaseImageLoader- Parameters:
f- File to load the image fromnchw- If true: return image in NCHW/channels_first [1, channels, height width] format; if false, return in NHWC/channels_last [1, height, width, channels] format- Returns:
- Image file as as INDArray
- Throws:
IOException
-
asMatrix
public INDArray asMatrix(InputStream inputStream) throws IOException
- Specified by:
asMatrixin classBaseImageLoader- Throws:
IOException
-
asMatrix
public INDArray asMatrix(InputStream inputStream, boolean nchw) throws IOException
Description copied from class:BaseImageLoaderLoad an image file from an input stream to an INDArray- Specified by:
asMatrixin classBaseImageLoader- Parameters:
inputStream- Input stream to load the image fromnchw- If true: return image in NCHW/channels_first [1, channels, height width] format; if false, return in NHWC/channels_last [1, height, width, channels] format- Returns:
- Image file stream as as INDArray
- Throws:
IOException
-
asImageMatrix
public Image asImageMatrix(File f) throws IOException
Description copied from class:BaseImageLoaderAs perBaseImageLoader.asMatrix(File)but as anImage- Specified by:
asImageMatrixin classBaseImageLoader- Throws:
IOException
-
asImageMatrix
public Image asImageMatrix(File f, boolean nchw) throws IOException
Description copied from class:BaseImageLoaderAs perBaseImageLoader.asMatrix(File, boolean)but as anImage- Specified by:
asImageMatrixin classBaseImageLoader- Throws:
IOException
-
asImageMatrix
public Image asImageMatrix(InputStream inputStream) throws IOException
Description copied from class:BaseImageLoaderAs perBaseImageLoader.asMatrix(InputStream)but as anImage- Specified by:
asImageMatrixin classBaseImageLoader- Throws:
IOException
-
asImageMatrix
public Image asImageMatrix(InputStream inputStream, boolean nchw) throws IOException
Description copied from class:BaseImageLoaderAs perBaseImageLoader.asMatrix(InputStream, boolean)but as anImage- Specified by:
asImageMatrixin classBaseImageLoader- Throws:
IOException
-
-