Package deepnetts.data
Class ExampleImage
java.lang.Object
deepnetts.data.ExampleImage
- All Implemented Interfaces:
MLDataItem
Example image to train a deep learning model.
It holds image pixels and corresponding label.
-
Constructor Summary
ConstructorsConstructorDescriptionExampleImage
(BufferedImage image) ExampleImage
(BufferedImage image, String label) ExampleImage
(BufferedImage image, String label, int channels) ExampleImage
(BufferedImage image, String label, int targetWidth, int targetHeight) ExampleImage
(File originalImgFile, BufferedImage image, String label) ExampleImage
(File imgFile, String label) Creates an instance of new example image with specified image and label Loads image from specified file and creates matrix structures with color informationExampleImage
(String imgFile, String label) -
Method Summary
Modifier and TypeMethodDescriptionfloat
getError()
Returns a model output error for this data item.getFile()
int
getInput()
Returns an input for machine learning model of this item.getLabel()
float[]
Returns target output for machine learning model of this item.int
getWidth()
void
invert()
void
setError
(float error) final void
setTargetOutput
(TensorBase targetOutput)
-
Constructor Details
-
ExampleImage
- Throws:
IOException
-
ExampleImage
Creates an instance of new example image with specified image and label Loads image from specified file and creates matrix structures with color information- Parameters:
imgFile
- image filelabel
- image label- Throws:
IOException
- if file is not found or reading file fails from some reason.
-
ExampleImage
-
ExampleImage
-
ExampleImage
-
ExampleImage
-
ExampleImage
public ExampleImage(BufferedImage image, String label, int targetWidth, int targetHeight) throws IOException - Throws:
IOException
-
-
Method Details
-
invert
public void invert() -
getTargetOutput
Description copied from interface:MLDataItem
Returns target output for machine learning model of this item.- Specified by:
getTargetOutput
in interfaceMLDataItem
- Returns:
- target output
-
getRgbVector
public float[] getRgbVector() -
setTargetOutput
-
getWidth
public int getWidth() -
getHeight
public int getHeight() -
getLabel
-
getInput
Description copied from interface:MLDataItem
Returns an input for machine learning model of this item.- Specified by:
getInput
in interfaceMLDataItem
- Returns:
- an example input for a machine learning model training.
-
getFile
-
getOriginalImageFromFile
- Throws:
IOException
-
getError
public float getError()Description copied from interface:MLDataItem
Returns a model output error for this data item.- Specified by:
getError
in interfaceMLDataItem
- Returns:
-
setError
public void setError(float error) - Specified by:
setError
in interfaceMLDataItem
-