Class ExampleImage

java.lang.Object
deepnetts.data.ExampleImage
All Implemented Interfaces:
MLDataItem

public class ExampleImage extends Object implements MLDataItem
Example image to train a deep learning model. It holds image pixels and corresponding label.
  • Field Details

    • rgbTensor

      protected Tensor3D rgbTensor
  • Constructor Details

    • ExampleImage

      public ExampleImage(String imgFile, String label) throws IOException
      Throws:
      IOException
    • ExampleImage

      public ExampleImage(File imgFile, String label) throws IOException
      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 file
      label - image label
      Throws:
      IOException - if file is not found or reading file fails from some reason.
    • ExampleImage

      public ExampleImage(BufferedImage image, String label)
    • ExampleImage

      public ExampleImage(BufferedImage image, String label, int channels)
    • ExampleImage

      public ExampleImage(File originalImgFile, BufferedImage image, String label)
    • ExampleImage

      public ExampleImage(BufferedImage image)
    • ExampleImage

      public ExampleImage(BufferedImage image, String label, int targetWidth, int targetHeight) throws IOException
      Throws:
      IOException
  • Method Details

    • createInputFromPixels

      protected void createInputFromPixels(BufferedImage image, int channels)
    • invert

      public void invert()
    • getTargetOutput

      public TensorBase getTargetOutput()
      Description copied from interface: MLDataItem
      Returns target output for machine learning model of this item.
      Specified by:
      getTargetOutput in interface MLDataItem
      Returns:
      target output
    • getRgbVector

      public float[] getRgbVector()
    • setTargetOutput

      public final void setTargetOutput(TensorBase targetOutput)
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • getLabel

      public String getLabel()
    • getInput

      public Tensor3D getInput()
      Description copied from interface: MLDataItem
      Returns an input for machine learning model of this item.
      Specified by:
      getInput in interface MLDataItem
      Returns:
      an example input for a machine learning model training.
    • getFile

      public File getFile()
    • getOriginalImageFromFile

      public BufferedImage getOriginalImageFromFile() throws IOException
      Throws:
      IOException
    • getError

      public float getError()
      Description copied from interface: MLDataItem
      Returns a model output error for this data item.
      Specified by:
      getError in interface MLDataItem
      Returns:
    • setError

      public void setError(float error)
      Specified by:
      setError in interface MLDataItem