@@ -42,7 +42,7 @@ class MockAdapter : public OpenVINOInferenceAdapter {
42
42
: OpenVINOInferenceAdapter() {
43
43
auto core = ov::Core ();
44
44
auto model = core.read_model (modelPath);
45
- loadModel (model, core, " AUTO " );
45
+ loadModel (model, core, " CPU " );
46
46
}
47
47
};
48
48
@@ -76,7 +76,8 @@ std::string string_format(const std::string &fmt, Args... args) {
76
76
77
77
TEST_P (ClassificationModelParameterizedTest, TestClassificationDefaultConfig) {
78
78
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
79
- auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path);
79
+ bool preload = true ;
80
+ auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path, {}, preload, " CPU" );
80
81
81
82
auto ov_model = model->getModel ();
82
83
@@ -98,7 +99,8 @@ TEST_P(ClassificationModelParameterizedTest, TestClassificationCustomConfig) {
98
99
{" resize_type" , " fit_to_window" },
99
100
{" labels" , mock_labels}
100
101
};
101
- auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path, configuration);
102
+ bool preload = true ;
103
+ auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path, configuration, preload, " CPU" );
102
104
103
105
auto ov_model = model->getModel ();
104
106
@@ -121,14 +123,15 @@ TEST_P(ClassificationModelParameterizedTestSaveLoad, TestClassificationCorrectne
121
123
}
122
124
123
125
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
124
- auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path);
126
+ bool preload = true ;
127
+ auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path, {}, preload, " CPU" );
125
128
126
129
auto ov_model = model->getModel ();
127
130
ov::serialize (ov_model, TMP_MODEL_FILE);
128
131
129
132
auto result = model->infer (image)->topLabels ;
130
133
131
- auto model_restored = ClassificationModel::create_model (TMP_MODEL_FILE);
134
+ auto model_restored = ClassificationModel::create_model (TMP_MODEL_FILE, {}, preload, " CPU " );
132
135
auto result_data = model_restored->infer (image);
133
136
auto result_restored = result_data->topLabels ;
134
137
@@ -143,7 +146,8 @@ TEST_P(ClassificationModelParameterizedTestSaveLoad, TestClassificationCorrectne
143
146
}
144
147
145
148
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
146
- auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path);
149
+ bool preload = true ;
150
+ auto model = ClassificationModel::create_model (DATA_DIR + " /" + model_path, {}, preload, " CPU" );
147
151
auto ov_model = model->getModel ();
148
152
ov::serialize (ov_model, TMP_MODEL_FILE);
149
153
auto result = model->infer (image)->topLabels ;
@@ -159,7 +163,8 @@ TEST_P(ClassificationModelParameterizedTestSaveLoad, TestClassificationCorrectne
159
163
160
164
TEST_P (SSDModelParameterizedTest, TestDetectionDefaultConfig) {
161
165
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
162
- auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path);
166
+ bool preload = true ;
167
+ auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path, {}, " " , preload, " CPU" );
163
168
164
169
auto ov_model = model->getModel ();
165
170
@@ -181,7 +186,8 @@ TEST_P(SSDModelParameterizedTest, TestDetectionCustomConfig) {
181
186
{" resize_type" , " fit_to_window" },
182
187
{" labels" , mock_labels}
183
188
};
184
- auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path, configuration);
189
+ bool preload = true ;
190
+ auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path, configuration, " " , preload, " CPU" );
185
191
186
192
auto ov_model = model->getModel ();
187
193
@@ -204,7 +210,8 @@ TEST_P(DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSave
204
210
}
205
211
206
212
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
207
- auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path);
213
+ bool preload = true ;
214
+ auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path, {}, " " , preload, " CPU" );
208
215
209
216
auto ov_model = model->getModel ();
210
217
ov::serialize (ov_model, TMP_MODEL_FILE);
@@ -215,7 +222,7 @@ TEST_P(DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSave
215
222
if (!image.data ) {
216
223
throw std::runtime_error{" Failed to read the image" };
217
224
}
218
- auto model_restored = DetectionModel::create_model (TMP_MODEL_FILE);
225
+ auto model_restored = DetectionModel::create_model (TMP_MODEL_FILE, {}, " " , preload, " CPU " );
219
226
auto result_data = model_restored->infer (image);
220
227
auto result_restored = result_data->objects ;
221
228
@@ -227,8 +234,6 @@ TEST_P(DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSave
227
234
ASSERT_EQ (result[i].width , result_restored[i].width );
228
235
ASSERT_EQ (result[i].height , result_restored[i].height );
229
236
}
230
-
231
- SUCCEED ();
232
237
}
233
238
234
239
TEST_P (DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSaveLoadWithAdapter) {
@@ -238,7 +243,8 @@ TEST_P(DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSave
238
243
}
239
244
240
245
auto model_path = string_format (MODEL_PATH_TEMPLATE, GetParam ().name .c_str (), GetParam ().name .c_str ());
241
- auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path);
246
+ bool preload = true ;
247
+ auto model = DetectionModel::create_model (DATA_DIR + " /" + model_path, {}, " " , preload, " CPU" );
242
248
auto ov_model = model->getModel ();
243
249
ov::serialize (ov_model, TMP_MODEL_FILE);
244
250
auto result = model->infer (image)->objects ;
@@ -261,8 +267,6 @@ TEST_P(DetectionModelParameterizedTestSaveLoad, TestDetctionCorrectnessAfterSave
261
267
ASSERT_EQ (result[i].width , result_restored[i].width );
262
268
ASSERT_EQ (result[i].height , result_restored[i].height );
263
269
}
264
-
265
- SUCCEED ();
266
270
}
267
271
268
272
0 commit comments