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
e9997606
Commit
e9997606
authored
Mar 16, 2022
by
oscar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交bug更新,处理size==0的时候的问题
parent
160e2ec6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
71 deletions
+77
-71
BaseTracker.h
BaseTracker/BaseTracker.h
+77
-71
No files found.
BaseTracker/BaseTracker.h
View file @
e9997606
...
...
@@ -494,107 +494,113 @@ void BaseTracker<T>::AssociateDetectionsToTrackersEx(const std::vector<std::vect
}
return
;
}
if
(
dets_high
.
size
()
>
0
)
{
std
::
vector
<
std
::
vector
<
float
>>
iou_matrix_high
;
// resize IOU matrix based on number of detection and tracks
iou_matrix_high
.
resize
(
dets_high
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()));
std
::
vector
<
std
::
vector
<
float
>>
iou_matrix
_high
;
// resize IOU
matrix based on number of detection and tracks
iou_matrix
_high
.
resize
(
dets_high
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()));
std
::
vector
<
std
::
vector
<
float
>>
association
_high
;
// resize association
matrix based on number of detection and tracks
association
_high
.
resize
(
dets_high
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()));
std
::
vector
<
std
::
vector
<
float
>>
association_high
;
// resize association matrix based on number of detection and tracks
association_high
.
resize
(
dets_high
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()));
for
(
size_t
i
=
0
;
i
<
dets_high
.
size
();
i
++
)
{
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
for
(
size_t
i
=
0
;
i
<
dets_high
.
size
();
i
++
)
{
iou_matrix_high
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
dets_high
[
i
]);
j
++
;
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
{
iou_matrix_high
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
dets_high
[
i
]);
j
++
;
}
}
}
// Find association
//std::string str = GetMatrixStr(iou_matrix, detections.size(), tracks.size());
//SDK_LOG(SDK_INFO, "iou_matrix = [%s]",str.c_str());
HungarianMatching
(
iou_matrix_high
,
dets_high
.
size
(),
tracks
.
size
(),
association_high
);
// Find association
//std::string str = GetMatrixStr(iou_matrix, detections.size(), tracks.size());
//SDK_LOG(SDK_INFO, "iou_matrix = [%s]",str.c_str());
HungarianMatching
(
iou_matrix_high
,
dets_high
.
size
(),
tracks
.
size
(),
association_high
);
for
(
size_t
i
=
0
;
i
<
dets_high
.
size
();
i
++
)
{
bool
matched_flag
=
false
;
size_t
j
=
0
;
for
(
auto
&
trk
:
tracks
)
for
(
size_t
i
=
0
;
i
<
dets_high
.
size
();
i
++
)
{
if
(
0
==
association_high
[
i
][
j
])
bool
matched_flag
=
false
;
size_t
j
=
0
;
for
(
auto
&
trk
:
tracks
)
{
// Filter out matched with low IOU
//SDK_LOG(SDK_INFO, "match info i = %d,j = %d, iou_matrix = %f, m_iou_threshold = %f",i,j, iou_matrix[i][j], trk.second->m_iou_threshold);
if
(
iou_matrix_high
[
i
][
j
]
>=
trk
.
second
->
m_iou_threshold
)
if
(
0
==
association_high
[
i
][
j
])
{
high_matched
[
trk
.
first
]
=
i
;
trk
.
second
->
m_prob
=
iou_matrix_high
[
i
][
j
];
matched_flag
=
true
;
// Filter out matched with low IOU
//SDK_LOG(SDK_INFO, "match info i = %d,j = %d, iou_matrix = %f, m_iou_threshold = %f",i,j, iou_matrix[i][j], trk.second->m_iou_threshold);
if
(
iou_matrix_high
[
i
][
j
]
>=
trk
.
second
->
m_iou_threshold
)
{
high_matched
[
trk
.
first
]
=
i
;
trk
.
second
->
m_prob
=
iou_matrix_high
[
i
][
j
];
matched_flag
=
true
;
}
// It builds 1 to 1 association, so we can break from here
break
;
}
// It builds 1 to 1 association, so we can break from here
break
;
j
++
;
}
// if detection cannot match with any tracks
if
(
!
matched_flag
)
{
unmatched_det
.
push_back
(
i
);
}
j
++
;
}
// if detection cannot match with any tracks
if
(
!
matched_flag
)
{
unmatched_det
.
push_back
(
i
);
}
}
std
::
vector
<
std
::
vector
<
float
>>
iou_matrix_low
;
// resize IOU matrix based on number of detection and tracks
iou_matrix_low
.
resize
(
dets_low
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()
-
high_matched
.
size
()));
if
(
dets_low
.
size
()
>
0
&&
tracks
.
size
()
-
high_matched
.
size
()
>
0
)
{
std
::
vector
<
std
::
vector
<
float
>>
iou_matrix_low
;
// resize IOU matrix based on number of detection and tracks
iou_matrix_low
.
resize
(
dets_low
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()
-
high_matched
.
size
()));
std
::
vector
<
std
::
vector
<
float
>>
association_low
;
// resize association matrix based on number of detection and tracks
association_low
.
resize
(
dets_low
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()
-
high_matched
.
size
()));
std
::
vector
<
std
::
vector
<
float
>>
association_low
;
// resize association matrix based on number of detection and tracks
association_low
.
resize
(
dets_low
.
size
(),
std
::
vector
<
float
>
(
tracks
.
size
()
-
high_matched
.
size
()));
for
(
size_t
i
=
0
;
i
<
dets_low
.
size
();
i
++
)
{
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
for
(
size_t
i
=
0
;
i
<
dets_low
.
size
();
i
++
)
{
if
(
high_matched
.
find
(
trk
.
first
)
==
high_matched
.
end
())
size_t
j
=
0
;
for
(
const
auto
&
trk
:
tracks
)
{
iou_matrix_low
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
dets_low
[
i
]);
j
++
;
if
(
high_matched
.
find
(
trk
.
first
)
==
high_matched
.
end
())
{
iou_matrix_low
[
i
][
j
]
=
trk
.
second
->
CalculateIou
(
dets_low
[
i
]);
j
++
;
}
}
}
}
// Find association
//std::string str = GetMatrixStr(iou_matrix, detections.size(), tracks.size());
//SDK_LOG(SDK_INFO, "iou_matrix = [%s]",str.c_str());
HungarianMatching
(
iou_matrix_low
,
dets_low
.
size
(),
tracks
.
size
()
-
high_matched
.
size
(),
association_low
);
// Find association
//std::string str = GetMatrixStr(iou_matrix, detections.size(), tracks.size());
//SDK_LOG(SDK_INFO, "iou_matrix = [%s]",str.c_str());
HungarianMatching
(
iou_matrix_low
,
dets_low
.
size
(),
tracks
.
size
()
-
high_matched
.
size
(),
association_low
);
for
(
size_t
i
=
0
;
i
<
dets_low
.
size
();
i
++
)
{
bool
matched_flag
=
false
;
size_t
j
=
0
;
for
(
auto
&
trk
:
tracks
)
for
(
size_t
i
=
0
;
i
<
dets_low
.
size
();
i
++
)
{
if
(
high_matched
.
find
(
trk
.
first
)
==
high_matched
.
end
())
bool
matched_flag
=
false
;
size_t
j
=
0
;
for
(
auto
&
trk
:
tracks
)
{
if
(
0
==
association_low
[
i
][
j
]
)
if
(
high_matched
.
find
(
trk
.
first
)
==
high_matched
.
end
()
)
{
// Filter out matched with low IOU
//SDK_LOG(SDK_INFO, "match info i = %d,j = %d, iou_matrix = %f, m_iou_threshold = %f",i,j, iou_matrix[i][j], trk.second->m_iou_threshold);
if
(
iou_matrix_low
[
i
][
j
]
>=
trk
.
second
->
m_iou_threshold
)
if
(
0
==
association_low
[
i
][
j
])
{
low_matched
[
trk
.
first
]
=
i
;
trk
.
second
->
m_prob
=
iou_matrix_high
[
i
][
j
];
matched_flag
=
true
;
// Filter out matched with low IOU
//SDK_LOG(SDK_INFO, "match info i = %d,j = %d, iou_matrix = %f, m_iou_threshold = %f",i,j, iou_matrix[i][j], trk.second->m_iou_threshold);
if
(
iou_matrix_low
[
i
][
j
]
>=
trk
.
second
->
m_iou_threshold
)
{
low_matched
[
trk
.
first
]
=
i
;
trk
.
second
->
m_prob
=
iou_matrix_low
[
i
][
j
];
matched_flag
=
true
;
}
// It builds 1 to 1 association, so we can break from here
break
;
}
// It builds 1 to 1 association, so we can break from here
break
;
j
++
;
}
j
++
;
}
}
}
}
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