projects
/
trackerpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add test for Predictor
[trackerpp.git]
/
src
/
MultiTracker.cpp
diff --git
a/src/MultiTracker.cpp
b/src/MultiTracker.cpp
index
f3a7cad
..
a7f5e59
100644
(file)
--- a/
src/MultiTracker.cpp
+++ b/
src/MultiTracker.cpp
@@
-12,18
+12,16
@@
using namespace std;
static const std::string TAG = "MultiTracker";
static const cv::Size PREFERRED_SIZE = Size(64, 128);
static const std::string TAG = "MultiTracker";
static const cv::Size PREFERRED_SIZE = Size(64, 128);
-#define MaxCost 100000
+static const double MaxCost = 100000;
+static const int MaxPath = 5;
MultiTracker::MultiTracker(EngineWPtr e)
: engine(e)
{
LOG_DEBUG(TAG, "init - loading model.pkl");
MultiTracker::MultiTracker(EngineWPtr e)
: engine(e)
{
LOG_DEBUG(TAG, "init - loading model.pkl");
- predictor = PredictorWrapper::create("./python/model.pkl");
+ predictor = PredictorWrapper::create("./python
", "./python
/model.pkl");
predictor->dump();
this->descriptor = {Size(64, 128), Size(16, 16), Size(8, 8), Size(8, 8), 9};
predictor->dump();
this->descriptor = {Size(64, 128), Size(16, 16), Size(8, 8), Size(8, 8), 9};
-
- std::vector<double> ff (40, 1);
- double prob = predictor->predict(4, ff);
}
MultiTracker::~MultiTracker()
}
MultiTracker::~MultiTracker()
@@
-66,7
+64,6
@@
static std::vector<double> similarity(const PatchPtr p1, const PatchPtr p2)
return feature;
}
return feature;
}
-
double MultiTracker::distance(TrackerPtr tracker, const cv::Mat& image, const Detection& d)
{
PatchPtr patch = createPatch(image, d);
double MultiTracker::distance(TrackerPtr tracker, const cv::Mat& image, const Detection& d)
{
PatchPtr patch = createPatch(image, d);
@@
-81,27
+78,21
@@
double MultiTracker::distance(TrackerPtr tracker, const cv::Mat& image, const De
return prob;
}
return prob;
}
-static long cc = 0;
+static float calc_iou_ratio(const Detection& d1, const Detection& d2)
+{
+ return calc_iou_ratio(getRectInDetection(d1), getRectInDetection(d2));
+}
void MultiTracker::update(unsigned int total, const Detection* detections, const Mat& image)
{
void MultiTracker::update(unsigned int total, const Detection* detections, const Mat& image)
{
- //////
- if ((cc % 50) == 0){
- if (EnginePtr e = engine.lock()){
- e->onStatusChanged();
- }
- }
- cc++;
-
- //////
int row = trackers.size();
int col = total;
Eigen::MatrixXi cost_matrix = Eigen::MatrixXi::Zero(row, col);
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++){
int row = trackers.size();
int col = total;
Eigen::MatrixXi cost_matrix = Eigen::MatrixXi::Zero(row, col);
for (int i = 0; i < row; i++){
for (int j = 0; j < col; j++){
-
//if (calc_iou_ratio(trackers[i]
, detections[j]) < -0.1)
-
//
cost_matrix(i, j) = MaxCost;
-
//
else
+
if (calc_iou_ratio(trackers[i]->detection
, detections[j]) < -0.1)
+ cost_matrix(i, j) = MaxCost;
+ else
cost_matrix(i, j) = distance(trackers[i], image, detections[j]);
}
}
cost_matrix(i, j) = distance(trackers[i], image, detections[j]);
}
}