Skip to content

Commit bdd44ca

Browse files
committed
Update tests
1 parent d8fe18e commit bdd44ca

File tree

7 files changed

+61
-6
lines changed

7 files changed

+61
-6
lines changed

src/cpp/src/tasks/anomaly.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
ov::AnyMap Anomaly::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap& input_config) {
88
if (utils::model_has_embedded_processing(ov_model)) {
99
std::cout << "model already was serialized" << std::endl;
10-
return {};
10+
return input_config;
1111
}
1212

1313
auto input = ov_model->inputs().front();

src/cpp/src/tasks/classification.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ std::vector<size_t> get_non_xai_output_indices(const std::vector<ov::Output<ov::
8585
ov::AnyMap Classification::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap& input_config) {
8686
if (utils::model_has_embedded_processing(ov_model)) {
8787
std::cout << "model already was serialized" << std::endl;
88-
return {};
88+
return input_config;
8989
}
9090
// --------------------------- Configure input & output -------------------------------------------------
9191
// --------------------------- Prepare input ------------------------------------------------------

src/cpp/src/tasks/detection/ssd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ std::map<std::string, ov::Tensor> SSD::preprocess(cv::Mat image) {
7070
ov::AnyMap SSD::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap& input_config) {
7171
if (utils::model_has_embedded_processing(ov_model)) {
7272
std::cout << "model already was serialized" << std::endl;
73-
return {};
73+
return input_config;
7474
}
7575
auto output_mode = ov_model->outputs().size() > 1 ? SSDOutputMode::multi : SSDOutputMode::single;
7676

@@ -89,7 +89,7 @@ ov::AnyMap SSD::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap
8989
auto input_shape = ov::Shape{shape[ov::layout::width_idx(layout)], shape[ov::layout::height_idx(layout)]};
9090
uint8_t pad_value = 0;
9191

92-
auto config = ov_model->has_rt_info("model_info") ? ov_model->get_rt_info<ov::AnyMap>("model_info") : ov::AnyMap{};
92+
auto config(input_config);
9393

9494
std::vector<float> scale_values;
9595
std::vector<float> mean_values;

src/cpp/src/tasks/instance_segmentation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ cv::Mat segm_postprocess(const SegmentedObject& box, const cv::Mat& unpadded, in
124124
ov::AnyMap InstanceSegmentation::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap& input_config) {
125125
if (utils::model_has_embedded_processing(ov_model)) {
126126
std::cout << "model already was serialized" << std::endl;
127-
return {};
127+
return input_config;
128128
}
129129
if (ov_model->inputs().size() != 1) {
130130
throw std::logic_error("MaskRCNNModel model wrapper supports topologies with only 1 input");

src/cpp/src/tasks/semantic_segmentation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ SemanticSegmentation SemanticSegmentation::load(const std::string& model_path) {
3939
ov::AnyMap SemanticSegmentation::serialize(std::shared_ptr<ov::Model>& ov_model, const ov::AnyMap& input_config) {
4040
if (utils::model_has_embedded_processing(ov_model)) {
4141
std::cout << "model already was serialized" << std::endl;
42-
return {};
42+
return input_config;
4343
}
4444
if (ov_model->inputs().size() != 1) {
4545
throw std::logic_error("Segmentation model wrapper supports topologies with only 1 input");

tests/cpp/test_accuracy.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ TEST_P(ModelParameterizedTest, SerializedAccuracyTest) {
146146

147147
const std::string& basename = data.name.substr(data.name.find_last_of("/\\") + 1);
148148
auto model_path = DATA_DIR + "/serialized/" + basename;
149+
150+
if (model_path.find(".onnx") != std::string::npos) {
151+
GTEST_SKIP() << "ONNX models are not serializable";
152+
}
153+
149154
if (data.type == "DetectionModel") {
150155
auto use_tiling = !data.input_res.empty();
151156
auto model = DetectionModel::load(model_path, {{"tiling", use_tiling}});
@@ -207,6 +212,10 @@ TEST_P(ModelParameterizedTest, AccuracyTestBatch) {
207212
const std::string& basename = data.name.substr(data.name.find_last_of("/\\") + 1);
208213
auto model_path = DATA_DIR + "/serialized/" + basename;
209214

215+
if (model_path.find(".onnx") != std::string::npos) {
216+
GTEST_SKIP() << "ONNX models are not serializable";
217+
}
218+
210219
if (data.type == "DetectionModel") {
211220
auto use_tiling = !data.input_res.empty();
212221
auto model = DetectionModel::load(model_path, {{"tiling", use_tiling}});

tests/python/accuracy/public_scope.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
}
2424
]
2525
},
26+
{
27+
"name": "otx_models/Lite-hrnet-s_mod2.onnx",
28+
"type": "SegmentationModel",
29+
"test_data": [
30+
{
31+
"image": "coco128/images/train2017/000000000074.jpg",
32+
"reference": [
33+
"0: 0.563, 1: 0.437, [426,640,2], [0], [0]; object: 0.520, 26, object: 0.530, 42, object: 0.501, 4, object: 0.507, 27, object: 0.503, 8, object: 0.502, 6, object: 0.505, 18, object: 0.504, 13, object: 0.524, 87, object: 0.521, 89, object: 0.757, 2706, "
34+
]
35+
}
36+
]
37+
},
2638
{
2739
"name": "otx_models/segmentation_model_with_xai_head.xml",
2840
"type": "SegmentationModel",
@@ -47,6 +59,18 @@
4759
}
4860
]
4961
},
62+
{
63+
"name": "otx_models/is_efficientnetb2b_maskrcnn_coco_reduced_onnx.onnx",
64+
"type": "MaskRCNNModel",
65+
"test_data": [
66+
{
67+
"image": "coco128/images/train2017/000000000074.jpg",
68+
"reference": [
69+
"458, 106, 495, 150, 1 (person): 0.818, 852, RotatedRect: 478.119 130.332 28.677 46.408 46.637; 0, 30, 178, 323, 2 (bicycle): 0.753, 26728, RotatedRect: 79.739 177.262 251.785 156.656 87.397; 0; [0]; person: 0.818, 139; bicycle: 0.753, 622; "
70+
]
71+
}
72+
]
73+
},
5074
{
5175
"name": "otx_models/is_resnet50_maskrcnn_coco_reduced.xml",
5276
"type": "MaskRCNNModel",
@@ -71,6 +95,18 @@
7195
}
7296
]
7397
},
98+
{
99+
"name": "otx_models/det_mobilenetv2_atss_bccd_onnx.onnx",
100+
"type": "DetectionModel",
101+
"test_data": [
102+
{
103+
"image": "BloodImage_00007.jpg",
104+
"reference": [
105+
"494, 159, 637, 308, 2 (WBC): 0.697; 28, 139, 135, 228, 1 (RBC): 0.628; 535, 375, 638, 479, 1 (RBC): 0.524; 513, 8, 633, 152, 1 (RBC): 0.430; 21, 291, 143, 399, 1 (RBC): 0.422; 196, 86, 410, 286, 1 (RBC): 0.422; [0]; [0]"
106+
]
107+
}
108+
]
109+
},
74110
{
75111
"name": "otx_models/detection_model_with_xai_head.xml",
76112
"type": "DetectionModel",
@@ -142,6 +178,16 @@
142178
}
143179
]
144180
},
181+
{
182+
"name": "otx_models/cls_mobilenetv3_large_cars.onnx",
183+
"type": "ClassificationModel",
184+
"test_data": [
185+
{
186+
"image": "coco128/images/train2017/000000000471.jpg",
187+
"reference": ["105 (194): 0.456, [0], [0], [196]"]
188+
}
189+
]
190+
},
145191
{
146192
"name": "otx_models/cls_efficient_b0_cars.xml",
147193
"type": "ClassificationModel",

0 commit comments

Comments
 (0)