当前位置: 首页 > news >正文

【2023-2-23】FastDeploy 安装教程

【2023-2-22】FastDeploy 安装编译教程

该测试 FastDeploy CPU版本。

在这里插入图片描述

1. fastDeploy库编译

1.1 官方预编译库下载

预编译库下载安装

1.2 自定义CPU版本库编译

  • 官方编译FastDeploy教程

CMakeGUI + VS 2019 IDE编译FastDeploy

  • 本人编译教程
  1. CMAKE_CONFIGURATION_TYPES 属性设置为Release

  2. 请不要勾选WITH_GPUENABLE_TRT_BACKEND

  3. 开启ENABLE_PADDLE_BACKEND ENABLE_OPENVINO_BACKEND ENABLE_VISION

  4. 指定CMAKE_INSTALL_PREFIX 安装路径

  5. 生成fastdeploy.sln解决方案文件选择Release版本,生成编译,点击"INSTALL"->右键点击"生成"将编译好的SDK安装到先前指定的目录步骤⑤。
    在这里插入图片描述
    在这里插入图片描述

1.3 自定义GPU版本库编译

  • 官方编译FastDeploy教程

CMakeGUI + VS 2019 IDE编译FastDeploy

  • 本人编译教程
  1. CMAKE_CONFIGURATION_TYPES 属性设置为Release

  2. 勾选WITH_GPUENABLE_TRT_BACKEND

  3. 开启ENABLE_ORT_BACKEND ENABLE_PADDLE_BACKEND ENABLE_TRT_BACKEND ENABLE_OPENVINO_BACKEND ENABLE_VISION ENABLE_TEXT

  4. 设置CUDA TensorRT路径

CUDA_DIRECTORY            : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2
TRT_DRECTORY              : D:/Program Files/TensorRT-8.4.3.1
  1. 指定CMAKE_INSTALL_PREFIX 安装路径

  2. 生成fastdeploy.sln解决方案文件选择Release版本,生成编译,点击"INSTALL"->右键点击"生成"将编译好的SDK安装到先前指定的目录步骤⑤。
    请添加图片描述
    请添加图片描述

1.4 样例测试

picodet_l_320_coco_lcnet 模型下载

/** @Description: * @Version: 0.0.1* @Author: chccc* @Date: 2023-02-19 00:19:22* @LastEditors: chccc* @LastEditTime: 2023-02-20 17:23:21* @FilePath: \cpp\infer.cpp*/
#include <iostream>
#include "fastdeploy/vision.h"void PicoDetGpuInfer(const std::string& model_dir, const std::string& image_file)
{std::string model_file = "picodet_l_320_coco_lcnet/model.pdmodel";std::string params_file ="picodet_l_320_coco_lcnet/model.pdiparams";std::string config_file ="picodet_l_320_coco_lcnet/infer_cfg.yml";;auto option = fastdeploy::RuntimeOption();option.UseGpu(0);fastdeploy::vision::detection::PicoDet model = fastdeploy::vision::detection::PicoDet(model_file, params_file, config_file, option);std::cout<<typeid(model).name()<<std::endl;if (!model.Initialized()) {printf("[%s][%d] Error: fastdeploy::vision::detection::PicoDet initialized failed !\n", __func__, __LINE__);return;}auto im = cv::imread(image_file);auto im_bak = im.clone();auto start = std::chrono::system_clock::now();fastdeploy::vision::DetectionResult result;if (!model.Predict(&im, &result)) {printf("[%s][%d] Error: Failed to predict !\n", __func__, __LINE__);return;}//std::cout << res.Str() << std::endl;auto end = std::chrono::system_clock::now();auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);double costTime = double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;//printf("[%s][%d] model.Predict success, cost time: %lf s \n", __func__, __LINE__, costTime);std::cout << "==========================================================================" << std::endl;float score_thereshold = 0.8;int line_size = 2;float font_size = 1;auto vis_image = fastdeploy::vision::Visualize::VisDetection(im_bak, result, score_thereshold, line_size, font_size);std::string vis_image_path = "./images/vis_result.jpg";cv::imwrite(vis_image_path, vis_image);printf("[%s][%d] Visualized result saved in %s !\n", __func__, __LINE__, vis_image_path.c_str());
}int main()
{std::cout << "=============== TEST ===============" << std::endl;std::string model_dir = "./models/";;std::string image_file = "./images/1.jpg";//计时auto start = std::chrono::system_clock::now();PicoDetGpuInfer(model_dir, image_file);//计时auto end = std::chrono::system_clock::now();auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);double costTime = double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den;printf("[%s][%d] Model infer success, cost time: %lf s \n", __func__, __LINE__, costTime);std::cout << "=============== Finished ===============" << std::endl;
}

在这里插入图片描述

http://www.lryc.cn/news/18013.html

相关文章:

  • rollup.js 一个简单实用的打包工具
  • 数据结构与算法之最小爬楼梯费用动态规划
  • 阿里云ACA认证如何获取?
  • 【Python入门第十六天】Python If ... Else
  • 两数之和的解法
  • 领导催我优化SQL语句,我求助了ChatGPT。这是ChatGPT给出的建议,你们觉得靠谱吗
  • ArcGIS手动分割矢量面要素从而划分为多个面部分的方式:Cut Polygons Tool
  • 【LeetCode】剑指 Offer 13. 机器人的运动范围 p92 -- Java Version
  • [oeasy]python0091_仙童公司_八叛逆_intel_8080_altair8800_牛郎星
  • crontab 执行脚本报错,手动执行脚本正常的解决方法
  • 扎心话题 | 设计院背后的潜规则你知道吗?
  • 【JavaEE初阶】第二节.多线程( 进阶篇 ) 锁的优化、JUC的常用类、线程安全的集合类
  • 大数据核心技术是什么
  • 「TCG 规范解读」初识 TPM 2.0 库续一
  • task与function
  • Android 基础知识4-3.1 TextView(文本框)详解
  • 点击化学 PEG 试剂1858242-47-3,Propargyl丙炔基-PEG1-乙酸活性酯
  • 正则表达式是如何运作的?
  • JVM参数GC线程数ParallelGCThreads设置
  • java 线程的那些事
  • 如何利用 Python 进行客户分群分析(附源码)
  • D1s RDC2022纪念版开发板开箱评测及点屏教程
  • 了解一下TCP/IP协议族
  • 【第十九部分】存储过程与存储函数
  • 字节序
  • PDF文件怎么转图片格式?转换有技巧
  • 筑基七层 —— 数据在内存中的存储?拿来吧你
  • Typecho COS插件实现网站静态资源存储到COS,降低本地存储负载
  • 2月23号作业
  • 因果推断方法(一)合成控制