Classes

The following classes are available globally.

  • Wraps a CVPixelBuffer and its orientation so that it can provide data to and receive data from a tensor.

    See more

    Declaration

    Objective-C

    @interface TIOPixelBuffer : NSObject <TIOData>

    Swift

    class TIOPixelBuffer : NSObject, TIOData
  • Encapsulates information about the input and output layers of a model, fully described by a TIOLayerDescription. Used internally by a model when parsing its description. Also used to match inputs and outputs to their corresponding layers.

    This is an algebraic data type inspired by Remodel: https://github.com/facebook/remodel. In Swift it would be an Enumeration with Associated Values. The intent is to capture the variety of inputs and outputs a model can accept and produce in a unified interface.

    Normally you will not need to interact with this class, although you may request a TIOLayerDescription from a conforming TIOModel for inputs or outputs that you are specifically interested in, for example, a pixel buffer input when you want greater control over scaling and clipping an image before passing it to the model.

    See more

    Declaration

    Objective-C

    @interface TIOLayerInterface : NSObject

    Swift

    class TIOLayerInterface : NSObject
  • The description of a vector (array) input or output later.

    Vector inputs and outputs are always unrolled vectors, and from the tensor’s perspective they are just an array of bytes. The total length of a vector will be the total volume of the layer. For example, if an input layer is a tensor of shape (24,24,2), the length of the vector will be 24x24x2 = 1152.

    TensorFlow Lite models expect row major ordering of bytes, such that higher order dimensions are traversed first. For example, a 2x4 matrix with the following values:

    @code [[1 2 3 4] [5 6 7 8]] @endcode

    should be unrolled and provided to the model as:

    @code [1 2 3 4 5 6 7 8] @endcode

    i.e, start with the row and traverse the columns before moving to the next row.

    Because output layers are also exposed as an array of bytes, a TIOTFLiteModel will always return a vector in one dimension. If is up to you to reshape it if required.

    @warning A TIOVectorLayerDescription‘s length is different than the byte length of a TIOData object. For example a quantized TIOVector (uint8_t) of length 4 will occupy 4 bytes of memory but an unquantized TIOVector (float_t) of length 4 will occupy 16 bytes of memory.

    See more

    Declaration

    Objective-C

    @interface TIOVectorLayerDescription : NSObject <TIOLayerDescription>

    Swift

    class TIOVectorLayerDescription : NSObject, TIOLayerDescription
  • Encapsulates information about a TIOModel without actually loading the model.

    A TIOModelBundle is used by the UI to show model details and is used to instantiate model instances as a model factory. There is currently a one-to-one correspondence between a TIOModelBundle and a .tfbundle folder in the models directory.

    A model bundle folder must contain at least a model.json file, which contains information about the model. Some information is required, such as the identifier and name field, while other information may be added as needed by your use case.

    See TIOModelBundleJSONSchema.h for a list of required fields and their types.

    See more

    Declaration

    Objective-C

    @interface TIOModelBundle : NSObject

    Swift

    class TIOModelBundle : NSObject
  • The TIOModelBundleManager manages model bundles in a provided directory. Use the returned TIOModelBundle classes to instantiante TIOModel objects.

    Usage: @code [TIOModelBundleManager.sharedManager loadModelBundlesAtPath:modelsPath error:&error]; TIOModelBundle *bundle = [TIOModelBundleManager.sharedManager bundleWithId:@model-id]; id model = [bundle newModel]; @endcode

    See more

    Declaration

    Objective-C

    @interface TIOModelBundleManager : NSObject

    Swift

    class TIOModelBundleManager : NSObject
  • TIOModelBundleValidator is responsible for ensuring that the contents of a TensorIO bundle are valid.

    The bundle validator will commonly be used to validate bundles that are deployed after release of an app rather than those that are packaged with it. It validates each part of the TensorIO model spec, and also allows the client to provide a custom validation block.

    See more

    Declaration

    Objective-C

    @interface TIOModelBundleValidator : NSObject

    Swift

    class TIOModelBundleValidator : NSObject
  • Encapsulates additional options that a model would like to communicate to it consumers.

    See more

    Declaration

    Objective-C

    @interface TIOModelOptions : NSObject

    Swift

    class TIOModelOptions : NSObject
  • A placeholder model declares an interface but does not contain any underlying model implementation. It is used to gather labeled data for a model that has not been trained yet. Performing inference with a placeholder model will return an empty result.

    See more

    Declaration

    Objective-C

    @interface TIOPlaceholderModel : NSObject <TIOModel>

    Swift

    class TIOPlaceholderModel : NSObject, TIOModel
  • The TIOVisionPipeline is responsible for scaling and croping, rotating, and converting the provided pixel buffer to an ARGB or BGRA pixel format, using properties specified by the model.

    See more

    Declaration

    Objective-C

    @interface TIOVisionPipeline : NSObject

    Swift

    class TIOVisionPipeline : NSObject
  • An Objective-C wrapper around TensorFlow lite models that provides a unified interface to the input and output layers of the underlying model.

    See TIOModel for more information about TensorIO models and for a description of the conforming properties and methods here.

    See more

    Declaration

    Objective-C

    @interface TIOTFLiteModel : NSObject <TIOModel>

    Swift

    class TIOTFLiteModel : NSObject, TIOModel