学习笔记——MLPerf Inference

该文章已生成可运行项目,

对MLPerf的例程进行了学习,现汇总如下:

1.仿真平台

选取的ubuntu20.04,参考教程安装vmware-安装Ubuntu20.04-静态IP等一系列的操作。

https://blog.csdn.net/weixin_45310323/article/details/132117335

2.代码下载

这里下载对应的代码。无法git的情况可以在gitee上,下载代码再拖到虚拟机中。

cd /tmp
git clone --recurse-submodules https://github.com/mlcommons/inference.git --depth 1
cd inference/vision/classification_and_detection

在classification_and_detection文件夹中有快速开始例程GettingStarted。下面的操作都是基于此教程。

3.管理配置python环境

3.1安装anaconda

参考教程安装。

https://blog.csdn.net/weixin_39289876/article/details/106074052

默认状态下的unbuntu20.04的python版本为3.8,ubuntu22.04python版本默认是python3.10.理论上安装Ubuntu22.04是可以直接运行MLPerf快速开始的。

我仿真时选择安装anaconda来配置python环境。

安装anaconda的原因一是MLPerf Inference的例程需要下载前置软件,对python环境有兼容版本的问题,二是其例程用到了jupyter notebook软件,安装anaconda就一步到位。

3.2配置环境python3.10

配置python3.10,这个取决于MLper快速开始的步骤中默认安装的软件默认选择最新版本,我仿真时最新版本是最起码得python3.10,配置低版本的python时会报错。

conda create -n test_env310 python=3.10   # 创建新的虚拟环境
conda activate test_env310     # 激活新建的虚拟环境

若安装的时miniconda等软件或者发现没有jupyter notebook,可根据以下语句安装

sudo apt-get update      #更新软件列表
sudo apt install jupyter-notebook

3.3安装前置软件。

官方教程是直接运行快速开始例程了,但其实可能缺少前置软件。

sudo apt-get install python3-dev  

sudo apt-get install cmake

sudo pip install  pytest

sudo pip install  numpy

sudo pip install  scipy

sudo pip install  pybind11

安装cmake、pytest、 numpy,scipy,pybind11,jupyter,skbuild,pip等。参考csdn教程安装即可。

完成后命令行cd classification_and_detection到文件夹,命令行输入

jupyter notebook GettingStarted.ipynb

打开GettingStarted。

4.运行快速开始例程。

4.1修改代码

需要将\inference\vision\classification_and_detection中的setup.py代码倒数第四行的mlperf_loadgen为mlcommons_loadgen。不然会在运行例程的过程第二步报错。

4.2例程运行

4.2.1python库

点击进第一个代码块,点击运行上面的运行三角。

4.2.2点击第二个代码块,运行。

输出很长的输出代码。最后结果如下:

4.2.3运行基准,正常是需要设置数据集。

4.2.4安装opencv-python

4.2.5下载mobile的onnx模型

4.2.6配置数据集

这里是选择tool中的工具创建简单的图像数据集。这里我运行后创建的val文件夹没有图像,我选择下载代码中的网址,把图片复制过去。

4.2.7配置模型存放位置和数据集

4.2.8运行mlperf的测试代码。输出结果

以上就是我关于MLPerf Inference的学习笔记。

参考博客:

https://blog.csdn.net/weixin_39289876/article/details/112858084

https://blog.csdn.net/weixin_58277783/article/details/135716056

https://blog.csdn.net/han2529386161/article/details/102723482

本文章已经生成可运行项目
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值