1 /* 2 * Copyright (C) 2022 Rockchip Electronics Co., Ltd. 3 * Authors: 4 * raul.rao <raul.rao@rock-chips.com> 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 #ifndef RK_YOLOV5_DEMO_POST_PROCESS_H 19 #define RK_YOLOV5_DEMO_POST_PROCESS_H 20 21 #include <stdint.h> 22 #include <android/log.h> 23 24 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "rkyolo4j", ##__VA_ARGS__); 25 #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "rkyolo4j", ##__VA_ARGS__); 26 27 #define OBJ_NAME_MAX_SIZE 16 28 #define OBJ_NUMB_MAX_SIZE 64 29 #define OBJ_CLASS_NUM 80 30 #define NMS_THRESH 0.6 31 #define BOX_THRESH 0.5 32 #define PROP_BOX_SIZE (5+OBJ_CLASS_NUM) 33 #define BOX_LEN 4 34 35 typedef struct _BOX_RECT 36 { 37 int left; 38 int right; 39 int top; 40 int bottom; 41 } BOX_RECT; 42 43 typedef struct __detect_result_t 44 { 45 char name[OBJ_NAME_MAX_SIZE]; 46 int class_id; 47 BOX_RECT box; 48 float prop; 49 } detect_result_t; 50 51 typedef struct _detect_result_group_t 52 { 53 int id; 54 int count; 55 detect_result_t results[OBJ_NUMB_MAX_SIZE]; 56 } detect_result_group_t; 57 58 int post_process(int8_t *input0, int8_t *input1, int8_t *input2, int model_in_h, int model_in_w, 59 float conf_threshold, float nms_threshold, float scale_w, float scale_h, 60 std::vector<int32_t> &qnt_zps, std::vector<float> &qnt_scales, 61 detect_result_group_t *group); 62 63 void deinitPostProcess(); 64 65 #endif //RK_YOLOV5_DEMO_POST_PROCESS_H 66