Files
FastDeploy/fastdeploy/vision/classification/ppshitu/ppshituv2_rec_postprocessor.h
DefTruth 77cb9db6da [Model] Support PP-ShiTuV2 models for PaddleClas (#1900)
* [cmake] add faiss.cmake -> pp-shituv2

* [PP-ShiTuV2] Support PP-ShituV2-Det model

* [PP-ShiTuV2] Support PP-ShiTuV2-Det model

* [PP-ShiTuV2] Add PPShiTuV2Recognizer c++&python support

* [PP-ShiTuV2] Add PPShiTuV2Recognizer c++&python support

* [Bug Fix] fix ppshitu_pybind error

* [benchmark] Add ppshituv2-det c++ benchmark

* [examples] Add PP-ShiTuV2 det & rec examples

* [vision] Update vision classification result

* [Bug Fix] fix trt shapes setting errors
2023-05-08 14:04:09 +08:00

50 lines
1.8 KiB
C++

// Copyright (c) 2023 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.
#pragma once
#include "fastdeploy/vision/common/processors/transform.h"
#include "fastdeploy/vision/common/result.h"
namespace fastdeploy {
namespace vision {
namespace classification {
/*! @brief Postprocessor object for PP-ShiTuV2 Recognizer model.
*/
class FASTDEPLOY_DECL PPShiTuV2RecognizerPostprocessor {
public:
PPShiTuV2RecognizerPostprocessor() = default;
/** \brief Process the result of runtime and fill to ClassifyResult structure
*
* \param[in] tensors The inference result from runtime
* \param[in] result The output result of feature vector (see ClassifyResult.feature member)
* \return true if the postprocess successed, otherwise false
*/
bool Run(const std::vector<FDTensor>& tensors,
std::vector<ClassifyResult>* results);
/// Set the value of feature_norm_ for Postprocessor
void SetFeatureNorm(bool feature_norm) { feature_norm_ = feature_norm; }
/// Get the value of feature_norm_ from Postprocessor, default to true.
bool GetFeatureNorm() { return feature_norm_; }
private:
void FeatureNorm(std::vector<float> &feature);
bool feature_norm_ = true;
};
} // namespace classification
} // namespace vision
} // namespace fastdeploy