forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYoloDarknetDetector.h
More file actions
45 lines (34 loc) · 1.12 KB
/
YoloDarknetDetector.h
File metadata and controls
45 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include "BaseDetector.h"
#include "darknet/include/yolo_v2_class.hpp"
// You only look once (YOLO)-Detector (https://arxiv.org/abs/1612.08242) to detect objects
// Models can be downloaded here: https://pjreddie.com/darknet/yolo/
// Default network is 416x416
// Class names can be downloaded here: https://github.com/pjreddie/darknet/tree/master/data
///
/// \brief The YoloDarknetDetector class
///
class YoloDarknetDetector : public BaseDetector
{
public:
YoloDarknetDetector(cv::UMat& colorFrame);
~YoloDarknetDetector(void);
bool Init(const config_t& config);
void Detect(cv::UMat& colorFrame);
bool CanGrayProcessing() const
{
return false;
}
private:
std::unique_ptr<Detector> m_detector;
float m_WHRatio = 1.f;
float m_confidenceThreshold = 0.5f;
float m_maxCropRatio = 3.0f;
std::vector<std::string> m_classNames;
std::set<std::string> m_classesWhiteList;
void DetectInCrop(cv::Mat colorFrame, const cv::Rect& crop, regions_t& tmpRegions);
void Detect(cv::Mat colorFrame, regions_t& tmpRegions);
void FillImg(image_t& detImage);
cv::Mat m_tmpImg;
std::vector<float> m_tmpBuf;
};