Package org.tribuo.interop.tensorflow
Class ImageConverter
java.lang.Object
org.tribuo.interop.tensorflow.ImageConverter
- 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
,FeatureConverter
Image converter. Assumes the feature id numbers are linearised ids of the form:
[0,0,0] = 0, [0,0,1] = 1, [0,1,0] = k, [1,0,0] = j*k, ..., [i,0,0] = i*j*k,That is, they are in multidimensional row major order (e.g. the order used by
IDXDataSource
).- See Also:
-
Constructor Summary
ConstructorDescriptionImageConverter
(String inputName, int width, int height, int channels) Builds an image converter for images of the supplied size. -
Method Summary
Modifier and TypeMethodDescriptionconvert
(List<? extends Example<?>> examples, ImmutableFeatureMap featureIDMap) Transform implicitly pads unseen values with zero.convert
(Example<?> example, ImmutableFeatureMap featureIDMap) Transform implicitly pads unseen values with zero.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
Gets a view of the names of the inputs this converter produces.void
Used by the OLCUT configuration system, and should not be called by external code.toString()
-
Constructor Details
-
ImageConverter
Builds an image converter for images of the supplied size.- Parameters:
inputName
- The input name.width
- The image width.height
- The image height.channels
- The number of colour 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 interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
inputNamesSet
Description copied from interface:FeatureConverter
Gets a view of the names of the inputs this converter produces.- Specified by:
inputNamesSet
in interfaceFeatureConverter
- Returns:
- The input names.
-
convert
Transform implicitly pads unseen values with zero.- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
example
- The example to transform.featureIDMap
- The feature id mapping to use.- Returns:
- A 4d tensor, (1, width, height, channels) for this example.
-
convert
Transform implicitly pads unseen values with zero.Converts a batch of examples into a Tensor.
- Specified by:
convert
in interfaceFeatureConverter
- 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.
-
convert
Description copied from interface:FeatureConverter
Converts aSGDVector
representing the features into aTensorMap
.It generates it as a single example minibatch.
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
vector
- The features to convert.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing this vector.
-
convert
Description copied from interface:FeatureConverter
- Specified by:
convert
in interfaceFeatureConverter
- Parameters:
vectors
- The batch of features to convert.- Returns:
- A TensorMap (similar to a TF Python feed_dict) representing this minibatch.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-