Skip to content

Commit 980cbc7

Browse files
committed
pre-commit
1 parent 46f4eb7 commit 980cbc7

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

src/cpp/include/tasks/anomaly.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "utils/config.h"
1414
#include "utils/vision_pipeline.h"
1515

16-
1716
class Anomaly {
1817
public:
1918
std::shared_ptr<InferenceAdapter> adapter;
@@ -38,8 +37,8 @@ class Anomaly {
3837
task = utils::get_from_any_maps("pixel_threshold", config, {}, task);
3938
labels = utils::get_from_any_maps("labels", config, {}, labels);
4039

41-
//labels = utils::get_from_any_maps("labels", config, {}, labels);
42-
//confidence_threshold = utils::get_from_any_maps("confidence_threshold", config, {}, confidence_threshold);
40+
// labels = utils::get_from_any_maps("labels", config, {}, labels);
41+
// confidence_threshold = utils::get_from_any_maps("confidence_threshold", config, {}, confidence_threshold);
4342
}
4443

4544
static cv::Size serialize(std::shared_ptr<ov::Model>& ov_model);
@@ -56,7 +55,6 @@ class Anomaly {
5655
double normalize(double& tensor, float threshold);
5756
std::vector<cv::Rect> getBoxes(cv::Mat& mask);
5857

59-
6058
private:
6159
cv::Size input_shape;
6260
std::vector<std::string> labels;

src/cpp/src/tasks/anomaly.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "tasks/anomaly.h"
2+
23
#include "adapters/openvino_adapter.h"
3-
#include "utils/tensor.h"
44
#include "utils/preprocessing.h"
5-
5+
#include "utils/tensor.h"
66

77
cv::Size Anomaly::serialize(std::shared_ptr<ov::Model>& ov_model) {
88
auto input = ov_model->inputs().front();
@@ -19,28 +19,26 @@ cv::Size Anomaly::serialize(std::shared_ptr<ov::Model>& ov_model) {
1919
uint8_t pad_value = 0;
2020
bool reverse_input_channels = false;
2121

22-
2322
std::vector<float> scale_values;
2423
std::vector<float> mean_values;
2524
if (ov_model->has_rt_info("model_info")) {
26-
auto config = ov_model->get_rt_info<ov::AnyMap>("model_info");
25+
auto config = ov_model->get_rt_info<ov::AnyMap>("model_info");
2726
scale_values = utils::get_from_any_maps("scale_values", config, ov::AnyMap{}, scale_values);
2827
mean_values = utils::get_from_any_maps("mean_values", config, ov::AnyMap{}, mean_values);
2928
}
3029

3130
auto input_shape = ov::Shape{shape[ov::layout::width_idx(layout)], shape[ov::layout::height_idx(layout)]};
3231

33-
ov_model = utils::embedProcessing(
34-
ov_model,
35-
input.get_any_name(),
36-
layout,
37-
resize_mode,
38-
interpolation_mode,
39-
input_shape,
40-
pad_value,
41-
reverse_input_channels,
42-
mean_values,
43-
scale_values);
32+
ov_model = utils::embedProcessing(ov_model,
33+
input.get_any_name(),
34+
layout,
35+
resize_mode,
36+
interpolation_mode,
37+
input_shape,
38+
pad_value,
39+
reverse_input_channels,
40+
mean_values,
41+
scale_values);
4442

4543
return cv::Size(input_shape[0], input_shape[1]);
4644
}
@@ -69,11 +67,11 @@ Anomaly Anomaly::load(const std::string& model_path) {
6967
}
7068

7169
AnomalyResult Anomaly::infer(cv::Mat image) {
72-
return pipeline.infer(image);
70+
return pipeline.infer(image);
7371
}
7472

7573
std::vector<AnomalyResult> Anomaly::inferBatch(std::vector<cv::Mat> images) {
76-
return pipeline.inferBatch(images);
74+
return pipeline.inferBatch(images);
7775
}
7876

7977
std::map<std::string, ov::Tensor> Anomaly::preprocess(cv::Mat image) {

0 commit comments

Comments
 (0)