BB.Estimator.ObjectDetection.FinalDetections (bb_estimator_object_detection v0.1.0)

Copy Markdown View Source

A codec for detection models that finish with their own decode and non-maximum suppression, whatever brand they are.

Two output layouts are recognised:

  • TFLite's TFLite_Detection_PostProcess: four outputs, in this order - boxes {1, N, 4} as normalised {ymin, xmin, ymax, xmax}, classes {1, N}, scores {1, N} and a count {1}. Classes and scores have the same shape and type, so they are told apart only by their order.
  • Rows: one output of {N, 6} or {1, N, 6}, each row {x1, y1, x2, y2, score, class} in model-input pixels.

Either may be quantised; values are dequantised as they are read.

The input conventions differ from model to model and default to RGB, stretched to fill, with no normalisation. TensorFlow's SSD MobileNet was trained on pixels scaled to -1..1, so it takes mean: 127.5, std: 127.5, quantised or not: the quantised version's u8 input has a scale of 1/128 and a zero point of 128, which maps those values back onto raw pixels.

Options

  • :colour - The channel order the model takes. Valid values are :rgb, :bgr The default value is :rgb.

  • :resize - :stretch to fill the model's input, ignoring the aspect ratio, or :letterbox to fit it, keeping the aspect ratio and padding the rest. Valid values are :stretch, :letterbox The default value is :stretch.

  • :letterbox_align - Where a letterboxed image sits in the model's input. Valid values are :top_left, :centre The default value is :top_left.

  • :pad - The grey level letterbox padding is filled with. Valid values are between 0 and 255 The default value is 0.

  • :mean - Subtracted from each channel before dividing by :std: one number, or {c1, c2, c3} in the model's channel order. The default value is 0.0.

  • :std - Each channel is divided by this after subtracting :mean: one number, or {c1, c2, c3} in the model's channel order. The default value is 1.0.