diff --git a/csrc/mmdeploy/apis/python/detector.cpp b/csrc/mmdeploy/apis/python/detector.cpp index 0a5c60ce4b..645ec820fe 100644 --- a/csrc/mmdeploy/apis/python/detector.cpp +++ b/csrc/mmdeploy/apis/python/detector.cpp @@ -70,9 +70,9 @@ static void register_python_detector(py::module &m) { .def(py::init([](const char *model_path, const char *device_name, int device_id) { return std::make_unique(model_path, device_name, device_id); }), - py::arg("model_path"), py::arg("device_name"), py::arg("device_id")=0) + py::arg("model_path"), py::arg("device_name"), py::arg("device_id") = 0) .def("__call__", - [](PyDetector* self, const PyImage& img) -> py::tuple { + [](PyDetector *self, const PyImage &img) -> py::tuple { return self->Apply(std::vector{img})[0]; }) .def("batch", &PyDetector::Apply); diff --git a/csrc/mmdeploy/apis/python/pose_detector.cpp b/csrc/mmdeploy/apis/python/pose_detector.cpp index 5b5bc67f94..db76171311 100644 --- a/csrc/mmdeploy/apis/python/pose_detector.cpp +++ b/csrc/mmdeploy/apis/python/pose_detector.cpp @@ -103,20 +103,22 @@ static void register_python_pose_detector(py::module &m) { .def(py::init([](const char *model_path, const char *device_name, int device_id) { return std::make_unique(model_path, device_name, device_id); }), - py::arg("model_path"), py::arg("device_name"), py::arg("device_id")=0) + py::arg("model_path"), py::arg("device_name"), py::arg("device_id") = 0) .def("__call__", [](PyPoseDetector *self, const PyImage &img) -> py::array { return self->Apply({img}, {})[0]; }) - .def("__call__", + .def( + "__call__", [](PyPoseDetector *self, const PyImage &img, const Rect &box) -> py::array { std::vector> bboxes; bboxes.push_back({box}); return self->Apply({img}, bboxes)[0]; }, py::arg("img"), py::arg("box")) - .def("__call__", - [](PyPoseDetector *self, const PyImage &img, const std::vector &bboxes){ + .def( + "__call__", + [](PyPoseDetector *self, const PyImage &img, const std::vector &bboxes) { std::vector> _bboxes; _bboxes.push_back(bboxes); return self->Apply({img}, _bboxes);