基于Ascend910+PyTorch1.11.0+CANN6.3.RC2的YoloV5训练推理一体化解决方案

这篇具有很好参考价值的文章主要介绍了基于Ascend910+PyTorch1.11.0+CANN6.3.RC2的YoloV5训练推理一体化解决方案。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

昇腾Pytorch镜像:https://ascendhub.huawei.com/#/detail/ascend-pytorch
代码仓:git clone https://gitee.com/ascend/modelzoo-GPL.git

coco测试验证集:wget https://bj-aicc.obs.cn-north-309.mtgascendic.cn/dataset/coco2017/coco.zip
coco训练集(放images下):wget https://bj-aicc.obs.cn-north-309.mtgascendic.cn/dataset/coco2017/train2017.zip

部分代码

# import StreamManagerApi.py
from StreamManagerApi import *

if __name__ == '__main__':
    # init stream manager
    streamManagerApi = StreamManagerApi()
    ret = streamManagerApi.InitManager()
    if ret != 0:
        print("Failed to init Stream manager, ret=%s" % str(ret))
        exit()

    # create streams by pipeline config file
    with open("data/pipeline/Sample.pipeline", 'rb') as f:
        pipelineStr = f.read()
    ret = streamManagerApi.CreateMultipleStreams(pipelineStr)
    if ret != 0:
        print("Failed to create Stream, ret=%s" % str(ret))
        exit()

    # Construct the input of the stream
    dataInput = MxDataInput()
    with open("data/test.jpg", 'rb') as f:
        dataInput.data = f.read()

    # The following is how to set the dataInput.roiBoxs
    """
    roiVector = RoiBoxVector()
    roi = RoiBox()
    roi.x0 = 100
    roi.y0 = 100
    roi.x1 = 200
    roi.y1 = 200
    roiVector.push_back(roi)
    dataInput.roiBoxs = roiVector
    """

    # Inputs data to a specified stream based on streamName.
    streamName = b'classification'
    inPluginId = 0
    uniqueId = streamManagerApi.SendDataWithUniqueId(streamName, inPluginId, dataInput)
    if uniqueId < 0:
        print("Failed to send data to stream.")
        exit()

    # Obtain the inference result by specifying streamName and uniqueId.
    inferResult = streamManagerApi.GetResultWithUniqueId(streamName, uniqueId, 3000)
    if inferResult.errorCode != 0:
        print("GetResultWithUniqueId error. errorCode=%d, errorMsg=%s" % (
            inferResult.errorCode, inferResult.data.decode()))
        exit()

    # print the infer result
    print(inferResult.data.decode())

    # destroy streams
    streamManagerApi.DestroyAllStreams()

本来想一次性写完的,奈何装CANN的驱动装了一个礼拜,各种内核版本不匹配,国产AI硬件任重道远…文章来源地址https://www.toymoban.com/news/detail-723092.html

