Skip to content

Commit 8f19fb2

Browse files
OV2.0 mask_rcnn_demo (#3129)
* OV2.0 with IR v10 and IR v11 support in mask_rcnn_demo * catcher and ov2.0 api * declare set_terminate * fix IR v11 converted w/o defining layout * fix filling tensor with batch image data * Apply suggestions from code review Co-authored-by: Zlobin Vladimir <[email protected]> * Update demos/common/cpp/utils/include/utils/ocv_common.hpp Co-authored-by: Zlobin Vladimir <[email protected]> * simplified in/out validation, check imwrite status * Update demos/mask_rcnn_demo/cpp/main.cpp Co-authored-by: Zlobin Vladimir <[email protected]> * nhwc, u8 as default input Co-authored-by: Zlobin Vladimir <[email protected]>
1 parent 0d23ffa commit 8f19fb2

File tree

4 files changed

+274
-210
lines changed

4 files changed

+274
-210
lines changed

demos/common/cpp/utils/include/utils/common.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,23 +317,23 @@ void logBasicModelInfo(const std::shared_ptr<ov::Model>& model) {
317317
ov::OutputVector outputs = model->outputs();
318318

319319
slog::info << "inputs: " << slog::endl;
320-
for (const ov::Output<ov::Node> input : inputs)
321-
{
320+
for (const ov::Output<ov::Node>& input : inputs) {
322321
const std::string name = input.get_any_name();
323322
const ov::element::Type type = input.get_element_type();
324323
const ov::PartialShape shape = input.get_partial_shape();
324+
const ov::Layout layout = ov::layout::get_layout(input);
325325

326-
slog::info << name << ", " << type << ", " << shape << slog::endl;
326+
slog::info << name << ", " << type << ", " << shape << ", " << layout.to_string() << slog::endl;
327327
}
328328

329329
slog::info << "outputs: " << slog::endl;
330-
for (const ov::Output<ov::Node> output : outputs)
331-
{
330+
for (const ov::Output<ov::Node>& output : outputs) {
332331
const std::string name = output.get_any_name();
333332
const ov::element::Type type = output.get_element_type();
334333
const ov::PartialShape shape = output.get_partial_shape();
334+
const ov::Layout layout = ov::layout::get_layout(output);
335335

336-
slog::info << name << ", " << type << ", " << shape << slog::endl;
336+
slog::info << name << ", " << type << ", " << shape << ", " << layout.to_string() << slog::endl;
337337
}
338338

339339
return;

demos/common/cpp/utils/include/utils/ocv_common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ inline void matToBlob(const cv::Mat& mat, const InferenceEngine::Blob::Ptr& blob
8787
*/
8888
static UNUSED void matToTensor(const cv::Mat& mat, const ov::Tensor& tensor, int batchIndex = 0) {
8989
ov::Shape tensorShape = tensor.get_shape();
90-
ov::Layout layout("NCHW");
90+
static const ov::Layout layout{"NCHW"};
9191
const size_t width = tensorShape[ov::layout::width_idx(layout)];
9292
const size_t height = tensorShape[ov::layout::height_idx(layout)];
9393
const size_t channels = tensorShape[ov::layout::channels_idx(layout)];

0 commit comments

Comments
 (0)