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

网站更换备案吗/大泽山seo快速排名

网站更换备案吗,大泽山seo快速排名,现在建设网站都用什么软件,自己制作网站做外贸赚钱吗基于C和ONNX Runtime部署YOLOv12的ONNX模型,可以遵循以下步骤: 准备环境:首先,确保已经下载后指定版本opencv和onnruntime的C库。 模型转换: 安装好yolov12环境并将YOLOv12模型转换为ONNX格式。这通常涉及使用深度学习…

基于C++和ONNX Runtime部署YOLOv12的ONNX模型,可以遵循以下步骤:

  1. 准备环境:首先,确保已经下载后指定版本opencv和onnruntime的C++库。

  2. 模型转换: 安装好yolov12环境并将YOLOv12模型转换为ONNX格式。这通常涉及使用深度学习框架(如PyTorch或TensorFlow)加载原始模型,并导出为ONNX格式。转换指令

# End-to-End ONNX
yolo export model=yolov12{n/s/m/b/l/x}.pt format=onnx opset=13 simplify
  1. C++环境配置:在CMakeLists.txt项目中正确引用了opencv和ONNX Runtime的头文件,并链接到相应的库。这允许在C++代码中使用ONNX Runtime的功能。

  2. 加载模型:使用ONNX Runtime的API加载转换后的YOLOv12 ONNX模型。

  3. 执行推理:通过ONNX Runtime的推理引擎,将图像数据输入到模型中,并执行目标检测任务。

  4. 处理结果:解析模型输出的结果,这通常涉及将输出的张量数据转换为可理解的检测结果,如边界框坐标和类别标签。

通过这些步骤,可以在C++环境中利用ONNX Runtime高效地部署YOLOv12模型,实现实时的目标检测功能。

【测试环境】

windows10 x64
vs2019
cmake==3.30.1
onnxruntime==1.16.3
opencv==4.9.0
【使用步骤】
首先cmake生成exe文件,然后将onnxruntime.dll和onnxruntime_providers_shared.dll放到exe一起,不然会提示报错0xc000007b,这是因为系统目录也有个onnxruntime.dll引发冲突,并把car.mp4也放到exe一起。运行直接输入
yolov12.exe 注意onnx路径要是你真实路径我的onnx路径是我桌面上地址

【代码调用】

注意onnxruntime使用的cpu版本库,如需使用GPU还需要修改代码才行

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <iostream>
#include <string>
#include "YOLO12.hpp"int main() {// Paths to the model, labels, test image, and save directoryconst std::string labelsPath = "../models/coco.names";const std::string imagePath = "../data/dog.jpg";           // Image pathconst std::string savePath = "../data/dog_detections.jpg";   // Save directory// Model path for YOLOv12const std::string modelPath = "../models/yolov12n.onnx";   // YOLOv12// Initialize the YOLO detector with the chosen model and labelsbool isGPU = true; // Set to false for CPU processingYOLO12Detector detector(modelPath, labelsPath, isGPU);// Load an imagecv::Mat image = cv::imread(imagePath);if (image.empty()) {std::cerr << "Error: Could not open or find the image!\n";return -1;}// Detect objects in the image and measure execution timeauto start = std::chrono::high_resolution_clock::now();std::vector<Detection> results = detector.detect(image);auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start);std::cout << "Detection completed in: " << duration.count() << " ms" << std::endl;// Draw bounding boxes on the imagedetector.drawBoundingBox(image, results); // Simple bounding box drawing// detector.drawBoundingBoxMask(image, results); // Uncomment for mask drawing// Save the processed image to the specified directoryif (cv::imwrite(savePath, image)) {std::cout << "Processed image saved successfully at: " << savePath << std::endl;} else {std::cerr << "Error: Could not save the processed image to: " << savePath << std::endl;}// Display the imagecv::imshow("Detections", image);cv::waitKey(0); // Wait for a key press to close the windowreturn 0;
}

部署演示可以参考视频:bilibili.com/video/BV1iYPsewEDg

http://www.whsansanxincailiao.cn/news/31966734.html

相关文章:

  • 优化网站建设价格/网络营销一个月能挣多少钱
  • 自己做资讯网站/西安关键词seo公司
  • 婚纱摄影网站源码下载/营销方案怎么写模板
  • 网站建设公司代理商/企业文化标语经典
  • 企业网站的分类/电子商务主要学什么就业方向
  • 模板板网站/seo外链发布
  • 品牌营销策划师/惠州关键词排名优化
  • 网站导航栏的作用/永久免费用的在线客服系统
  • 标准化建设考评网站/优化搜狗排名
  • 建网站问题/微信上怎么做广告推广
  • 做讲课ppt的网站/关于seo的行业岗位有哪些
  • vs网站开发实例/网站搜索量查询
  • 网站开发设计需求文档/武汉网站建设优化
  • 动漫制作专业有本科吗/优化设计七年级下册数学答案
  • 网站开发的编程语言/网络推广是什么意思
  • 重庆免费自助建站模板/营销案例分析
  • 肯德基网站建设/怎样宣传自己的产品
  • 重庆市建设工程施工安全网/杭州seo排名收费
  • 免费建站哪里找/怎么做网站推广和宣传
  • 网站建设一条龙/淘宝客推广一天80单
  • 亚马逊网站运营怎么做/新手seo要学多久
  • 做网站制作怎么样/seo网站优化价格
  • 工业设计企业/百度小程序seo
  • 提供武汉手机网站建设/app推广注册赚钱
  • 微信公众官网登录/杭州seo
  • 赚钱网站源码/东莞网站公司排名
  • 免费注册建网站/关键词推广方法
  • 东营政府网站建设/网络营销渠道可分为哪些
  • 个人网站建设与企业网站/网络推广产品公司
  • b2b免费发布网站大全排名/站长论坛