Commit e01a1828 authored by oscar's avatar oscar

提交nsight代码

parent 49acb8fc
......@@ -17,6 +17,10 @@
#include "kalman_update_batch_online.h"
#endif
#ifdef _USING_NSIGHT_
#include <nvToolsExt.h>
#endif
template<class T>
class BaseTracker
{
......@@ -56,6 +60,9 @@ template<class T>
int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, int _no/*观测数量*/, int _ns/*状态数量*/, std::vector<uint64_t>& detectionsId, std::map<uint64_t, int>& updateId, std::vector<uint64_t>& lostId)
{
/*** Predict internal tracks from previous frame ***/
#ifdef _USING_NSIGHT_
nvtxRangePush("Run Predict");
#endif
for (auto& track : m_tracker)
{
track.second->Predict();
......@@ -63,10 +70,16 @@ int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, int
//track.second->GetPredictData(predict);
//SDK_LOG(SDK_INFO, "predict id = %d, data = [%f,%f,%f,%f,%f,%f,%f]",track.first,predict[0], predict[1], predict[2], predict[3], predict[4], predict[5], predict[6]);
}
#ifdef _USING_NSIGHT_
nvtxRangePop();
#endif
if (detections.empty())
{
return 0;
}
#ifdef _USING_NSIGHT_
nvtxRangePush("Run AssociateDetectionsToTrackers");
#endif
detectionsId.resize(detections.size());
// Hash-map between track ID and associated detection bounding box
std::map<uint64_t, int> matched;
......@@ -75,8 +88,13 @@ int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, int
// return values - matched, unmatched_det
AssociateDetectionsToTrackers(detections,_no,_ns, m_tracker, matched, unmatched_det);
#ifdef _USING_NSIGHT_
nvtxRangePop();
#endif
/*** Update tracks with associated bbox ***/
#ifdef _USING_NSIGHT_
nvtxRangePush("Run Update");
#endif
if (m_isGPU == 0)
{
for (const auto& match : matched)
......@@ -137,7 +155,9 @@ int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, int
//SDK_LOG(SDK_INFO, "after P = [%s]", GetMatrixStr(P.get(), ns * ns, bs).c_str());
}
}
#ifdef _USING_NSIGHT_
nvtxRangePop();
#endif
/*** Create new tracks for unmatched detections ***/
for (const auto& det : unmatched_det)
{
......
......@@ -6,6 +6,9 @@
#include <yaml-cpp/yaml.h>
#include "matrix.h"
#include <eigen3/Eigen/Dense>
#ifdef _USING_NSIGHT_
#include <nvToolsExt.h>
#endif
float to360(float rot_y,float lidar_x_angle)
......@@ -293,6 +296,9 @@ void TrackingRos::ThreadTrackingProcess()
bool ret = m_objsQueue.timeout_pop(objsPtr, 2000);
if (ret)
{
#ifdef _USING_NSIGHT_
nvtxRangePush("ThreadTrackingProcess");
#endif
m_frameNum++;
//SDK_LOG(SDK_INFO, "get objs size = %d,m_frameNum = %d",objsPtr->array.size(), m_frameNum);
std::vector< std::vector<float> > input;
......@@ -315,7 +321,13 @@ void TrackingRos::ThreadTrackingProcess()
std::vector<uint64_t> lostId;
uint64_t begin = GetCurTime();
#ifdef _USING_NSIGHT_
nvtxRangePush("m_tracker.Run");
#endif
m_tracker.Run(input,7,10, detectionsId, updateId, lostId);
#ifdef _USING_NSIGHT_
nvtxRangePop();
#endif
uint64_t rTime = GetCurTime() - begin;
//SDK_LOG(SDK_INFO, "m_tracker.Run time = %llu", rTime);
std::map<uint64_t, std::shared_ptr<Track3D> >& trackers = m_tracker.GetStates();
......@@ -464,6 +476,9 @@ void TrackingRos::ThreadTrackingProcess()
m_pub.publish(sendObjs);
m_pubBoundingBoxes.publish(sendBoxes);
#ifdef _USING_NSIGHT_
nvtxRangePop();
#endif
}
}
......
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