// Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license #pragma once #include #include "grpc_client.h" class Image { public: Image() = default; static void preprocess(cv::Mat* image, std::vector& triton_data, int input_w, int input_h); }; struct struct_yolo_output { std::vector num_dets, det_classes; std::vector 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& detection_results, std::vector& tespitler, std::vector& object_class_list, float confidence_threshold, int image_width, int image_height ); std::vector NMS(const std::vector& 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 client; std::string triton_url; std::vector shape; tc::InferOptions options; size_t input_byte_size; size_t output_byte_size; std::shared_ptr results_ptr; public: std::vector 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); };