blob: 68ac93684fc812835ad38ec6ffd1cb14a687d0a5 [file] [log] [blame]
/*
* Copyright 2022 Google LLC
*
* 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.
*/
#ifndef SSD_POSTPROCESS_BOX_H_
#define SSD_POSTPROCESS_BOX_H_
#include <stdint.h>
#include "ssd_postprocess/common.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#ifndef SSD_BOX_DIMS
#define SSD_BOX_DIMS 4
#endif
#ifndef SSD_MAX_LAYERS
#define SSD_MAX_LAYERS 8
#endif
#ifndef SSD_MAX_ANCHORS_PER_CELL
#define SSD_MAX_ANCHORS_PER_CELL 6
#endif
typedef struct {
int num_layers;
int num_boxes;
int input_height;
int input_width;
int global_scales[SSD_BOX_DIMS];
int box_zero_points[SSD_BOX_DIMS];
float box_scales[SSD_BOX_DIMS];
int score_zero_points[SSD_BOX_DIMS];
float score_scales[SSD_BOX_DIMS];
float score_threshold;
int anchors_per_cell;
float anchor_base_size[SSD_MAX_LAYERS * SSD_MAX_ANCHORS_PER_CELL];
int anchor_stride[SSD_MAX_LAYERS];
} SsdParams;
// Set SSD parameters
void set_params(SsdParams* params);
// Decode and extract detected boxes from model outputs
void get_detected_boxes(uint8_t** model_out, Boxes* boxes);
#ifdef __cplusplusS
} // extern "C"
#endif // __cplusplus
#endif // SSD_POSTPROCESS_BOX_H_