module TensorflowLite::Image::Common

Direct including types

Defined in:

tflite_image.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client, labels : Array(String) | Nil = nil, scaling_mode : Scale = DEFAULT_SCALE_MODE, input_format : Format | Nil = nil, output_format : Format | Nil = nil) #

[View source]

Instance Method Detail

def client : Client #

the tensorflow lite client


[View source]
def detection_adjustments(image : Canvas, scale_mode : Scale = @scaling_mode) #

this will calculate the adjustments required to the detections for overlaying on the original image (or a scaled image in the same aspect ratio)


[View source]
def detection_adjustments(image_width : Int32, image_height : Int32, scale_mode : Scale = @scaling_mode) #

this will calculate the adjustments required to the detections for overlaying on the original image (or a scaled image in the same aspect ratio)


[View source]
def input_format : Format #

the detected tensor format (can be set manually, but not recommended)


[View source]
def labels : Array(String) #

the labels extracted from the model or provided in the initializer


[View source]
def resolution : Tuple(Int32, Int32) #

returns width x height that the models requires


[View source]
def run(canvas : Canvas, scale_mode : Scale = @scaling_mode, resize_method : StumpyResize::InterpolationMethod = :bilinear) #

scales the image before invoking the tflite model


[View source]
def scaling_mode : Scale #

the scaling mode to use when preparing images for analysis

  • Use fit if you would like the whole image to be processed, however letter boxing means the image is smaller which may effect detections
  • Use cover if you would like to crop the image, only the middle of the image will be used for detection unless the aspect ratio matches the model input

[View source]
def scaling_mode=(scaling_mode : Scale) #

the scaling mode to use when preparing images for analysis

  • Use fit if you would like the whole image to be processed, however letter boxing means the image is smaller which may effect detections
  • Use cover if you would like to crop the image, only the middle of the image will be used for detection unless the aspect ratio matches the model input

[View source]