Skip to content

Commit ec8edc0

Browse files
committed
demos: fix compilation warnings
1 parent d831efe commit ec8edc0

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DetectionModel : public ImageModel {
4545
float confidenceThreshold;
4646
std::vector<std::string> labels;
4747

48-
std::string getLabelName(int labelID) {
49-
return (size_t)labelID < labels.size() ? labels[labelID] : std::string("Label #") + std::to_string(labelID);
48+
std::string getLabelName(size_t labelID) {
49+
return labelID < labels.size() ? labels[labelID] : std::string("Label #") + std::to_string(labelID);
5050
}
5151
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ModelYoloX: public DetectionModel {
4747
void prepareInputsOutputs(std::shared_ptr<ov::Model>& model) override;
4848
void setStridesGrids();
4949

50-
double boxIOUThreshold;
50+
float boxIOUThreshold;
5151
std::vector<std::pair<size_t, size_t>> grids;
5252
std::vector<size_t> expandedStrides;
5353
static const size_t numberOfClasses = 80;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct ClassificationResult : public ResultBase {
8787
};
8888

8989
struct DetectedObject : public cv::Rect2f {
90-
unsigned int labelID;
90+
size_t labelID;
9191
std::string label;
9292
float confidence;
9393
};

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ std::shared_ptr<InternalModelData> ModelYoloV3ONNX::preprocess(const InputData&
117117

118118
namespace {
119119
float getScore(const ov::Tensor& scoresTensor, size_t classInd, size_t boxInd) {
120-
const float* scoresPtr = scoresTensor.data<float>();
121-
const auto shape = scoresTensor.get_shape();
122-
int N = shape[2];
123-
124-
return scoresPtr[classInd * N + boxInd];
120+
return scoresTensor.data<float>()[classInd * scoresTensor.get_shape()[2] + boxInd];
125121
}
126122
}
127123

@@ -144,7 +140,7 @@ std::unique_ptr<ResultBase> ModelYoloV3ONNX::postprocess(InferenceResult& infRes
144140
// Generate detection results
145141
DetectionResult* result = new DetectionResult(infResult.frameId, infResult.metaData);
146142
size_t numberOfBoxes = indicesShape.size() == 3 ? indicesShape[1] : indicesShape[0];
147-
int indicesStride = indicesShape.size() == 3 ? indicesShape[2] : indicesShape[1];
143+
size_t indicesStride = indicesShape.size() == 3 ? indicesShape[2] : indicesShape[1];
148144

149145
for (size_t i = 0; i < numberOfBoxes; ++i) {
150146
int batchInd = indicesData[i * indicesStride];

demos/common/cpp/models/src/detection_model_yolox.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ void ModelYoloX::setStridesGrids() {
112112
std::shared_ptr<InternalModelData> ModelYoloX::preprocess(const InputData& inputData,
113113
ov::InferRequest& request) {
114114
const auto& origImg = inputData.asRef<ImageInputData>().inputImage;
115-
double scale = std::min(static_cast<double>(netInputWidth) / origImg.cols,
116-
static_cast<double>(netInputHeight) / origImg.rows);
115+
float scale = std::min(static_cast<float>(netInputWidth) / origImg.cols,
116+
static_cast<float>(netInputHeight) / origImg.rows);
117117

118118
cv::Mat resizedImage = resizeImageExt(origImg, netInputWidth, netInputHeight, resizeMode,
119119
interpolationMode, nullptr, cv::Scalar(114, 114, 114));

demos/interactive_face_detection_demo/cpp/detectors.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct FaceDetection : BaseDetection {
3232
std::string output;
3333
std::string labels_output;
3434
double detectionThreshold;
35-
int objectSize;
35+
size_t objectSize;
3636
float width;
3737
float height;
3838
size_t model_input_width;

demos/text_detection_demo/cpp/include/cnn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Cnn {
3232
ov::Core& m_core;
3333
cv::Size m_new_input_resolution;
3434
bool use_auto_resize;
35-
int m_channels;
35+
size_t m_channels;
3636
cv::Size m_input_size;
3737
std::string m_input_name;
3838
std::vector<std::string> m_output_names;

demos/text_detection_demo/cpp/src/cnn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Cnn::Cnn(
5353
m_model->reshape({ {m_input_name, input_shape} });
5454

5555
m_channels = input_shape[ov::layout::channels_idx(input_layout)];
56-
m_input_size = cv::Size(input_shape[ov::layout::width_idx(input_layout)], input_shape[ov::layout::height_idx(input_layout)]);
56+
m_input_size = cv::Size(int(input_shape[ov::layout::width_idx(input_layout)]), int(input_shape[ov::layout::height_idx(input_layout)]));
5757

5858
// Collect output names
5959
ov::OutputVector outputs = m_model->outputs();

0 commit comments

Comments
 (0)