Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
J
jfx_kalman_filter_src
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
oscar
jfx_kalman_filter_src
Commits
9510220c
Commit
9510220c
authored
Dec 15, 2021
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
c81a9428
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
12 deletions
+60
-12
BaseTrack.cpp
BaseTracker/BaseTrack.cpp
+9
-0
BaseTrack.h
BaseTracker/BaseTrack.h
+2
-0
BaseTracker.h
BaseTracker/BaseTracker.h
+49
-12
No files found.
BaseTracker/BaseTrack.cpp
View file @
9510220c
...
...
@@ -72,3 +72,12 @@ bool BaseTrack::IsLost()
{
return
coast_cycles_
>
m_kMaxCoastCycles
;
}
int
BaseTrack
::
GetMeasureData
(
std
::
vector
<
float
>&
data
)
{
if
(
kf_
==
nullptr
)
return
-
1
;
data
.
clear
();
for
(
int
i
=
0
;
i
<
m_num_obs
;
i
++
)
data
.
push_back
(
kf_
->
x_
[
i
]);
return
0
;
}
BaseTracker/BaseTrack.h
View file @
9510220c
...
...
@@ -23,6 +23,8 @@ public:
virtual
float
GetProb
()
const
;
virtual
bool
IsLost
();
virtual
int
GetMeasureData
(
std
::
vector
<
float
>&
data
);
virtual
double
CalculateIou
(
const
std
::
vector
<
float
>&
data
)
=
0
;
int
coast_cycles_
=
0
,
hit_streak_
=
0
;
...
...
BaseTracker/BaseTracker.h
View file @
9510220c
...
...
@@ -10,6 +10,9 @@
#include <vector>
#include "Iou.h"
#include "LogBase.h"
#include <memory>
//#include "bev_overlap_online.h"
//#include "kalman_update_batch_online.h"
template
<
class
T
>
class
BaseTracker
...
...
@@ -62,12 +65,19 @@ int BaseTracker<T>::Run(const std::vector<std::vector<float> >& detections, std:
AssociateDetectionsToTrackers
(
detections
,
m_tracker
,
matched
,
unmatched_det
);
/*** Update tracks with associated bbox ***/
for
(
const
auto
&
match
:
matched
)
if
(
m_isGPU
==
0
)
{
for
(
const
auto
&
match
:
matched
)
{
const
auto
&
id
=
match
.
first
;
m_tracker
[
id
]
->
Update
(
detections
[
match
.
second
]);
detectionsId
[
match
.
second
]
=
id
;
updateId
[
id
]
=
match
.
second
;
}
}
else
{
const
auto
&
id
=
match
.
first
;
m_tracker
[
id
]
->
Update
(
detections
[
match
.
second
]);
detectionsId
[
match
.
second
]
=
id
;
updateId
[
id
]
=
match
.
second
;
std
::
shared_ptr
<
float
*>
Z
=
std
::
make_shared
<
float
*>
(
new
(
float
*
)[
matched
.
size
()]);
}
/*** Create new tracks for unmatched detections ***/
...
...
@@ -125,17 +135,44 @@ void BaseTracker<T>::AssociateDetectionsToTrackers(const std::vector<std::vector
// resize association matrix based on number of detection and tracks
association
.
resize
(
detections
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()));
// row - detection, column - tracks
for
(
size_t
i
=
0
;
i
<
detections
.
size
();
i
++
)
if
(
m_isGPU
==
0
)
{
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
// row - detection, column - tracks
for
(
size_t
i
=
0
;
i
<
detections
.
size
();
i
++
)
{
iou_matrix
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
detections
[
i
]);
j
++
;
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
{
iou_matrix
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
detections
[
i
]);
j
++
;
}
}
}
else
{
std
::
vector
<
std
::
vector
<
float
>
>
tracker_states
;
for
(
auto
&
iter
:
tracks
)
{
std
::
vector
<
float
>
measure
;
if
(
iter
.
second
->
GetMeasureData
(
measure
)
==
0
)
{
tracker_states
.
emplace_back
(
measure
);
}
}
int
detect_size
=
detections
.
size
()
*
(
detections
.
size
()
>
0
?
detections
[
0
].
size
()
:
0
);
int
tracker_size
=
tracker_states
.
size
()
*
(
tracker_states
.
size
()
>
0
?
tracker_states
[
0
].
size
()
:
0
);
int
iou_size
=
detections
.
size
()
*
tracker_states
.
size
();
std
::
shared_ptr
<
float
>
detect_ptr
=
std
::
make_shared
<
float
>
(
new
float
[
detect_size
]);
std
::
shared_ptr
<
float
>
tracker_ptr
=
std
::
make_shared
<
float
>
(
new
float
[
tracker_size
]);
std
::
shared_ptr
<
float
>
iou_ptr
=
std
::
make_shared
<
float
>
(
new
float
[
iou_size
]);
//bev_overlap(detections.size(), detect_ptr.get(), tracker_states.size(), tracker_ptr.get(), iou_ptr.get());
for
(
int
i
=
0
;
i
<
detections
.
size
();
i
++
)
for
(
int
j
=
0
;
j
<
tracker_states
.
size
();
j
++
)
{
iou_matrix
[
i
][
j
]
=
iou_ptr
[
i
*
tracker_states
.
size
()
+
j
];
}
}
// Find association
HungarianMatching
(
iou_matrix
,
detections
.
size
(),
tracks
.
size
(),
association
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment