Skip to content

Commit b32e8d4

Browse files
committed
update image model preprocessing
1 parent e3f46cc commit b32e8d4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

demos/common/cpp/models/include/models/image_model.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <string>
2222

2323
#include "models/model_base.h"
24+
#include "utils/image_utils.h"
2425

2526
namespace ov {
2627
class InferRequest;
@@ -43,4 +44,6 @@ class ImageModel : public ModelBase {
4344

4445
size_t netInputHeight = 0;
4546
size_t netInputWidth = 0;
47+
INTERPOLATION_MODE interpolationMode = LINEAR;
48+
RESIZE_MODE resizeMode = RESIZE_FILL;
4649
};

demos/common/cpp/models/src/image_model.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ std::shared_ptr<InternalModelData> ImageModel::preprocess(const InputData& input
5050
if (channels != 1 && channels != 3) {
5151
throw std::runtime_error("Unsupported number of channels");
5252
}
53-
img = resizeImageExt(img, width, height);
53+
img = resizeImageExt(img, width, height, resizeMode, interpolationMode);
5454
}
55+
5556
request.set_tensor(inputsNames[0], wrapMat2Tensor(img));
5657
return std::make_shared<InternalImageModelData>(origImg.cols, origImg.rows);
5758
}

0 commit comments

Comments
 (0)