Package org.datavec.image.loader
Class BaseImageLoader
- java.lang.Object
-
- org.datavec.image.loader.BaseImageLoader
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ImageLoader,LFWLoader,NativeImageLoader
public abstract class BaseImageLoader extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseImageLoader.MultiPageMode
-
Field Summary
Fields Modifier and Type Field Description static String[]ALLOWED_FORMATSprotected booleancenterCropIfNeededprotected longchannelsprotected longheightprotected ImageTransformimageTransformprotected BaseImageLoader.MultiPageModemultiPageModeprotected Randomrngprotected longwidth
-
Constructor Summary
Constructors Constructor Description BaseImageLoader()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ImageasImageMatrix(File f)As perasMatrix(File)but as anImageabstract ImageasImageMatrix(File f, boolean nchw)As perasMatrix(File, boolean)but as anImageabstract ImageasImageMatrix(InputStream inputStream)As perasMatrix(InputStream)but as anImageabstract ImageasImageMatrix(InputStream inputStream, boolean nchw)As perasMatrix(InputStream, boolean)but as anImageabstract INDArrayasMatrix(File f)As perasMatrix(File, boolean)but NCHW/channels_first formatabstract INDArrayasMatrix(File f, boolean nchw)Load an image from a file to an INDArrayabstract INDArrayasMatrix(InputStream inputStream)abstract INDArrayasMatrix(InputStream inputStream, boolean nchw)Load an image file from an input stream to an INDArrayabstract INDArrayasRowVector(File f)abstract INDArrayasRowVector(InputStream inputStream)static voiddownloadAndUntar(Map urlMap, File fullDir)String[]getAllowedFormats()
-
-
-
Field Detail
-
ALLOWED_FORMATS
public static final String[] ALLOWED_FORMATS
-
rng
protected Random rng
-
height
protected long height
-
width
protected long width
-
channels
protected long channels
-
centerCropIfNeeded
protected boolean centerCropIfNeeded
-
imageTransform
protected ImageTransform imageTransform
-
multiPageMode
protected BaseImageLoader.MultiPageMode multiPageMode
-
-
Method Detail
-
getAllowedFormats
public String[] getAllowedFormats()
-
asRowVector
public abstract INDArray asRowVector(File f) throws IOException
- Throws:
IOException
-
asRowVector
public abstract INDArray asRowVector(InputStream inputStream) throws IOException
- Throws:
IOException
-
asMatrix
public abstract INDArray asMatrix(File f) throws IOException
As perasMatrix(File, boolean)but NCHW/channels_first format- Throws:
IOException
-
asMatrix
public abstract INDArray asMatrix(File f, boolean nchw) throws IOException
Load an image from a file to an INDArray- 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 abstract INDArray asMatrix(InputStream inputStream) throws IOException
- Throws:
IOException
-
asMatrix
public abstract INDArray asMatrix(InputStream inputStream, boolean nchw) throws IOException
Load an image file from an input stream to an INDArray- 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 abstract Image asImageMatrix(File f) throws IOException
As perasMatrix(File)but as anImage- Throws:
IOException
-
asImageMatrix
public abstract Image asImageMatrix(File f, boolean nchw) throws IOException
As perasMatrix(File, boolean)but as anImage- Throws:
IOException
-
asImageMatrix
public abstract Image asImageMatrix(InputStream inputStream) throws IOException
As perasMatrix(InputStream)but as anImage- Throws:
IOException
-
asImageMatrix
public abstract Image asImageMatrix(InputStream inputStream, boolean nchw) throws IOException
As perasMatrix(InputStream, boolean)but as anImage- Throws:
IOException
-
-