Files
Loongson_2k0300_SmartCar_Fr…/model/model.hpp

32 lines
877 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "types.hpp"
// NanoDetHeatV4 检测结果
struct DetectBox {
int cls; // 0=红绿灯, 1=锥桶, 2=人行道
float conf; // 置信度 [0,1]
float cx, cy; // 中心像素坐标 (160×120)
float w, h; // 宽高像素
};
// 初始化模型, 加载权重
// weight_path: nanodet.bin 路径
// 返回 true 成功
bool model_init(const char* weight_path);
// 运行推理, 返回检测框数量
// bgr: RGB 图像数据 (H×W×3, uint8, [0,255])
// w, h: 图像尺寸 (必须 160×120)
// boxes: 输出检测框数组
// max: 最大检测框数
// th: 置信度阈值 (推荐 0.6~0.8)
int model_detect(const uint8* bgr, int w, int h,
DetectBox* boxes, int max,
float th);
// 释放模型内存
void model_deinit();
// 模型就绪标志
bool model_ready();