Class ImageTransformer<T extends Output<T>>

java.lang.Object
org.tribuo.interop.tensorflow.ImageTransformer<T>
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable, ExampleTransformer<T>

public class ImageTransformer<T extends Output<T>> extends Object implements ExampleTransformer<T>
Image transformer. Assumes the feature id numbers are linearised ids of the form [0,0,0] = 0, [1,0,0] = 1, ..., [i,0,0] = i, [0,1,0] = i+1, ..., [i,j,0] = i*j, ... [0,0,1] = (i*j)+1, ..., [i,j,k] = i*j*k.
See Also:
  • Constructor Details

    • ImageTransformer

      public ImageTransformer(int width, int height, int channels)
  • Method Details

    • postConfig

      public void postConfig()
      Used by the OLCUT configuration system, and should not be called by external code.
      Specified by:
      postConfig in interface com.oracle.labs.mlrg.olcut.config.Configurable
    • transform

      public org.tensorflow.Tensor<?> transform(Example<T> example, ImmutableFeatureMap featureIDMap)
      Transform implicitly pads unseen values with zero.
      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      example - The example to transform.
      featureIDMap - The feature id mapping to use.
      Returns:
      A 3d tensor, (width, height, channels) for this example.
    • transform

      public org.tensorflow.Tensor<?> transform(List<Example<T>> examples, ImmutableFeatureMap featureIDMap)
      Transform implicitly pads unseen values with zero.

      Converts a batch of examples into a Tensor.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      examples - The examples to transform.
      featureIDMap - The feature id mapping to use.
      Returns:
      A 4d tensor, (batch-id, width, height, channels) for this example.
    • transform

      public org.tensorflow.Tensor<?> transform(SparseVector vector)
      Description copied from interface: ExampleTransformer
      Converts a SparseVector representing the features into a Tensor.

      It generates it as a single example minibatch.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      vector - The features to convert.
      Returns:
      A dense Tensor representing this vector.
    • transform

      public org.tensorflow.Tensor<?> transform(List<SparseVector> vectors)
      Description copied from interface: ExampleTransformer
      Converts a list of SparseVectors representing a batch of features into a Tensor.

      Specified by:
      transform in interface ExampleTransformer<T extends Output<T>>
      Parameters:
      vectors - The batch of features to convert.
      Returns:
      A dense Tensor representing this minibatch.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProvenance

      public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<T extends Output<T>>