Lens AI Profiler Cpp
yolo_parser.h
1 #ifndef YOLO_PARSER_H
2 #define YOLO_PARSER_H
3 
4 #include "modeloutput_parser.h"
5 #include <vector>
6 #include <tuple>
7 
8 class YOLOParser : public ModelOutputParser {
9 public:
10  // Override the raw output parsing method for YOLO (just an example)
11  std::vector<std::pair<float, int>> parseRawOutput(const void* raw_output) const override {
12  // Assuming the raw output is of type std::vector<std::tuple<float, int, float, float>>
13  auto detections = *reinterpret_cast<const std::vector<std::tuple<float, int, float, float>>*>(raw_output);
14  std::vector<std::pair<float, int>> results;
15 
16  for (const auto& detection : detections) {
17  float score = std::get<0>(detection);
18  int class_id = std::get<1>(detection);
19  results.push_back({score, class_id});
20  }
21 
22  return results;
23  }
24 };
25 
26 #endif // YOLO_PARSER_H
Definition: modeloutput_parser.h:9
Definition: yolo_parser.h:8