mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-14 04:44:00 +08:00
修复C++ Inference Example中的demo存在的错误 (#290)
修复C++ Inference Example中的demo存在的错误: * 少了一个分号,程序无法运行 * 没有进行BGR转RGB工作,导致图片颜色通道出现错误
This commit is contained in:
@@ -131,18 +131,20 @@ wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/0000000
|
|||||||
// GPU/TensorRT部署参考 examples/vision/detection/paddledetection/cpp
|
// GPU/TensorRT部署参考 examples/vision/detection/paddledetection/cpp
|
||||||
#include "fastdeploy/vision.h"
|
#include "fastdeploy/vision.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
namespace vision = fastdeploy::vision;
|
namespace vision = fastdeploy::vision;
|
||||||
auto model = vision::detection::PPYOLOE("ppyoloe_crn_l_300e_coco/model.pdmodel",
|
auto model = vision::detection::PPYOLOE("ppyoloe_crn_l_300e_coco/model.pdmodel",
|
||||||
"ppyoloe_crn_l_300e_coco/model.pdiparams",
|
"ppyoloe_crn_l_300e_coco/model.pdiparams",
|
||||||
"ppyoloe_crn_l_300e_coco/infer_cfg.yml");
|
"ppyoloe_crn_l_300e_coco/infer_cfg.yml");
|
||||||
auto im = cv::imread("000000014439.jpg");
|
auto im = cv::imread("000000014439.jpg");
|
||||||
|
cv::cvtColor(im,im,cv::COLOR_BGR2RGB);
|
||||||
vision::DetectionResult res;
|
vision::DetectionResult res;
|
||||||
model.Predict(&im, &res)
|
model.Predict(&im, &res);
|
||||||
|
|
||||||
auto vis_im = vision::Visualize::VisDetection(im, res, 0.5);
|
auto vis_im = vision::Visualize::VisDetection(im, res, 0.5);
|
||||||
cv::imwrite("vis_image.jpg", vis_im);
|
cv::imwrite("vis_image.jpg", vis_im);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
10
README_EN.md
10
README_EN.md
@@ -140,19 +140,21 @@ wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/0000000
|
|||||||
// For GPU/TensorRT deployment, please refer to examples/vision/detection/paddledetection/cpp
|
// For GPU/TensorRT deployment, please refer to examples/vision/detection/paddledetection/cpp
|
||||||
#include "fastdeploy/vision.h"
|
#include "fastdeploy/vision.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
namespace vision = fastdeploy::vision;
|
namespace vision = fastdeploy::vision;
|
||||||
auto model = vision::detection::PPYOLOE("ppyoloe_crn_l_300e_coco/model.pdmodel",
|
auto model = vision::detection::PPYOLOE("ppyoloe_crn_l_300e_coco/model.pdmodel",
|
||||||
"ppyoloe_crn_l_300e_coco/model.pdiparams",
|
"ppyoloe_crn_l_300e_coco/model.pdiparams",
|
||||||
"ppyoloe_crn_l_300e_coco/infer_cfg.yml");
|
"ppyoloe_crn_l_300e_coco/infer_cfg.yml");
|
||||||
auto im = cv::imread("000000014439.jpg");
|
auto im = cv::imread("000000014439.jpg");
|
||||||
|
cv::cvtColor(im,im,cv::COLOR_BGR2RGB);
|
||||||
vision::DetectionResult res;
|
vision::DetectionResult res;
|
||||||
model.Predict(&im, &res)
|
model.Predict(&im, &res);
|
||||||
|
|
||||||
auto vis_im = vision::Visualize::VisDetection(im, res, 0.5);
|
auto vis_im = vision::Visualize::VisDetection(im, res, 0.5);
|
||||||
cv::imwrite("vis_image.jpg", vis_im);
|
cv::imwrite("vis_image.jpg", vis_im);
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### For more deployment models, please refer to [Vision Model Deployment Examples](examples/vision) .
|
### For more deployment models, please refer to [Vision Model Deployment Examples](examples/vision) .
|
||||||
|
Reference in New Issue
Block a user