diff --git a/model_zoo/official/cv/dpn/infer/mxbase/src/DPN.h b/model_zoo/official/cv/dpn/infer/mxbase/src/DPN.h index 1ac231dff09..af4caab77c1 100644 --- a/model_zoo/official/cv/dpn/infer/mxbase/src/DPN.h +++ b/model_zoo/official/cv/dpn/infer/mxbase/src/DPN.h @@ -1,9 +1,4 @@ -/* - * Copyright (c) 2021. Huawei Technologies Co., Ltd. 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 +* You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * @@ -16,12 +11,11 @@ #ifndef MXBASE_DPN_H #define MXBASE_DPN_H -#include -#include -#include #include + #include "MxBase/DvppWrapper/DvppWrapper.h" #include "MxBase/ModelInfer/ModelInferenceProcessor.h" +// #include "ClassPostProcessors/DPN92PostProcess.h" #include "ClassPostProcessors/Resnet50PostProcess.h" #include "MxBase/Tensor/TensorContext/TensorContext.h" @@ -36,32 +30,31 @@ struct InitParam { }; class DPN { - public: - APP_ERROR Init(const InitParam &initParam); - APP_ERROR DeInit(); - APP_ERROR ReadImage(const std::string &imgPath, const cv::Mat &imageMat); - APP_ERROR ResizeImage(const cv::Mat &srcImageMat, const cv::Mat &dstImageMat); - APP_ERROR CenterCropImage(const cv::Mat &img, const cv::Mat &crop_im); - APP_ERROR CVMatToTensorBase(const cv::Mat &imageMat, const MxBase::TensorBase &tensorBase); - APP_ERROR Inference(const std::vector &inputs, const std::vector &outputs); - APP_ERROR PostProcess(const std::vector &inputs, - const std::vector> &clsInfos); - APP_ERROR Process(const std::vector &batchImgPaths); - // get infer time - double GetInferCostMilliSec() const {return inferCostTimeMilliSec;} + public: + APP_ERROR Init(const InitParam &initParam); + APP_ERROR DeInit(); + APP_ERROR ReadImage(const std::string &imgPath, cv::Mat &imageMat); + APP_ERROR ResizeImage(const cv::Mat &srcImageMat, cv::Mat &dstImageMat); + APP_ERROR CenterCropImage(const cv::Mat &img, cv::Mat &crop_im); + APP_ERROR CVMatToTensorBase(const cv::Mat &imageMat, MxBase::TensorBase &tensorBase); + APP_ERROR Inference(const std::vector &inputs, std::vector &outputs); + APP_ERROR PostProcess(const std::vector &inputs, + std::vector> &clsInfos); + APP_ERROR Process(const std::vector &batchImgPaths); + // get infer time + double GetInferCostMilliSec() const {return inferCostTimeMilliSec;} - private: - APP_ERROR SaveResult(const std::vector &batchImgPaths, - const std::vector> &batchClsInfos); - - private: - std::shared_ptr dvppWrapper_; - std::shared_ptr model_; - std::shared_ptr post_; - MxBase::ModelDesc modelDesc_; - uint32_t deviceId_ = 0; - // infer time - double inferCostTimeMilliSec = 0.0; + private: + APP_ERROR SaveResult(const std::vector &batchImgPaths, const std::vector> &batchClsInfos); + private: + std::shared_ptr dvppWrapper_; + std::shared_ptr model_; + std::shared_ptr post_; + MxBase::ModelDesc modelDesc_; + uint32_t deviceId_ = 0; + // infer time + double inferCostTimeMilliSec = 0.0; }; + #endif diff --git a/model_zoo/official/cv/dpn/infer/mxbase/src/main.cpp b/model_zoo/official/cv/dpn/infer/mxbase/src/main.cpp index 74644487c3b..c1c96a0a080 100644 --- a/model_zoo/official/cv/dpn/infer/mxbase/src/main.cpp +++ b/model_zoo/official/cv/dpn/infer/mxbase/src/main.cpp @@ -23,7 +23,7 @@ namespace { const uint32_t BATCH_SIZE = 32; } // namespace -APP_ERROR ScanImages(const std::string &path, const std::vector &imgFiles) { +APP_ERROR ScanImages(const std::string &path, std::vector &imgFiles) { DIR *dirPtr = opendir(path.c_str()); if (dirPtr == nullptr) { LogError << "opendir failed. dir:" << path;