Skip to content

Commit 7b876df

Browse files
committed
Apply suggestions
1 parent 406271b commit 7b876df

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/react-native-executorch/common/rnexecutorch/models/instance_segmentation/BaseInstanceSegmentation.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,8 @@ std::vector<types::Instance> BaseInstanceSegmentation::postprocess(
332332

333333
auto isValidDetection =
334334
[&allowedClasses, &confidenceThreshold](float score, int32_t labelIdx) {
335-
if (score < confidenceThreshold ||
336-
(!allowedClasses.empty() && allowedClasses.count(labelIdx) == 0)) {
337-
return false;
338-
}
339-
return true;
335+
return score >= confidenceThreshold &&
336+
(allowedClasses.empty() || allowedClasses.count(labelIdx) != 0);
340337
};
341338

342339
std::vector<types::Instance> instances;

0 commit comments

Comments
 (0)