Skip to content

Commit 938ddb4

Browse files
committed
fix: fix integer division
1 parent 4b90874 commit 938ddb4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • packages/react-native-executorch/common/rnexecutorch/models/object_detection

packages/react-native-executorch/common/rnexecutorch/models/object_detection/ObjectDetection.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ ObjectDetection::preprocess(const std::string &imageSource) {
3838
std::vector<Detection>
3939
ObjectDetection::postprocess(const std::vector<EValue> &tensors,
4040
cv::Size originalSize, double detectionThreshold) {
41-
float widthRatio = originalSize.width / modelImageSize.width;
42-
float heightRatio = originalSize.height / modelImageSize.height;
41+
float widthRatio =
42+
static_cast<float>(originalSize.width) / modelImageSize.width;
43+
float heightRatio =
44+
static_cast<float>(originalSize.height) / modelImageSize.height;
4345

4446
std::vector<Detection> detections;
4547
auto bboxTensor = tensors.at(0).toTensor();

0 commit comments

Comments
 (0)