Class ImageLabeller<T>

Object
AnchorBean<ImageLabeller<T>>
ImageLabeller<T>
Type Parameters:
T - the type of shared-state used by the labeller
Direct Known Subclasses:
BinaryOutcomeImageLabeller, ImageCSVLabeller, ImageLabellerStringMap

public abstract class ImageLabeller<T> extends AnchorBean<ImageLabeller<T>>
Associates a label with an image.

This can be used to associate labels with images for training or evaluation in a machine-learning problem.

  • Constructor Details

    • ImageLabeller

      public ImageLabeller()
  • Method Details

    • initialize

      public abstract T initialize(Path pathForBinding) throws InitializeException
      Initializes the labeller. Should be called once before calling any other methods.
      Parameters:
      pathForBinding - a Path that can be used by the labeller to make file path decisions
      Returns:
      the initialized shared-state of type T
      Throws:
      InitializeException - if initialization fails
    • allLabels

      public abstract Set<String> allLabels(T initialization)
      Returns a set of identifiers for all groups that can be outputted by the labeller.

      This method should be callable at any time.

      Parameters:
      initialization - the initialized shared-state returned by initialize(Path)
      Returns:
      a Set of String labels
    • labelFor

      public abstract String labelFor(T sharedState, ProvidesStackInput input, InputOutputContext context) throws OperationFailedException
      Determines a particular group-identifier (label) for an input.
      Parameters:
      sharedState - the shared-state returned by initialize(Path)
      input - the ProvidesStackInput to be labelled
      context - the InputOutputContext for the operation
      Returns:
      the label as a String
      Throws:
      OperationFailedException - if the labelling operation fails