-
Notifications
You must be signed in to change notification settings - Fork 1
/
bee_util.h
83 lines (69 loc) · 2.45 KB
/
bee_util.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include <string>
#include <iostream>
#include "util/types.h"
namespace beebit {
/**
* @brief Read a generalized configuration file into a map of configurations
*
* @param stream The stream to read from
* @param delim The character to separate new config values
* @return ConfigMap
*/
ConfigMap readConfiguration(std::istream &stream, const char delim);
/**
* @brief Converts a single-layered JSON file into a configuration map
*
* @param json
* @return ConfigMap
*/
ConfigMap readJson(const std::string &json);
void writeConfiguration(std::ostream &out, const ConfigMap &newMap);
// Contains default configuration variables
struct TrackerConfiguration {
static TrackerConfiguration *instance() {
static TrackerConfiguration m_instance;
return &m_instance;
}
// Location of the trained model
std::string modelLocation = "dnn/yolov3.weights";
// Location of the config for the neural network
std::string configLocation = "dnn/config.cfg";
// Number of frames to skip during detection
int skipFrames = 5;
// Minimum probability to filter weak detections
float confidence = 0.2f;
// Threshold to cull nearby elements
float nmsThreshold = 0.1f;
// Size of the captured image
int imageWidth = 320;
int imageHeight = 240;
// Quality of the neural net detection used
int neuralNetQuality = 416;
// Whether to attempt to use OpenCL for computation
bool useOpenCL = true;
// Whether to use KCF or the higher quality CSRT
bool useCSRT = false;
// Number of frames we haven't detected a person before we consider them missing
int maxDisappeared = 50;
// Maximum distance the tracker will consider consolidating points. Should generally be width / n where n is the average people
// expected in the frame.
int searchDistance = 50;
// Distance from the line where a crossing is considered
int lineCrossDistance = 20;
// Whether to attempt to track people using a CSRT tracker between frames
bool useTracking = false;
private:
TrackerConfiguration()= default;
~TrackerConfiguration()= default;
TrackerConfiguration(const TrackerConfiguration&)= delete;
TrackerConfiguration& operator=(const TrackerConfiguration&)= delete;
};
void loadTrackerConfigMap(const ConfigMap &config);
void loadTrackerConfigFile();
void writeTrackerConfigFile();
template<typename T>
void log(const T &text) {
std::cout << "BeeBit: " << text << std::endl;
}
}