module

TensorflowLite::Image::Common

Constructors

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

Instance methods

client

the tensorflow lite client

Source
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)

Source
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)

Source
input_format

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

Source
labels

the labels extracted from the model or provided in the initializer

Source
resolution

returns width x height that the models requires

Source
run(canvas : Canvas, scale_mode : Scale = @scaling_mode, resize_method : StumpyResize::InterpolationMethod = :bilinear)

scales the image before invoking the tflite model

Source
scaling_mode

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
Source
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
Source