mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 17:41:52 +08:00
[CVCUDA] PaddleDetection preprocessor support CV-CUDA (#1493)
* ppdet preproc use manager * pad_to_size chw opencv * pad_to_size chw flycv * fix pad_to_size flycv * add warning message * cvcuda convert cubic to linear, padToSize cvcuda * stridedpad cvcuda * fix flycv include * fix flycv include * fix flycv build * cast cvcuda * fix pybind * fix normalize permute cuda * base processor move funcs to cc * Update pad_to_size.cc
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
#include "fastdeploy/vision/common/processors/manager.h"
|
||||
#include "fastdeploy/vision/common/processors/transform.h"
|
||||
#include "fastdeploy/vision/common/result.h"
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace vision {
|
||||
namespace detection {
|
||||
/*! @brief Preprocessor object for PaddleDet serials model.
|
||||
*/
|
||||
class FASTDEPLOY_DECL PaddleDetPreprocessor {
|
||||
class FASTDEPLOY_DECL PaddleDetPreprocessor : public ProcessorManager {
|
||||
public:
|
||||
PaddleDetPreprocessor() = default;
|
||||
/** \brief Create a preprocessor instance for PaddleDet serials model
|
||||
@@ -31,13 +32,16 @@ class FASTDEPLOY_DECL PaddleDetPreprocessor {
|
||||
*/
|
||||
explicit PaddleDetPreprocessor(const std::string& config_file);
|
||||
|
||||
/** \brief Process the input image and prepare input tensors for runtime
|
||||
/** \brief Implement the virtual function of ProcessorManager, Apply() is the
|
||||
* body of Run(). Apply() contains the main logic of preprocessing, Run() is
|
||||
* called by users to execute preprocessing
|
||||
*
|
||||
* \param[in] images The input image data list, all the elements are returned by cv::imread()
|
||||
* \param[in] outputs The output tensors which will feed in runtime, include image, scale_factor, im_shape
|
||||
* \param[in] image_batch The input image batch
|
||||
* \param[in] outputs The output tensors which will feed in runtime
|
||||
* \return true if the preprocess successed, otherwise false
|
||||
*/
|
||||
bool Run(std::vector<FDMat>* images, std::vector<FDTensor>* outputs);
|
||||
virtual bool Apply(FDMatBatch* image_batch,
|
||||
std::vector<FDTensor>* outputs);
|
||||
|
||||
/// This function will disable normalize in preprocessing step.
|
||||
void DisableNormalize();
|
||||
@@ -51,6 +55,8 @@ class FASTDEPLOY_DECL PaddleDetPreprocessor {
|
||||
private:
|
||||
bool BuildPreprocessPipelineFromConfig();
|
||||
std::vector<std::shared_ptr<Processor>> processors_;
|
||||
std::shared_ptr<PadToSize> pad_op_ =
|
||||
std::make_shared<PadToSize>(0, 0, std::vector<float>(3, 0));
|
||||
bool initialized_ = false;
|
||||
// for recording the switch of hwc2chw
|
||||
bool disable_permute_ = false;
|
||||
|
Reference in New Issue
Block a user