Commit 6a95a47a authored by oscar's avatar oscar

提交更新

parent 421e66f6
......@@ -45,9 +45,27 @@ Track2D::Track2D():BaseTrack(8, 4)
kf_ = kf;
}
void Track2D::Init(const std::vector<float>& data)
{
if (data.size() != 5)
return;
std::vector<float> tmp(data.begin() + 1, data.end());
BaseTrack::Init(tmp);
}
void Track2D::Update(const std::vector<float>& data)
{
std::vector<float> out(data.begin() + 1, data.end());
BaseTrack::Update(out);
}
double Track2D::CalculateIou(const std::vector<float>& data)
{
if (data.size() != 5)
return 0;
int input_type = data[0];
int obj_type = m_obj.type;
if (input_type != obj_type)
return 0.0f;
std::vector<float> states;
GetStateData(states);
......@@ -65,11 +83,11 @@ double Track2D::CalculateIou(const std::vector<float>& data)
//float union_area = det_area + trk_area - intersection_area;
//auto iou = intersection_area / union_area;
auto w = std::max(std::min((states[0] + states[2]), (data[0] + data[2])) - std::max(states[0], data[0]), 0.0f);
auto h = std::max(std::min((states[1] + states[3]), (data[1] + data[3])) - std::max(states[1], data[1]), 0.0f);
auto w = std::max(std::min((states[0] + states[2]), (data[1] + data[3])) - std::max(states[0], data[1]), 0.0f);
auto h = std::max(std::min((states[1] + states[3]), (data[2] + data[4])) - std::max(states[1], data[2]), 0.0f);
auto intersection_area = w * h;
float union_area = states[2] * states[3] + data[2] * data[3] - intersection_area;
float union_area = states[2] * states[3] + data[3] * data[4] - intersection_area;
auto iou = intersection_area / union_area;
return iou;
}
......@@ -19,6 +19,8 @@ public:
Track2D();
~Track2D() {}
virtual void Init(const std::vector<float>& data);
virtual void Update(const std::vector<float>& data);
//trackOjbPtr m_obj = nullptr;
virtual int GetIouDataOrder(std::vector<int>& order) { return 0; };
......
......@@ -238,6 +238,7 @@ public:
std::vector<float> data;
auto width = static_cast<float>(trackItem.detections[i].width);
auto height = static_cast<float>(trackItem.detections[i].height);
data.push_back(item.type);
data.push_back(trackItem.detections[i].x + trackItem.detections[i].width/2);
data.push_back(trackItem.detections[i].y + trackItem.detections[i].height/2);
data.push_back(width);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment