Files
FastDeploy/examples/vision/perception/paddle3d/petr/cpp
CoolCola e3b285c762 [Model] Support Paddle3D PETR v2 model (#1863)
* Support PETR v2

* make petrv2 precision equal with the origin repo

* delete extra func

* modify review problem

* delete visualize

* Update README_CN.md

* Update README.md

* Update README_CN.md

* fix build problem

* delete external variable and function

---------

Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
2023-05-19 10:45:36 +08:00
..

English | 简体中文

Petr C++ Deployment Example

This directory provides an example of infer.cc to quickly complete the deployment of Petr on CPU/GPU.

Before deployment, the following two steps need to be confirmed

Taking CPU inference on Linux as an example, execute the following command in this directory to complete the compilation test. To support this model, you need to ensure FastDeploy version 1.0.6 or higher (x.x.x>=1.0.6)

mkdir build
cd build
# Download the FastDeploy precompiled library, users can choose the appropriate version to use in the `FastDeploy precompiled library` mentioned above
wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-x.x.x.tgz
tar xvf fastdeploy-linux-x64-x.x.x.tgz
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-x.x.x
make -j

wget https://bj.bcebos.com/fastdeploy/models/petr.tar.gz
tar -xf petr.tar.gz
wget https://bj.bcebos.com/fastdeploy/models/petr_test.png

# CPU
./infer_demo petr petr_test.png 0
# GPU
./infer_demo petr petr_test.png 1

The above commands are only applicable to Linux or MacOS. For the usage of SDK under Windows, please refer to:

Petr C++ interface

Class Petr

fastdeploy::vision::perception::Petr(
        const string& model_file,
        const string& params_file,
        const string& config_file,
        const RuntimeOption& runtime_option = RuntimeOption(),
        const ModelFormat& model_format = ModelFormat::PADDLE)

Petr model loading and initialization.

parameter

  • model_file(str): model file path
  • params_file(str): parameter file path
  • config_file(str): configuration file path
  • runtime_option(RuntimeOption): Backend reasoning configuration, the default is None, that is, the default configuration is used
  • model_format(ModelFormat): model format, the default is Paddle format

Predict function

Petr::Predict(cv::Mat* im, PerceptionResult* result)

Model prediction interface, the input image directly outputs the detection result.

parameters

  • im: input image, note that it must be in HWC, BGR format
  • result: Detection result, including the detection frame, the confidence of each frame, PerceptionResult description reference [visual model prediction results](../../../../../docs/api /vision_results/)