Skip to content

Commit e7fa1a3

Browse files
committed
Update tests
1 parent 058381a commit e7fa1a3

File tree

4 files changed

+66
-159
lines changed

4 files changed

+66
-159
lines changed

packages/react-native-executorch/common/rnexecutorch/tests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ add_rn_test(ClassificationTests integration/ClassificationTest.cpp
189189
add_rn_test(ObjectDetectionTests integration/ObjectDetectionTest.cpp
190190
SOURCES
191191
${RNEXECUTORCH_DIR}/models/object_detection/ObjectDetection.cpp
192-
${RNEXECUTORCH_DIR}/models/object_detection/Utils.cpp
193192
${RNEXECUTORCH_DIR}/models/VisionModel.cpp
194193
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
195194
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
195+
${RNEXECUTORCH_DIR}/utils/computer_vision/Processing.cpp
196196
${IMAGE_UTILS_SOURCES}
197197
LIBS opencv_deps android
198198
)
@@ -292,6 +292,10 @@ add_rn_test(TextToImageTests integration/TextToImageTest.cpp
292292
add_rn_test(InstanceSegmentationTests integration/InstanceSegmentationTest.cpp
293293
SOURCES
294294
${RNEXECUTORCH_DIR}/models/instance_segmentation/BaseInstanceSegmentation.cpp
295+
${RNEXECUTORCH_DIR}/models/VisionModel.cpp
296+
${RNEXECUTORCH_DIR}/utils/FrameProcessor.cpp
297+
${RNEXECUTORCH_DIR}/utils/FrameExtractor.cpp
298+
${RNEXECUTORCH_DIR}/utils/computer_vision/Processing.cpp
295299
${IMAGE_UTILS_SOURCES}
296300
LIBS opencv_deps android
297301
)

packages/react-native-executorch/common/rnexecutorch/tests/integration/InstanceSegmentationTest.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ TEST(InstanceSegResultTests, InstancesHaveValidBoundingBoxes) {
139139
{}, true, kMethodName);
140140

141141
for (const auto &inst : results) {
142-
EXPECT_LE(inst.x1, inst.x2);
143-
EXPECT_LE(inst.y1, inst.y2);
144-
EXPECT_GE(inst.x1, 0.0f);
145-
EXPECT_GE(inst.y1, 0.0f);
142+
EXPECT_LE(inst.bbox.x1, inst.bbox.x2);
143+
EXPECT_LE(inst.bbox.y1, inst.bbox.y2);
144+
EXPECT_GE(inst.bbox.x1, 0.0f);
145+
EXPECT_GE(inst.bbox.y1, 0.0f);
146146
}
147147
}
148148

@@ -242,10 +242,10 @@ TEST(InstanceSegNMSTests, NMSEnabledReturnsFewerOrEqualResults) {
242242
BaseInstanceSegmentation modelWithoutNMS(kValidInstanceSegModelPath, {}, {},
243243
false, nullptr);
244244

245-
auto nmsResults = modelWithNMS.generate(kValidTestImagePath, 0.3, 0.5, 100,
246-
{}, true, kMethodName);
247-
auto noNmsResults = modelWithoutNMS.generate(kValidTestImagePath, 0.3, 0.5,
248-
100, {}, true, kMethodName);
245+
auto nmsResults = modelWithNMS.generateFromString(
246+
kValidTestImagePath, 0.3, 0.5, 100, {}, true, kMethodName);
247+
auto noNmsResults = modelWithoutNMS.generateFromString(
248+
kValidTestImagePath, 0.3, 0.5, 100, {}, true, kMethodName);
249249

250250
EXPECT_LE(nmsResults.size(), noNmsResults.size());
251251
}

packages/react-native-executorch/common/rnexecutorch/tests/integration/ObjectDetectionTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ TEST(ObjectDetectionGenerateTests, DetectionsHaveValidBoundingBoxes) {
120120
auto results = model.generateFromString(kValidTestImagePath, 0.3);
121121

122122
for (const auto &detection : results) {
123-
EXPECT_LE(detection.x1, detection.x2);
124-
EXPECT_LE(detection.y1, detection.y2);
125-
EXPECT_GE(detection.x1, 0.0f);
126-
EXPECT_GE(detection.y1, 0.0f);
123+
EXPECT_LE(detection.bbox.x1, detection.bbox.x2);
124+
EXPECT_LE(detection.bbox.y1, detection.bbox.y2);
125+
EXPECT_GE(detection.bbox.x1, 0.0f);
126+
EXPECT_GE(detection.bbox.y1, 0.0f);
127127
}
128128
}
129129

0 commit comments

Comments
 (0)