forked from Smorodov/Multitarget-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYoloDetector.h
More file actions
45 lines (34 loc) · 1.08 KB
/
YoloDetector.h
File metadata and controls
45 lines (34 loc) · 1.08 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 <opencv2/dnn.hpp>
#include <opencv2/dnn/shape_utils.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 YoloOCVDetector class
///
class YoloOCVDetector : public BaseDetector
{
public:
YoloOCVDetector(cv::UMat& colorFrame);
~YoloOCVDetector(void);
bool Init(const config_t& config);
void Detect(cv::UMat& colorFrame);
bool CanGrayProcessing() const
{
return false;
}
private:
cv::dnn::Net m_net;
void DetectInCrop(cv::Mat colorFrame, const cv::Rect& crop, regions_t& tmpRegions);
static const int InWidth = 416;
static const int InHeight = 416;
float m_WHRatio = 1.f;
float m_inScaleFactor = 0.003921f;
float m_meanVal = 0.f;
float m_confidenceThreshold = 0.24f;
float m_maxCropRatio = 2.0f;
std::vector<std::string> m_classNames;
};