Commit 7910d6bb authored by oscar's avatar oscar

提交添加配置项

parent 33cebb92
......@@ -44,6 +44,11 @@ public:
float* GetPredictPtr();
float* GetRPtr();
void SetIouThreshold(float threshold) { m_iou_threshold = threshold; }
void SetMaxCoastCycles(int cycles) { m_kMaxCoastCycles = cycles; }
void SetValidUpdateCount(int count) { m_updateValidCount = count; }
virtual void SetValues(std::vector<float>& data) {}
int coast_cycles_ = 0, hit_streak_ = 0;
int m_update_count = 0;//数据更新的次数
......
......@@ -23,10 +23,11 @@ class BaseTracker
public:
BaseTracker() {}
void SetGPU(int gpu)
{
m_isGPU = gpu;
}
void SetGPU(int gpu) { m_isGPU = gpu; }
void SetIouThreshold(float threshold) { m_iou_threshold = threshold; }
void SetMaxCoastCycles(int cycles) { m_kMaxCoastCycles = cycles; }
void SetValidUpdateCount(int count){ m_updateValidCount = count; }
void SetValues(std::vector<float>& values) { m_values = values; }
int Run(const std::vector<std::vector<float> >& detections,std::vector<uint64_t>& detectionsId,std::map<uint64_t,int>& updateId,std::vector<uint64_t>& lostId);
......@@ -43,6 +44,11 @@ public:
int m_isGPU = 0;//默认不使用
float m_iou_threshold = 0.01;//iou计算之后匹配的最小值
int m_kMaxCoastCycles = 2;//predict之后,计算几次认为丢失。
int m_updateValidCount = 3;//更新多少次认为是一个有效数据。
std::vector<float> m_values;//调整矩阵参数的配置
};
......@@ -133,6 +139,10 @@ int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, std:
{
std::shared_ptr<T> trackPtr = std::make_shared<T>();
trackPtr->Init(detections[det]);
trackPtr->SetIouThreshold(m_iou_threshold);
trackPtr->SetMaxCoastCycles(m_kMaxCoastCycles);
trackPtr->SetValidUpdateCount(m_updateValidCount);
trackPtr->SetValues(m_values);
// Create new track and generate new ID
uint64_t newId = ++m_countId;
m_tracker[newId] = trackPtr;
......
......@@ -104,8 +104,6 @@ Track3D::Track3D():BaseTrack(10, 7)
kf_ = kf;
m_iou_threshold = 0.01;
}
void Track3D::Init(const std::vector<float>& data)
{
......@@ -337,4 +335,23 @@ void Track3D::UpdateDataCheck(const std::vector<float>& data, std::vector<float>
out = data;
out[3] = rot_y;
}
\ No newline at end of file
}
void Track3D::SetValues(std::vector<float>& data)
{
if (data.size() < 1)
return;
float a = data[0];
if (kf_ == nullptr)
return;
kf->R_ <<
1, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0,
0, 0, 0, a, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 1;
}
......@@ -43,6 +43,8 @@ public:
virtual void UpdateDataCheck(const std::vector<float>& data, std::vector<float>& out);//对于输入数据进行修正
virtual void SetValues(std::vector<float>& data);
trackOjbPtr m_obj = nullptr;
std::vector<point2d> m_points;//保存最近的5个移动的点位
......
......@@ -173,9 +173,22 @@ void TrackingRos::Init(ros::NodeHandle& nh)
nh.param<float>("lidar_x_angle", m_lidar_x_angle, 354.102);
SDK_LOG(SDK_INFO, "m_lidar_x_angle = %f", m_lidar_x_angle);
YAML::Node config = YAML::LoadFile(file.c_str());
float threshold;
nh.param<float>("iou_threshold", threshold, 0.01);
m_tracker.SetIouThreshold(threshold);
int max_coastcycles;
nh.param<int32_t>("max_coastcycles", max_coastcycles, 2);
m_tracker.SetMaxCoastCycles(max_coastcycles);
int update_valid_count;
nh.param<int32_t>("update_valid_count", update_valid_count, 2);
m_tracker.SetValidUpdateCount(update_valid_count);
float matrix_angle_r_value;
nh.param<float>("matrix_angle_r_value", matrix_angle_r_value, 0.1);
std::vector<float> values;
values.push_back(matrix_angle_r_value);
m_tracker.SetValues(values);
YAML::Node config = YAML::LoadFile(file.c_str())
auto cfg = config["TRACKING"];
m_trans = cfg["TRANS"].as<std::vector<std::vector<double>>>();
......
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