// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "fastdeploy/pybind/main.h" namespace fastdeploy { void BindCenterpoint(pybind11::module& m) { pybind11::class_(m, "CenterpointPreprocessor") .def(pybind11::init()) .def("run", [](vision::perception::CenterpointPreprocessor& self, std::vector points_dir, const int64_t num_point_dim, const int with_timelag) { std::vector outputs; if (!self.Run(points_dir, num_point_dim, with_timelag, outputs)) { throw std::runtime_error( "Failed to preprocess the input data in " "CenterpointPreprocessor."); } return outputs; }); pybind11::class_( m, "Centerpoint") .def(pybind11::init()) .def("predict", [](vision::perception::Centerpoint& self, std::string point_dir) { vision::PerceptionResult result; self.Predict(point_dir, &result); return result; }) .def("batch_predict", [](vision::perception::Centerpoint& self, std::vector& points_dir) { std::vector results; self.BatchPredict(points_dir, &results); return results; }) .def_property_readonly("preprocessor", &vision::perception::Centerpoint::GetPreprocessor) .def_property_readonly( "postprocessor", &vision::perception::Centerpoint::GetPostprocessor); } } // namespace fastdeploy