YoloFeatureExtractor.h 811 B

123456789101112131415161718192021222324252627
  1. 
  2. #pragma once
  3. #include <opencv2/opencv.hpp>
  4. #include <opencv2/dnn.hpp>
  5. #include <vector>
  6. #include <string>
  7. class YoloFeatureExtractor {
  8. private:
  9. cv::dnn::Net net;
  10. int inputWidth;
  11. int inputHeight;
  12. std::vector<std::string> classNames;
  13. public:
  14. YoloFeatureExtractor(const std::string& modelPath, const std::string& classesPath);
  15. YoloFeatureExtractor(const std::string& modelPath, const std::string& configPath, const std::string& classesPath);
  16. ~YoloFeatureExtractor() = default;
  17. void loadClassNames(const std::string& file);
  18. std::vector<float> extractFeatures(const std::string& imagePath);
  19. std::vector<float> extractBackboneFeatures(const std::string& imagePath);
  20. std::vector<std::vector<float>> extractROIFeatures(const std::string& imagePath);
  21. void initOpenCL();
  22. };