国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

FastDeploy:PaddleSeg C++部署方式(一)

這篇具有很好參考價(jià)值的文章主要介紹了FastDeploy:PaddleSeg C++部署方式(一)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

目錄

1.FastDeploy介紹

2. 通過FastDeploy C++ 部署PaddleSeg模型

1.FastDeploy介紹

??FastDeploy是一款全場(chǎng)景、易用靈活、極致高效的AI推理部署工具, 支持云邊端部署。提供超過???160+?TextVision,?Speech跨模態(tài)模型??開箱即用的部署體驗(yàn),并實(shí)現(xiàn)??端到端的推理性能優(yōu)化,滿足開發(fā)者多場(chǎng)景、多硬件、多平臺(tái)的產(chǎn)業(yè)部署需求。

FastDeploy:PaddleSeg C++部署方式(一)

近期更新

  • FastDeploy系列直播課程回放

  • 2023.01.17?發(fā)布?YOLOv8?在FastDeploy系列硬件的部署支持。 其中包括?Paddle YOLOv8?以及?社區(qū) ultralytics YOLOv8

    • Paddle YOLOv8?可以部署的硬件:Intel CPU、NVIDIA GPU、Jetson、飛騰、昆侖芯、昇騰、ARM CPU、RK3588?和?Sophgo TPU, 部分硬件包含?Python?部署和?C++?部署;
    • 社區(qū) ultralytics YOLOv8?可以部署的硬件:Intel CPU、NVIDIA GPU、Jetson,均包含?Python?部署和?C++?部署;
    • FastDeploy 一行模型API切換,可以實(shí)現(xiàn)YOLOv8、?PP-YOLOE+、YOLOv5?等模型性能對(duì)比。
  • 服務(wù)化部署結(jié)合VisualDL新增支持可視化部署。在FastDeploy容器中啟動(dòng)VDL服務(wù)后,即可在VDL界面修改模型配置、啟動(dòng)/管理模型服務(wù)、查看性能數(shù)據(jù)、發(fā)送請(qǐng)求等,詳細(xì)操作可參考相關(guān)文檔

    • Serving可視化部署
    • Serving可視化請(qǐng)求

????????使用FastDeploy可以簡(jiǎn)單高效的在X86 CPU、NVIDIA GPU、飛騰CPU、ARM CPU、Intel GPU、昆侖、昇騰、瑞芯微、晶晨、算能等10+款硬件上對(duì)PaddleSeg語義分割模型進(jìn)行快速部署,并且支持Paddle Inference、Paddle Lite、TensorRT、OpenVINO、ONNXRuntime、RKNPU2、SOPHGO等多種推理后端。

FastDeploy:PaddleSeg C++部署方式(一)

2. 通過FastDeploy C++ 部署PaddleSeg模型

支持PaddleSeg高于2.6版本的Segmentation模型,如果部署的為PP-Matting、PP-HumanMatting以及ModNet請(qǐng)參考Matting模型部署。目前FastDeploy測(cè)試過成功部署的模型:

  • U-Net系列模型
  • PP-LiteSeg系列模型
  • PP-HumanSeg系列模型
  • FCN系列模型
  • DeepLabV3系列模型
  • SegFormer系列模型

支持CpuInfer、GpuInfer、TrtInfer三種推理模式

// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "fastdeploy/vision.h"

#ifdef WIN32
const char sep = '\\';
#else
const char sep = '/';
#endif

void CpuInfer(const std::string& model_dir, const std::string& image_file) {
  auto model_file = model_dir + sep + "model.pdmodel";
  auto params_file = model_dir + sep + "model.pdiparams";
  auto config_file = model_dir + sep + "deploy.yaml";
  auto option = fastdeploy::RuntimeOption();
  option.UseCpu();
  auto model = fastdeploy::vision::segmentation::PaddleSegModel(
      model_file, params_file, config_file, option);

  if (!model.Initialized()) {
    std::cerr << "Failed to initialize." << std::endl;
    return;
  }

  auto im = cv::imread(image_file);

  fastdeploy::vision::SegmentationResult res;
  if (!model.Predict(im, &res)) {
    std::cerr << "Failed to predict." << std::endl;
    return;
  }

  std::cout << res.Str() << std::endl;
  auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5);
  cv::imwrite("vis_result.jpg", vis_im);
  std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl;
}

