Skip to content

Commit ba8d2bf

Browse files
committed
Use get_from_any_map in tiling.h
1 parent fbc9c75 commit ba8d2bf

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

src/cpp/include/utils/tiling.h

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <opencv2/opencv.hpp>
99
#include <openvino/openvino.hpp>
1010

11+
#include "utils/config.h"
12+
1113
namespace utils {
1214

1315
struct TilingInfo {
@@ -24,30 +26,10 @@ inline bool config_contains_tiling_info(const ov::AnyMap& config) {
2426

2527
inline TilingInfo get_tiling_info_from_config(const ov::AnyMap& config) {
2628
TilingInfo info;
27-
{
28-
auto iter = config.find("tile_size");
29-
if (iter != config.end()) {
30-
info.tile_size = iter->second.as<size_t>();
31-
}
32-
}
33-
{
34-
auto iter = config.find("tiles_overlap");
35-
if (iter != config.end()) {
36-
info.tiles_overlap = iter->second.as<float>();
37-
}
38-
}
39-
{
40-
auto iter = config.find("iou_threshold");
41-
if (iter != config.end()) {
42-
info.iou_threshold = iter->second.as<float>();
43-
}
44-
}
45-
{
46-
auto iter = config.find("tile_with_full_img");
47-
if (iter != config.end()) {
48-
info.tile_with_full_image = iter->second.as<bool>();
49-
}
50-
}
29+
info.tile_size = utils::get_from_any_maps("tile_size", config, {}, info.tile_size);
30+
info.tiles_overlap = utils::get_from_any_maps("tiles_overlap", config, {}, info.tiles_overlap);
31+
info.iou_threshold = utils::get_from_any_maps("iou_threshold", config, {}, info.iou_threshold);
32+
info.tile_with_full_image = utils::get_from_any_maps("tile_with_full_image", config, {}, info.tile_with_full_image);
5133
return info;
5234
}
5335

0 commit comments

Comments
 (0)