到了这里,关于基于Ascend910+PyTorch1.11.0+CANN6.3.RC2的YoloV5训练推理一体化解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Python&aconda系列:GPU深度学习环境搭建:Win11+CUDA 11.7+Pytorch1.12.1+Anaconda以及对应版本

    官方推荐的cuda版本为10.2和11.3,这两种 cuda 支持大多数的 pytorch 版本。 以下是Pytorch和CUDA对应的版本 CUDA 环境 PyTorch 版本 9.2 0.4.1、1.2.0、1.4.0、1.5.0(1)、1.6.0、1.7.0(1) 10.0 1.2.0、1.1.0、1.0.0(1) 10.1 1.4.0、1.5.0(1)、1.6.0、1.7.0(1) 10.2 1.5.0(1)、1.6.0、1.7.0(1)、1.8.0(1)、1.9.0、1.9.0、1.10.0、1.

    2024年02月02日
    浏览(59)
  • GPU深度学习环境搭建:Win10+CUDA 11.7+Pytorch1.13.1+Anaconda3+python3.10.9

    在命令行中输入【nvidia-smi】可以当前显卡驱动版本和cuda版本。 根据显示,显卡驱动版本为:Driver Version: 516.59,CUDA 的版本为:CUDA  Version 11.7。 此处我们可以根据下面的表1 显卡驱动和cuda版本对应关系得知,Driver Version: 527.47  516.31,所以可以使用 CUDA Version 11.7 CUDA工具版本

    2024年04月26日
    浏览(55)
  • 华为昇腾服务器 ubuntu20.04 Atlas中心推理卡 23.0.RC3 NPU驱动和固件安装指南 02(Atlas 300V pro)(Ascend 310P)(cann)安装流程记录

    参考文章:Atlas 中心推理卡 23.0.RC3 NPU驱动和固件安装指南 02 参考文章:https://www.hiascend.com/document/detail/zh/quick-installation/23.0.RC3/quickinstg/800_3000/quickinstg_800_3000_0013.html 首先看版本配套表,比如我们推理卡是Atlas 300V pro,要看系统是不是支持Atlas 300V pro?找到合适版本的系统(内

    2024年02月01日
    浏览(36)
  • 昇腾910b部署Chatglm3-6b进行流式输出【pytorch框架】NPU推理

    配套软件包Ascend-cann-toolkit和Ascend-cann-nnae 适配昇腾的Pytorch 适配昇腾的Torchvision Adapter 下载ChatGLM3代码 下载chatglm3-6b模型,或在modelscope里下载 每个人的服务器都不一样,在ChatGLM3/issues中别人只需要修改指定驱动,但是我的不行 删除模型文件包中的model.safetensors.index.json,否则加

    2024年01月21日
    浏览(55)
  • Win10使用Anaconda搭建Pytorch1.6.0(CPU指定版本)虚拟环境

    近期在阅读一篇关于跨域推荐中用户冷启动问题的论文《Cross-Domain Recommendation to Cold-Start Users via Variational Information Bottleneck》。 在死磕文章算法的时候发现自己属于“懂-不懂-懂-不懂…”的无限循环中,突发奇想“是否可以通过代码辅助理解文章算法?”于是开始琢磨起了论

    2024年02月04日
    浏览(45)
  • 关于安装pytorch1.0.0版本(果然还是要手动自己去找啊。。。一遍成!!保真)

    首先 第一步就是不要跑到官网里边去按照官网给的提示去下载!!不要不要不要!也不要去什么用清华镜像源啥的,因为根本找不到,很折腾! 直接在这个网站download.pytorch.org/whl/cu100/torch_stable.html里边找你想要下载的torch1.0.0版本以及torchvision(如果要装cudatoolkit 10.2版的torch,

    2024年02月05日
    浏览(35)
  • PVN3D——WIN10 PyTorch1.8 Linemod-render最全复现

    目录 前言 一、资源下载 二、环境配置 提示 pytorch版本设置的原因 需要安装系统cuda!! win10 conda基本环境配置 python-pcl配置 pointnet2_ops配置 Ubuntu20.04 三、融合数据生成 四、模型训练 源码微调 训练开始 总结 研究6d位姿估计,复现经典代表性论文pvn3d,因实验需求,在win10和

    2024年02月02日
    浏览(30)
  • flume1.11.0安装部署

    上传;  解压; 进入conf目录,修改 flume-env.sh,配置 JAVA_HOME; 安装nginx; \\\"yum  update\\\"命令最后报错了,但好像没有影响nginx的安装,估计是版本兼容性问题,如下图; nginx命令; 启动nginx后,访问80端口; nginx网络80端口访问日志文件保存位置; 注意:网上说“在hadoop3.x之前需

    2024年02月09日
    浏览(33)
  • Android11.0 launcher修改为单层

    OS: RK3568 Android11.0 现在的产品基本都是按照手机样式去做,所以需要把系统默认的Launcher样式,去掉抽屉改为单层显示,也就是把所有的app添加到workspace中。 以下修改是在设备横屏模式下进行 。 1.添加一个宏开关控制Launcher单双层显示 源码: /packages/apps/Launcher3/src/com/android/

    2024年02月08日
    浏览(37)
  • Android11.0 修改系统默认显示大小

    系统设置中的显示大小调整的就是屏幕密度,调整的越小,屏幕显示的内容就越多。 在系统中都会有定义一个默认的屏幕密度 设置中显示大小相关内容 源码:/packages/apps/Settings/res/xml/display_settings.xml 源码:/packages/apps/Settings/src/com/android/settings/display/ScreenZoomSettings.java 密度缩

    2024年02月09日
    浏览(33)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包