chromium/third_party/mediapipe/src/mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.proto

// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// The option proto for the TfLiteTensorsToDetectionsCalculator.

syntax = "proto2";

package mediapipe;

import "mediapipe/framework/calculator.proto";

message TfLiteTensorsToDetectionsCalculatorOptions {
  extend .mediapipe.CalculatorOptions {
    optional TfLiteTensorsToDetectionsCalculatorOptions ext = 246514968;
  }

  // The number of output classes predicted by the detection model.
  optional int32 num_classes = 1;  // required
  // The number of output boxes predicted by the detection model.
  optional int32 num_boxes = 2;  // required
  // The number of output values per boxes predicted by the detection model. The
  // values contain bounding boxes, keypoints, etc.
  optional int32 num_coords = 3;  // required

  // The offset of keypoint coordinates in the location tensor.
  optional int32 keypoint_coord_offset = 9;
  // The number of predicted keypoints.
  optional int32 num_keypoints = 10 [default = 0];
  // The dimension of each keypoint, e.g. number of values predicted for each
  // keypoint.
  optional int32 num_values_per_keypoint = 11 [default = 2];
  // The offset of box coordinates in the location tensor.
  optional int32 box_coord_offset = 12 [default = 0];

  // Parameters for decoding SSD detection model.
  optional float x_scale = 4 [default = 0.0];
  optional float y_scale = 5 [default = 0.0];
  optional float w_scale = 6 [default = 0.0];
  optional float h_scale = 7 [default = 0.0];

  optional bool apply_exponential_on_box_size = 13 [default = false];

  // Whether to reverse the order of predicted x, y from output.
  // If false, the order is [y_center, x_center, h, w], if true the order is
  // [x_center, y_center, w, h].
  optional bool reverse_output_order = 14 [default = false];
  // The ids of classes that should be ignored during decoding the score for
  // each predicted box.
  repeated int32 ignore_classes = 8;

  optional bool sigmoid_score = 15 [default = false];
  optional float score_clipping_thresh = 16;

  // Whether the detection coordinates from the input tensors should be flipped
  // vertically (along the y-direction). This is useful, for example, when the
  // input tensors represent detections defined with a coordinate system where
  // the origin is at the top-left corner, whereas the desired detection
  // representation has a bottom-left origin (e.g., in OpenGL).
  optional bool flip_vertically = 18 [default = false];

  // Score threshold for preserving decoded detections.
  optional float min_score_thresh = 19;
}