void GpuInfer(const std::string& model_dir, const std::string& image_file) {
  auto model_file = model_dir + sep + "model.pdmodel";
  auto params_file = model_dir + sep + "model.pdiparams";
  auto config_file = model_dir + sep + "deploy.yaml";

  auto option = fastdeploy::RuntimeOption();
  option.UseGpu();
  auto model = fastdeploy::vision::segmentation::PaddleSegModel(
      model_file, params_file, config_file, option);

  if (!model.Initialized()) {
    std::cerr << "Failed to initialize." << std::endl;
    return;
  }

  auto im = cv::imread(image_file);

  fastdeploy::vision::SegmentationResult res;
  if (!model.Predict(im, &res)) {
    std::cerr << "Failed to predict." << std::endl;
    return;
  }

  std::cout << res.Str() << std::endl;
  auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5);
  cv::imwrite("vis_result.jpg", vis_im);
  std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl;
}

void TrtInfer(const std::string& model_dir, const std::string& image_file) {
  auto model_file = model_dir + sep + "model.pdmodel";
  auto params_file = model_dir + sep + "model.pdiparams";
  auto config_file = model_dir + sep + "deploy.yaml";

  auto option = fastdeploy::RuntimeOption();
  option.UseGpu();
  option.UseTrtBackend();
  // If use original Tensorrt, not Paddle-TensorRT,
  // comment the following two lines
  option.EnablePaddleToTrt();
  option.EnablePaddleTrtCollectShape();
  option.SetTrtInputShape("x", {1, 3, 256, 256}, {1, 3, 1024, 1024},
                          {1, 3, 2048, 2048});

  auto model = fastdeploy::vision::segmentation::PaddleSegModel(
      model_file, params_file, config_file, option);

  if (!model.Initialized()) {
    std::cerr << "Failed to initialize." << std::endl;
    return;
  }

  auto im = cv::imread(image_file);

  fastdeploy::vision::SegmentationResult res;
  if (!model.Predict(im, &res)) {
    std::cerr << "Failed to predict." << std::endl;
    return;
  }

  std::cout << res.Str() << std::endl;
  auto vis_im = fastdeploy::vision::VisSegmentation(im, res, 0.5);
  
  cv::imwrite("vis_result.jpg", vis_im);
  std::cout << "Visualized result saved in ./vis_result.jpg" << std::endl;
}

int main(int argc, char* argv[]) {
    std::string model_dir = "model\\PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer";
   std::string image_file = "model\\cityscapes_demo.png";

 
  // CpuInfer(argv[1], argv[2]);

   GpuInfer(model_dir, image_file);

 //  TrtInfer(argv[1], argv[2]);
  
  return 0;
}

推理結(jié)果可視化:

FastDeploy:PaddleSeg C++部署方式(一)

FastDeploy:PaddleSeg C++部署方式(一)文章來源地址http://www.zghlxwxcb.cn/news/detail-414932.html

