Skip to content

Commit 9f0a775

Browse files
committed
update data allocation
1 parent 5b961f9 commit 9f0a775

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ std::shared_ptr<InternalModelData> ModelYoloV3ONNX::preprocess(const InputData&
117117
ov::InferRequest& request) {
118118
const auto& origImg = inputData.asRef<ImageInputData>().inputImage;
119119

120-
int* img_size = new int[2];
121-
img_size[0] = origImg.rows;
122-
img_size[1] = origImg.cols;
123-
ov::Tensor infoInput = ov::Tensor(ov::element::i32, ov::Shape({1, 2}), img_size);
120+
cv::Mat info(cv::Size(1, 2), CV_32SC1);
121+
info.at<int>(0, 0) = origImg.rows;
122+
info.at<int>(0, 1) = origImg.cols;
123+
auto allocator = std::make_shared<SharedTensorAllocator>(info);
124+
ov::Tensor infoInput = ov::Tensor(ov::element::i32, ov::Shape({1, 2}), ov::Allocator(allocator));
124125

125126
request.set_tensor(inputsNames[1], infoInput);
126127

0 commit comments

Comments
 (0)