class

TensorflowLite::Image::FaceDetection

Inherits TensorflowLite::Image::Common < Reference < Object

Instance methods

adjust(detections : Array(Output), target_width : Int32, target_height : Int32, offset_left : Int32, offset_top : Int32) : Array(Output)

adjust the detections so they can be applied directly to the source image (or a scaled version in the same aspect ratio)

you can run detection_adjustments just once and then apply them to detections for each invokation using this function

Source
adjust(detections : Array(Output), image : Canvas, offset_left : Int32, offset_top : Int32) : Array(Output)

adjust the detections so they can be applied directly to the source image (or a scaled version in the same aspect ratio)

you can run detection_adjustments just once and then apply them to detections for each invokation using this function

Source
anchors
Source
confidence_threshold
Source
confidence_threshold=(confidence_threshold : Float32)
Source
generate_anchors(strides : Array(Int32), anchor_offset_x : Float64 = 0.5, anchor_offset_y : Float64 = 0.5, aspect_ratios : Array(Float64) = [1.0], scales_per_octave : Int32 = 2, min_scale : Float64 = 0.1, max_scale : Float64 = 0.9) : Array(Anchor)

This is a trimmed down version of the C++ code; all irrelevant parts have been removed. (reference: mediapipe/calculators/tflite/ssd_anchors_calculator.cc) also: https://github.com/patlevin/face-detection-tflite/blob/main/fdlite/face_detection.py#L58

Source
intersection_over_union(det1 : Output, det2 : Output) : Float32
Source
markup(image : Canvas, detections : Array(Output), minimum_score : Float32 = 0.3_f32, font : PCFParser::Font | Nil = nil) : Canvas

add the detection details to an image

if marking up the original image, you'll need to take into account how it was scaled

Source
nms_similarity_threshold
Source
nms_similarity_threshold=(nms_similarity_threshold : Float32)
Source
non_maximum_suppression(detections : Array(Output), iou_threshold : Float32) : Array(Output)
Source
process(image : Canvas) : Tuple(Canvas, Array(Output))

attempts to classify the object, assumes the image has already been prepared

Source
sigmoid(data : Slice(Float32)) : Slice(Float32)

Mapping to (0,1) score limit is 100 in mediapipe and leads to overflows with IEEE 754 floats this lower limit is safe for use with the sigmoid functions and float32

Source

Nested types