diff --git a/demos/common/cpp/models/include/models/detection_model.h b/demos/common/cpp/models/include/models/detection_model.h index 7b9ecf74599..0a8527a79c4 100644 --- a/demos/common/cpp/models/include/models/detection_model.h +++ b/demos/common/cpp/models/include/models/detection_model.h @@ -45,7 +45,7 @@ class DetectionModel : public ImageModel { float confidenceThreshold; std::vector labels; - std::string getLabelName(int labelID) { - return (size_t)labelID < labels.size() ? labels[labelID] : std::string("Label #") + std::to_string(labelID); + std::string getLabelName(size_t labelID) { + return labelID < labels.size() ? labels[labelID] : std::string("Label #") + std::to_string(labelID); } }; diff --git a/demos/common/cpp/models/include/models/detection_model_yolox.h b/demos/common/cpp/models/include/models/detection_model_yolox.h index fa6a2c9f315..d351e653c1d 100644 --- a/demos/common/cpp/models/include/models/detection_model_yolox.h +++ b/demos/common/cpp/models/include/models/detection_model_yolox.h @@ -47,7 +47,7 @@ class ModelYoloX: public DetectionModel { void prepareInputsOutputs(std::shared_ptr& model) override; void setStridesGrids(); - double boxIOUThreshold; + float boxIOUThreshold; std::vector> grids; std::vector expandedStrides; static const size_t numberOfClasses = 80; diff --git a/demos/common/cpp/models/include/models/results.h b/demos/common/cpp/models/include/models/results.h index 48a5339eea6..c94847e8447 100644 --- a/demos/common/cpp/models/include/models/results.h +++ b/demos/common/cpp/models/include/models/results.h @@ -87,7 +87,7 @@ struct ClassificationResult : public ResultBase { }; struct DetectedObject : public cv::Rect2f { - unsigned int labelID; + size_t labelID; std::string label; float confidence; }; diff --git a/demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp b/demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp index ab8330a49ee..d8957e23e68 100644 --- a/demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp +++ b/demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp @@ -117,11 +117,7 @@ std::shared_ptr ModelYoloV3ONNX::preprocess(const InputData& namespace { float getScore(const ov::Tensor& scoresTensor, size_t classInd, size_t boxInd) { - const float* scoresPtr = scoresTensor.data(); - const auto shape = scoresTensor.get_shape(); - int N = shape[2]; - - return scoresPtr[classInd * N + boxInd]; + return scoresTensor.data()[classInd * scoresTensor.get_shape()[2] + boxInd]; } } @@ -144,7 +140,7 @@ std::unique_ptr ModelYoloV3ONNX::postprocess(InferenceResult& infRes // Generate detection results DetectionResult* result = new DetectionResult(infResult.frameId, infResult.metaData); size_t numberOfBoxes = indicesShape.size() == 3 ? indicesShape[1] : indicesShape[0]; - int indicesStride = indicesShape.size() == 3 ? indicesShape[2] : indicesShape[1]; + size_t indicesStride = indicesShape.size() == 3 ? indicesShape[2] : indicesShape[1]; for (size_t i = 0; i < numberOfBoxes; ++i) { int batchInd = indicesData[i * indicesStride]; diff --git a/demos/common/cpp/models/src/detection_model_yolox.cpp b/demos/common/cpp/models/src/detection_model_yolox.cpp index d22ab546141..e64ba7e6273 100644 --- a/demos/common/cpp/models/src/detection_model_yolox.cpp +++ b/demos/common/cpp/models/src/detection_model_yolox.cpp @@ -112,8 +112,8 @@ void ModelYoloX::setStridesGrids() { std::shared_ptr ModelYoloX::preprocess(const InputData& inputData, ov::InferRequest& request) { const auto& origImg = inputData.asRef().inputImage; - double scale = std::min(static_cast(netInputWidth) / origImg.cols, - static_cast(netInputHeight) / origImg.rows); + float scale = std::min(static_cast(netInputWidth) / origImg.cols, + static_cast(netInputHeight) / origImg.rows); cv::Mat resizedImage = resizeImageExt(origImg, netInputWidth, netInputHeight, resizeMode, interpolationMode, nullptr, cv::Scalar(114, 114, 114)); diff --git a/demos/interactive_face_detection_demo/cpp/detectors.hpp b/demos/interactive_face_detection_demo/cpp/detectors.hpp index aa7a391aec5..8acb9ac3dcb 100644 --- a/demos/interactive_face_detection_demo/cpp/detectors.hpp +++ b/demos/interactive_face_detection_demo/cpp/detectors.hpp @@ -32,7 +32,7 @@ struct FaceDetection : BaseDetection { std::string output; std::string labels_output; double detectionThreshold; - int objectSize; + size_t objectSize; float width; float height; size_t model_input_width; diff --git a/demos/text_detection_demo/cpp/include/cnn.hpp b/demos/text_detection_demo/cpp/include/cnn.hpp index 1bef23af7f1..745eaf4f291 100644 --- a/demos/text_detection_demo/cpp/include/cnn.hpp +++ b/demos/text_detection_demo/cpp/include/cnn.hpp @@ -32,7 +32,7 @@ class Cnn { ov::Core& m_core; cv::Size m_new_input_resolution; bool use_auto_resize; - int m_channels; + size_t m_channels; cv::Size m_input_size; std::string m_input_name; std::vector m_output_names; diff --git a/demos/text_detection_demo/cpp/src/cnn.cpp b/demos/text_detection_demo/cpp/src/cnn.cpp index 6ed9ad3b703..3559b30d727 100644 --- a/demos/text_detection_demo/cpp/src/cnn.cpp +++ b/demos/text_detection_demo/cpp/src/cnn.cpp @@ -53,7 +53,7 @@ Cnn::Cnn( m_model->reshape({ {m_input_name, input_shape} }); m_channels = input_shape[ov::layout::channels_idx(input_layout)]; - m_input_size = cv::Size(input_shape[ov::layout::width_idx(input_layout)], input_shape[ov::layout::height_idx(input_layout)]); + m_input_size = cv::Size(int(input_shape[ov::layout::width_idx(input_layout)]), int(input_shape[ov::layout::height_idx(input_layout)])); // Collect output names ov::OutputVector outputs = m_model->outputs();