Files
HSAP/algorithms/dms_yolo/code.embedded.bak/examples/YOLO11-Triton-CPP/inference.hpp
Chengfang Lu e72bc061c5 feat: HSAP platform v2 — modular navigation, quality review, audit log, world model simulation
Major changes:
- New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind
- 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理
- Data catalog with charts (DMS/ADAS/Lane 3-tab view)
- Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance
- Audit enhancements: batch operations, rejection categories, Feishu notifications
- Operation audit log (操作日志)
- World model simulation studio (仿真工坊)
- Dataset version management with snapshots and diff
- ADAS 7-class dataset integration (138K images organized + compressed)
- User management with Feishu integration and pagination
- CRUD/search/filter on all pages, card layout redesign
- PIL-optimized image overlay rendering
- Auto-snapshot on build, in_review workflow stage
- Removed embedded algorithm code (now in workspace)
2026-06-03 11:40:21 +08:00

82 lines
1.8 KiB
C++

// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
#pragma once
#include <opencv2/opencv.hpp>
#include "grpc_client.h"
class Image
{
public:
Image() = default;
static void preprocess(cv::Mat* image, std::vector<uint16_t>& triton_data, int input_w, int input_h);
};
struct struct_yolo_output
{
std::vector<int> num_dets, det_classes;
std::vector<float> det_boxes, det_scores;
};
struct BoundingBox {
float x, y, w, h;
float score;
int class_id;
};
struct detection_struct
{
cv::Rect bbox;
int class_id;
std::string name;
double confidence_score;
};
// C-compatible declarations
#ifdef __cplusplus
extern "C" {
#endif
int getDetectionsFromTritonRawData(
std::vector<float>& detection_results,
std::vector<struct detection_struct>& tespitler,
std::vector<std::string>& object_class_list,
float confidence_threshold,
int image_width,
int image_height
);
std::vector<BoundingBox> NMS(const std::vector<BoundingBox>& boxes, float iou_threshold);
float IoU(const BoundingBox& box1, const BoundingBox& box2);
#ifdef __cplusplus
}
#endif
namespace tc = triton::client;
class TritonCommunication
{
private:
std::unique_ptr<tc::InferenceServerGrpcClient> client;
std::string triton_url;
std::vector<int64_t> shape;
tc::InferOptions options;
size_t input_byte_size;
size_t output_byte_size;
std::shared_ptr<tc::InferResult> results_ptr;
public:
std::vector<float> output_raw_data;
TritonCommunication(std::string triton_address,
std::string model_name,
std::string model_version,
int image_channel,
int image_width,
int image_height,
int class_count);
void infer(uint16_t* triton_data);
};