preprocessor.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "ultra_infer/vision/common/processors/manager.h"
  16. #include "ultra_infer/vision/common/processors/transform.h"
  17. #include "ultra_infer/vision/common/result.h"
  18. namespace ultra_infer {
  19. namespace vision {
  20. namespace perception {
  21. /*! @brief Preprocessor object for Centerpoint model.
  22. */
  23. class ULTRAINFER_DECL CenterpointPreprocessor : public ProcessorManager {
  24. public:
  25. CenterpointPreprocessor() = default;
  26. /** \brief Create a preprocessor instance for Centerpoint model
  27. *
  28. * \param[in] config_file Path of configuration file for deployment, e.g
  29. * Centerpoint/infer_cfg.yml
  30. */
  31. explicit CenterpointPreprocessor(const std::string &config_file);
  32. bool Apply(FDMatBatch *image_batch, std::vector<FDTensor> *outputs) {
  33. return false;
  34. }
  35. bool Apply(std::vector<std::string> &points_dir, const int64_t num_point_dim,
  36. const int with_timelag, std::vector<FDTensor> &outputs);
  37. bool Run(std::vector<std::string> &points_dir, const int64_t num_point_dim,
  38. const int with_timelag, std::vector<FDTensor> &outputs);
  39. protected:
  40. std::vector<std::shared_ptr<Processor>> processors_;
  41. bool ReadPoint(const std::string &file_path, const int64_t num_point_dim,
  42. std::vector<float> &data, int64_t *num_points);
  43. bool InsertTimeToPoints(const int64_t num_points, const int64_t num_point_dim,
  44. float *points);
  45. bool initialized_ = false;
  46. };
  47. } // namespace perception
  48. } // namespace vision
  49. } // namespace ultra_infer