clas_model.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2021 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. #include "model_deploy/ppclas/include/clas_model.h"
  15. namespace PaddleDeploy {
  16. bool ClasModel::YamlConfigInit(const std::string& cfg_file) {
  17. yaml_config_ = YAML::LoadFile(cfg_file);
  18. return true;
  19. }
  20. bool ClasModel::PreprocessInit() {
  21. preprocess_ = std::make_shared<ClasPreprocess>();
  22. if (!preprocess_->Init(yaml_config_)) {
  23. return false;
  24. }
  25. return true;
  26. }
  27. bool ClasModel::PostprocessInit() {
  28. postprocess_ = std::make_shared<ClasPostprocess>();
  29. if (!postprocess_->Init(yaml_config_))
  30. return false;
  31. return true;
  32. }
  33. } // namespace PaddleDeploy