完成框架目录和模块重构;新增核心、单例、工具、加密及框架 SDK;统一任务、相机和 RPC 接口,并增加离线检测、相机标定、备份恢复、版本管理、崩溃守护和心跳监控功能。
102 lines
2.5 KiB
C++
102 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace eui_frameworkSdk
|
|
{
|
|
// 分类模型的单张推理结果。
|
|
struct ClassificationResult
|
|
{
|
|
int classes = -1; // 类别索引。
|
|
double prob = 0.0; // 类别概率。
|
|
};
|
|
|
|
// 检测结果中的关键点坐标。
|
|
struct DetectionPoint
|
|
{
|
|
float x = 0.0F;
|
|
float y = 0.0F;
|
|
};
|
|
|
|
// 目标检测模型的单个目标结果。
|
|
struct DetectionResult
|
|
{
|
|
float x = 0.0F;
|
|
float y = 0.0F;
|
|
float w = 0.0F;
|
|
float h = 0.0F;
|
|
DetectionPoint points[4]{}; // 四边形目标的四个顶点。
|
|
float score = 0.0F; // 目标置信度。
|
|
int classes = -1; // 类别索引。
|
|
};
|
|
|
|
// 分割模型接口。
|
|
class ISegmentationModel
|
|
{
|
|
public:
|
|
// 释放分割模型。
|
|
virtual ~ISegmentationModel() = default;
|
|
|
|
// 执行单张分割推理。
|
|
virtual cv::Mat Evaluate(const cv::Mat& input) = 0;
|
|
|
|
// 批量执行分割推理。
|
|
virtual std::vector<cv::Mat> bunchEvaluate(const std::vector<cv::Mat>& input) = 0;
|
|
};
|
|
|
|
// 分类模型接口。
|
|
class IClassificationModel
|
|
{
|
|
public:
|
|
// 释放分类模型。
|
|
virtual ~IClassificationModel() = default;
|
|
|
|
// 执行单张分类推理。
|
|
virtual ClassificationResult Evaluate(const cv::Mat& input) = 0;
|
|
|
|
// 批量执行分类推理。
|
|
virtual std::vector<ClassificationResult> bunchEvaluate(const std::vector<cv::Mat>& input) = 0;
|
|
};
|
|
|
|
// 目标检测模型接口。
|
|
class IDetectionModel
|
|
{
|
|
public:
|
|
// 释放检测模型。
|
|
virtual ~IDetectionModel() = default;
|
|
|
|
// 执行单张目标检测推理。
|
|
virtual std::vector<DetectionResult> Evaluate(const cv::Mat& input) = 0;
|
|
|
|
// 批量执行目标检测推理。
|
|
virtual std::vector<std::vector<DetectionResult>> bunchEvaluate(
|
|
const std::vector<cv::Mat>& input) = 0;
|
|
};
|
|
|
|
// AI 模型加载管理接口。
|
|
class IHandleAiManager
|
|
{
|
|
public:
|
|
// 释放模型管理器。
|
|
virtual ~IHandleAiManager() = default;
|
|
|
|
// 加载分割模型。
|
|
virtual std::shared_ptr<ISegmentationModel> loadSegModel(
|
|
const std::string& path, int batchSize, int gpuId, const QString& description) = 0;
|
|
|
|
// 加载分类模型。
|
|
virtual std::shared_ptr<IClassificationModel> loadClsModel(
|
|
const std::string& path, int batchSize, int gpuId, const QString& description) = 0;
|
|
|
|
// 加载目标检测模型。
|
|
virtual std::shared_ptr<IDetectionModel> loadDetModel(
|
|
const std::string& path, int batchSize, int gpuId, const QString& description) = 0;
|
|
};
|
|
}
|