到了這里,關(guān)于FastDeploy:PaddleSeg C++部署方式(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • PaddleOCR 使用 FastDeploy 服務(wù)化部署及postman、java調(diào)用服務(wù)的方法

    PaddleOCR 使用 FastDeploy 服務(wù)化部署及postman、java調(diào)用服務(wù)的方法

    目錄 服務(wù)化部署 postman調(diào)用 java調(diào)用 題外話 部署這塊大部分按著官方文檔來做就差不多 PaddleOCR/deploy/fastdeploy/serving/fastdeploy_serving at dygraph · PaddlePaddle/PaddleOCR · GitHub 提一下兩個(gè)需要注意的點(diǎn)。 一、如果跟我一樣選擇的是cpu的版本,那么修改config.pbtxt配置文件時(shí)不僅得按官方

    2024年02月08日
    瀏覽(23)
  • PaddleSeg學(xué)習(xí)4——paddle模型使用TensorRT推理(c++)

    PaddleSeg學(xué)習(xí)4——paddle模型使用TensorRT推理(c++)

    前文 PaddleSeg c++部署OCRNet+HRNet模型中的語義分割模型輸出為 float32 類型,模型不含softmax和argmax處理,導(dǎo)致在項(xiàng)目應(yīng)用過程中后處理耗時(shí)較高。 通過PaddleSeg/tools/export.py在網(wǎng)絡(luò)末端增加softmax和argmax算子,解決應(yīng)用中的后處理耗時(shí)問題。 參考文檔PaddleSeg/docs/model_export_cn.md導(dǎo)出預(yù)測(cè)

    2024年01月16日
    瀏覽(21)
  • 使用FastDeploy在英特爾CPU和獨(dú)立顯卡上端到端高效部署AI模型

    使用FastDeploy在英特爾CPU和獨(dú)立顯卡上端到端高效部署AI模型

    目錄 1.1?產(chǎn)業(yè)實(shí)踐中部署AI模型的痛點(diǎn) 1.1.1??部署模型的典型流程 1.1.2 端到端的AI性能 1.1.3 部署模型的難點(diǎn)和痛點(diǎn) 1.2 FastDeploy簡(jiǎn)介 1.3 英特爾獨(dú)立顯卡簡(jiǎn)介 1.4 使用FastDeploy在英特爾CPU和獨(dú)立顯卡上部署模型的步驟 1.4.1 搭建FastDeploy開發(fā)環(huán)境 1.4.2 下載模型和測(cè)試圖處 1.4.3 三行代

    2024年02月01日
    瀏覽(32)
  • yolov5分割+檢測(cè)c++ qt 中部署,以opencv方式(詳細(xì)代碼(全)+復(fù)制可用)

    yolov5分割+檢測(cè)c++ qt 中部署,以opencv方式(詳細(xì)代碼(全)+復(fù)制可用)

    1:版本說明: qt 5.12.10 opencv 4.5.3 (yolov5模型部署要求opencv4.5.0) 2:檢測(cè)的代碼 yolo.h yolo.cpp 檢測(cè)的調(diào)用代碼測(cè)試案例 這段調(diào)用的例子,只要把frame 改成你們自己的圖片即可 4:分割的主要代碼 YoloSeg.h YoloSeg.cpp yolov5_seg_utils.h ?yolov5_seg_utils.cpp 分割的調(diào)用代碼測(cè)試案例 ?分割的

    2024年02月03日
    瀏覽(23)
  • PaddleSeg分割框架解讀[05] paddleseg/models/deeplab.py文件

    PaddleSeg分割框架解讀[05] paddleseg/models/deeplab.py文件

    2024年02月21日
    瀏覽(10)
  • PaddleSeg分割框架解讀[01] 核心設(shè)計(jì)解析

    特別注意,這塊具體實(shí)現(xiàn)的類,如class Cityscapes(Dataset)等,稱為組件; 組件管理器,則為相應(yīng)的模型model管理器、數(shù)據(jù)集datasets管理器等。

    2024年02月20日
    瀏覽(22)
  • PaddleSeg的訓(xùn)練與測(cè)試推理全流程(超級(jí)詳細(xì))

    PaddleSeg的訓(xùn)練與測(cè)試推理全流程(超級(jí)詳細(xì))

    PaddleSeg 自建訓(xùn)練集訓(xùn)練+評(píng)估+模型部署: PaddleSeg官網(wǎng):https://gitee.com/paddlepaddle/PaddleSeg 我之前找到了一個(gè)paddleSeg的鏈接就下載了,結(jié)果調(diào)試的時(shí)候怎么都不對(duì),會(huì)有奇奇怪怪的錯(cuò)誤,并且非常棘手,解決不了 結(jié)果我后來發(fā)現(xiàn) 我原來是0.4版本,太舊了,所以出現(xiàn)各種由于不適

    2024年01月16日
    瀏覽(49)
  • PaddleSeg分割框架解讀[02] 配置文件config詳解

    以DeepLabv3+為例進(jìn)行講解

    2024年02月22日
    瀏覽(19)
  • [paddle]paddleseg中eiseg加載模型參數(shù)的模型下載地址

    以下內(nèi)容為2D圖片標(biāo)注模型下載及EISeg2D圖片標(biāo)注流程,具體如下: 在使用EISeg前,請(qǐng)先下載模型參數(shù)。EISeg開放了在COCO+LVIS、大規(guī)模人像數(shù)據(jù)、mapping_challenge,Chest X-Ray,MRSpineSeg,LiTS及百度自建質(zhì)檢數(shù)據(jù)集上訓(xùn)練的7個(gè)垂類方向模型,滿足通用場(chǎng)景、人像場(chǎng)景、建筑物標(biāo)注,醫(yī)

    2024年02月07日
    瀏覽(19)
  • “分割一切”大模型SAM、超輕量PP-MobileSeg、工業(yè)質(zhì)檢工具、全景分割方案,PaddleSeg全新版本等你來體驗(yàn)!

    “分割一切”大模型SAM、超輕量PP-MobileSeg、工業(yè)質(zhì)檢工具、全景分割方案,PaddleSeg全新版本等你來體驗(yàn)!

    圖像分割是計(jì)算機(jī)視覺的一項(xiàng)基礎(chǔ)技術(shù),其目標(biāo)是將圖像中的像素按內(nèi)容分成不同的類別。它在許多領(lǐng)域有重要應(yīng)用,比如自動(dòng)駕駛、工業(yè)質(zhì)檢、醫(yī)療圖像分析、遙感圖像解譯等。 PaddleSeg 是飛槳高性能圖像分割開發(fā)套件 ,在圖像分割領(lǐng)域做了大量的開源工作,致力于幫助企

    2023年04月19日
    瀏覽(22)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包