Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos: fix compilation warnings #3867

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demos/common/cpp/models/include/models/detection_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DetectionModel : public ImageModel {
float confidenceThreshold;
std::vector<std::string> 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);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ModelYoloX: public DetectionModel {
void prepareInputsOutputs(std::shared_ptr<ov::Model>& model) override;
void setStridesGrids();

double boxIOUThreshold;
float boxIOUThreshold;
std::vector<std::pair<size_t, size_t>> grids;
std::vector<size_t> expandedStrides;
static const size_t numberOfClasses = 80;
Expand Down
2 changes: 1 addition & 1 deletion demos/common/cpp/models/include/models/results.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct ClassificationResult : public ResultBase {
};

struct DetectedObject : public cv::Rect2f {
unsigned int labelID;
size_t labelID;
std::string label;
float confidence;
};
Expand Down
8 changes: 2 additions & 6 deletions demos/common/cpp/models/src/detection_model_yolov3_onnx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ std::shared_ptr<InternalModelData> ModelYoloV3ONNX::preprocess(const InputData&

namespace {
float getScore(const ov::Tensor& scoresTensor, size_t classInd, size_t boxInd) {
const float* scoresPtr = scoresTensor.data<float>();
const auto shape = scoresTensor.get_shape();
int N = shape[2];

return scoresPtr[classInd * N + boxInd];
return scoresTensor.data<float>()[classInd * scoresTensor.get_shape()[2] + boxInd];
}
}

Expand All @@ -144,7 +140,7 @@ std::unique_ptr<ResultBase> 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];
Expand Down
4 changes: 2 additions & 2 deletions demos/common/cpp/models/src/detection_model_yolox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ void ModelYoloX::setStridesGrids() {
std::shared_ptr<InternalModelData> ModelYoloX::preprocess(const InputData& inputData,
ov::InferRequest& request) {
const auto& origImg = inputData.asRef<ImageInputData>().inputImage;
double scale = std::min(static_cast<double>(netInputWidth) / origImg.cols,
static_cast<double>(netInputHeight) / origImg.rows);
float scale = std::min(static_cast<float>(netInputWidth) / origImg.cols,
static_cast<float>(netInputHeight) / origImg.rows);

cv::Mat resizedImage = resizeImageExt(origImg, netInputWidth, netInputHeight, resizeMode,
interpolationMode, nullptr, cv::Scalar(114, 114, 114));
Expand Down
2 changes: 1 addition & 1 deletion demos/interactive_face_detection_demo/cpp/detectors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion demos/text_detection_demo/cpp/include/cnn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> m_output_names;
Expand Down
2 changes: 1 addition & 1 deletion demos/text_detection_demo/cpp/src/cnn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down