mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
2.1 KiB
2.1 KiB
English | 中文
Example of PaddleClas models C++ Deployment
This directory provides example file multi_thread.cc
to fast deploy PaddleClas models on CPU/GPU and GPU accelerated by TensorRT.
Before deployment, two steps require confirmation.
-
- Software and hardware should meet the requirements. Please refer to FastDeploy Environment Requirements
-
- Install the FastDeploy Python whl package. Please refer to FastDeploy Python Installation
Taking ResNet50_vd inference on Linux as an example, the compilation test can be completed by executing the following command in this directory. FastDeploy version 0.7.0 or above (x.x.x>=0.7.0) is required to support this model.
mkdir build
cd build
# # Download FastDeploy precompiled library. Users can choose your appropriate version 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
# Download the ResNet50_vd model file and test images
wget https://bj.bcebos.com/paddlehub/fastdeploy/ResNet50_vd_infer.tgz
tar -xvf ResNet50_vd_infer.tgz
wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg
# CPU multi-thread inference
./multi_thread_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 0 1
# GPU multi-thread inference
./multi_thread_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 1 1
# TensorRT multi-inference inference on GPU
./multi_thread_demo ResNet50_vd_infer ILSVRC2012_val_00000010.jpeg 2 1
Notice: the last number in above command is thread number
The above command works for Linux or MacOS. For SDK in Windows, refer to:
The result returned after running is as follows
Thread Id: 0
ClassifyResult(
label_ids: 153,
scores: 0.686229,
)