Comments (2)
cache反序列化问题已经修复。另外经排查,用户的测试代码中指针的用法会导致无法预测,需要进行修改。
#include "fastdeploy/vision.h"
void TrtInfer(const std::string& model_file, const std::string& image_file) {
struct fastdeploy::RuntimeOption roi_option;
fastdeploy::vision::detection::YOLOv7End2EndTRT* model;
roi_option.UseGpu();
roi_option.UseTrtBackend();
roi_option.SetTrtInputShape("images", { 1, 3, 640, 640 });
roi_option.EnableTrtFP16();
roi_option.SetTrtCacheFile("yolo_end2end.cache");
// model =
// &fastdeploy::vision::detection::YOLOv7End2EndTRT(model_file, "", roi_option);
// 这行指针赋值代码用法修改成以下这句
model = new fastdeploy::vision::detection::YOLOv7End2EndTRT(model_file, "", roi_option);
if (!model->Initialized()) {
std::cerr << "Failed to initialize." << std::endl;
return;
}
auto im = cv::imread(image_file);
fastdeploy::vision::DetectionResult res;
if (!model->Predict(&im, &res)) {
std::cerr << "Failed to predict." << std::endl;
return;
}
std::cout << res.Str() << std::endl;
delete model;
}
int main() {
TrtInfer("yolov7-end2end-trt-nms.onnx", "000000014439.jpg");
return 0;
}
首次运行会保存cache文件,log如下
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(416)::fastdeploy::TrtBackend::BuildTrtEngine Start to building TensorRT Engine...
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(488)::fastdeploy::TrtBackend::BuildTrtEngine TensorRT Engine is built succussfully.
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(490)::fastdeploy::TrtBackend::BuildTrtEngine Serialize TensorRTEngine to local file yolo_end2end.cache.
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(501)::fastdeploy::TrtBackend::BuildTrtEngine TensorRTEngine is serialized to local file yolo_end2end.cache, we can load this model from the seralized engine directly next time.
[INFO] fastdeploy/runtime.cc(289)::fastdeploy::Runtime::Init Runtime initialized with Backend::TRT in Device::GPU.
第二次及之后运行,直接从cache中加载,加快初始化
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(541)::fastdeploy::TrtBackend::CreateTrtEngineFromOnnx Detect serialized TensorRT Engine file in yolo_end2end.cache, will load it directly.
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(106)::fastdeploy::TrtBackend::LoadTrtCache Build TensorRT Engine from cache file: yolo_end2end.cache with shape range information as below,
[INFO] fastdeploy/backends/tensorrt/trt_backend.cc(109)::fastdeploy::TrtBackend::LoadTrtCache Input name: images, shape=[1, 3, 640, 640], min=[1, 3, 640, 640], max=[1, 3, 640, 640]
[INFO] fastdeploy/runtime.cc(289)::fastdeploy::Runtime::Init Runtime initialized with Backend::TRT in Device::GPU.
from fastdeploy.
此外,检查了trt_backend.cc文件,之前的pull #274 已被合并。
from fastdeploy.
Related Issues (20)
- could not create a primitive descriptor for a reorder primitive HOT 1
- 升级ppdiffusers 使用paddle_tensorrt后端报错 HOT 1
- 编译FastDeploy/examples/vision/facedet/scrfd/cpp报错 HOT 1
- FastDeploy yolov5 batch推理 HOT 2
- Fastdeploy交叉编译过程中出现的libpaddle_full_api_shared.so: file not recognized: File format not recognized collect2: error: ld returned 1 exit status错误?
- Fastdeploy支持Debug模式了吗? HOT 2
- fastdeploy OCR Atlas300i Pro 支持310p-npu-driver_23.0.rc3高版本不? HOT 1
- Ascend执行OCR推理失败,报环境不支持。 HOT 2
- Support for RKYolov6 for RKNPU2 inference HOT 1
- Fastdeploy在JetsonNano上,通过TensorRT调用picodet,内存占用过高问题。 HOT 1
- FastDeploy部署 examples/vision/detection/paddledetection/python/infer_mask_rcnn.py运行官方给出的模型可以推理,自己训练的模型推理报错
- PPYOLOE TRT 批量推理,当输入尺寸小于224时结果异常 HOT 2
- ppyolo无法再arm中部署
- 在rk3588上部署paddleOCR HOT 1
- 多分类跟踪模型加载 HOT 4
- Paddle2ONNX 不支持conv3d_transpose运算符导出 HOT 3
- ppyoloe sod模型支持切图拼图操作吗? HOT 1
- C_api Detcction batchPredict 问题 HOT 1
- 想知道是否支持FastDeploy 部署serving 的 表格识别模型,目前没看到有相关文档 HOT 1
- 本地使用pytorch的yolov5模型跑出来的识别效果要远好于在fastdeploy部署后跑出来的效果 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastdeploy.