Skip to content

Commit 745fdcf

Browse files
committed
clang-format
1 parent 6c78d65 commit 745fdcf

File tree

6 files changed

+31
-72
lines changed

6 files changed

+31
-72
lines changed

src/cpp/py_bindings/py_classification.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,17 @@ void init_classification(nb::module_& m) {
7575
[](ClassificationModel& self, const nb::ndarray<>& input) {
7676
return self.infer(pyutils::wrap_np_mat(input));
7777
})
78-
.def("infer_batch", [](ClassificationModel& self, const std::vector<nb::ndarray<>> inputs) {
79-
std::vector<ImageInputData> input_mats;
80-
input_mats.reserve(inputs.size());
78+
.def("infer_batch",
79+
[](ClassificationModel& self, const std::vector<nb::ndarray<>> inputs) {
80+
std::vector<ImageInputData> input_mats;
81+
input_mats.reserve(inputs.size());
8182

82-
for (const auto& input : inputs) {
83-
input_mats.push_back(pyutils::wrap_np_mat(input));
84-
}
83+
for (const auto& input : inputs) {
84+
input_mats.push_back(pyutils::wrap_np_mat(input));
85+
}
8586

86-
return self.inferBatch(input_mats);
87-
})
87+
return self.inferBatch(input_mats);
88+
})
8889
.def_prop_ro_static("__model__", [](nb::object) {
8990
return ClassificationModel::ModelType;
9091
});

src/cpp/py_bindings/py_instance_segmentation.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ void init_instance_segmentation(nb::module_& m) {
5959
return MaskRCNNModel::ModelType;
6060
});
6161

62-
6362
nb::class_<InstanceSegmentationResult, ResultBase>(m, "InstanceSegmentationResult")
64-
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(),
65-
nb::arg("frameId") = -1,
66-
nb::arg("metaData") = nullptr)
63+
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(), nb::arg("frameId") = -1, nb::arg("metaData") = nullptr)
6764
.def_prop_ro(
6865
"feature_vector",
6966
[](InstanceSegmentationResult& r) {

src/cpp/py_bindings/py_keypoint_detection.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ void init_keypoint_detection(nb::module_& m) {
5959
});
6060

6161
nb::class_<KeypointDetectionResult, ResultBase>(m, "KeypointDetectionResult")
62-
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(),
63-
nb::arg("frameId") = -1,
64-
nb::arg("metaData") = nullptr)
62+
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(), nb::arg("frameId") = -1, nb::arg("metaData") = nullptr)
6563
.def_ro("poses", &KeypointDetectionResult::poses);
6664

6765
nb::class_<DetectedKeypoints>(m, "DetectedKeypoints")

src/cpp/py_bindings/py_results.cpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/cpp/py_bindings/py_segmentation.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <nanobind/stl/unique_ptr.h>
1111
#include <nanobind/stl/vector.h>
1212

13-
#include "models/segmentation_model.h"
1413
#include "models/results.h"
14+
#include "models/segmentation_model.h"
1515
#include "py_utils.hpp"
1616

1717
namespace pyutils = vision::nanobind::utils;
@@ -40,33 +40,34 @@ void init_segmentation(nb::module_& m) {
4040
[](SegmentationModel& self, const nb::ndarray<>& input) {
4141
return self.infer(pyutils::wrap_np_mat(input));
4242
})
43-
.def("infer_batch", [](SegmentationModel& self, const std::vector<nb::ndarray<>> inputs) {
44-
std::vector<ImageInputData> input_mats;
45-
input_mats.reserve(inputs.size());
43+
.def("infer_batch",
44+
[](SegmentationModel& self, const std::vector<nb::ndarray<>> inputs) {
45+
std::vector<ImageInputData> input_mats;
46+
input_mats.reserve(inputs.size());
4647

47-
for (const auto& input : inputs) {
48-
input_mats.push_back(pyutils::wrap_np_mat(input));
49-
}
48+
for (const auto& input : inputs) {
49+
input_mats.push_back(pyutils::wrap_np_mat(input));
50+
}
5051

51-
return self.inferBatch(input_mats);
52-
})
53-
.def("postprocess", [](SegmentationModel& self, InferenceResult& infResult) {
54-
return self.postprocess(infResult);
55-
})
52+
return self.inferBatch(input_mats);
53+
})
54+
.def("postprocess",
55+
[](SegmentationModel& self, InferenceResult& infResult) {
56+
return self.postprocess(infResult);
57+
})
5658
.def_prop_ro_static("__model__", [](nb::object) {
5759
return SegmentationModel::ModelType;
5860
});
5961

6062
nb::class_<ImageResult, ResultBase>(m, "ImageResult")
61-
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(),
62-
nb::arg("frameId") = -1,
63-
nb::arg("metaData") = nullptr)
63+
.def(nb::init<int64_t, std::shared_ptr<MetaData>>(), nb::arg("frameId") = -1, nb::arg("metaData") = nullptr)
6464
.def_prop_ro(
6565
"resultImage",
6666
[](ImageResult& r) {
6767
return nb::ndarray<uint8_t, nb::numpy, nb::c_contig>(r.resultImage.data,
68-
{static_cast<size_t>(r.resultImage.rows), static_cast<size_t>(r.resultImage.cols), static_cast<size_t>(r.resultImage.channels())});
68+
{static_cast<size_t>(r.resultImage.rows),
69+
static_cast<size_t>(r.resultImage.cols),
70+
static_cast<size_t>(r.resultImage.channels())});
6971
},
70-
nb::rv_policy::reference_internal
71-
);
72+
nb::rv_policy::reference_internal);
7273
}

src/cpp/py_bindings/py_vision_api.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ void init_base_modules(nb::module_& m);
1111
void init_classification(nb::module_& m);
1212
void init_segmentation(nb::module_& m);
1313
void init_instance_segmentation(nb::module_& m);
14-
void init_keypoint_detection(nb::module_& m);
15-
14+
void init_keypoint_detection(nb::module_& m);
1615

1716
NB_MODULE(py_model_api, m) {
1817
m.doc() = "Nanobind binding for OpenVINO Vision API library";

0 commit comments

Comments
 (0)