fix DetectionUniqueIdCalculator consume prob
This commit is contained in:
parent
f15da632de
commit
7ee671aba1
|
@ -33,8 +33,8 @@ inline int GetNextDetectionId() { return ++detection_id; }
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// Assign a unique id to detections.
|
// Assign a unique id to detections.
|
||||||
// Note that the calculator will consume the input vector of Detection or
|
// Note that the calculator will consume or copy the input vector of Detection or
|
||||||
// DetectionList. So the input stream can not be connected to other calculators.
|
// DetectionList.
|
||||||
//
|
//
|
||||||
// Example config:
|
// Example config:
|
||||||
// node {
|
// node {
|
||||||
|
@ -76,7 +76,7 @@ REGISTER_CALCULATOR(DetectionUniqueIdCalculator);
|
||||||
if (cc->Inputs().HasTag(kDetectionListTag) &&
|
if (cc->Inputs().HasTag(kDetectionListTag) &&
|
||||||
!cc->Inputs().Tag(kDetectionListTag).IsEmpty()) {
|
!cc->Inputs().Tag(kDetectionListTag).IsEmpty()) {
|
||||||
auto result =
|
auto result =
|
||||||
cc->Inputs().Tag(kDetectionListTag).Value().Consume<DetectionList>();
|
cc->Inputs().Tag(kDetectionListTag).Value().ConsumeOrCopy<DetectionList>();
|
||||||
if (result.ok()) {
|
if (result.ok()) {
|
||||||
auto detection_list = std::move(result).ValueOrDie();
|
auto detection_list = std::move(result).ValueOrDie();
|
||||||
for (Detection& detection : *detection_list->mutable_detection()) {
|
for (Detection& detection : *detection_list->mutable_detection()) {
|
||||||
|
@ -93,7 +93,7 @@ REGISTER_CALCULATOR(DetectionUniqueIdCalculator);
|
||||||
auto result = cc->Inputs()
|
auto result = cc->Inputs()
|
||||||
.Tag(kDetectionsTag)
|
.Tag(kDetectionsTag)
|
||||||
.Value()
|
.Value()
|
||||||
.Consume<std::vector<Detection>>();
|
.ConsumeOrCopy<std::vector<Detection>>();
|
||||||
if (result.ok()) {
|
if (result.ok()) {
|
||||||
auto detections = std::move(result).ValueOrDie();
|
auto detections = std::move(result).ValueOrDie();
|
||||||
for (Detection& detection : *detections) {
|
for (Detection& detection : *detections) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user