-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aac7d53
commit 97e39f6
Showing
4 changed files
with
1,451 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6da8d1fb-60f6-477c-ab2b-088cbc632c77", | ||
"metadata": {}, | ||
"source": [ | ||
"# MMDeploy本地部署预测-环境配置\n", | ||
"\n", | ||
"本代码教程需在本地环境运行\n", | ||
"\n", | ||
"同济子豪兄 2023-5-12\n", | ||
"\n", | ||
"特别感谢 MMDeploy 陈鑫:https://github.com/irexyc" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a9098e6f-17f3-4349-8f06-8755733d9f41", | ||
"metadata": {}, | ||
"source": [ | ||
"## 安装Miniconda\n", | ||
"\n", | ||
"https://docs.conda.io/en/latest/miniconda.html" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "fd82134a-0598-4045-8e20-f1c643e7eb56", | ||
"metadata": {}, | ||
"source": [ | ||
"## 配置环境\n", | ||
"\n", | ||
"```shell\n", | ||
"\n", | ||
"conda install nb_conda_kernels -y\n", | ||
"\n", | ||
"conda create -n triangle_pose python=3.8 -y\n", | ||
"\n", | ||
"conda activate triangle_pose\n", | ||
"\n", | ||
"jupyter notebook\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c3b364aa-ebe6-4325-8b65-e313864b83ae", | ||
"metadata": {}, | ||
"source": [ | ||
"## 打开每一个notebook后,都需要切换kernel为`triangle_pose`虚拟环境" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "31074358-4089-4ad8-b602-848e517ec4ff", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"source": [ | ||
"## 安装推理后端" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"id": "7c2647d2-56cc-42b5-94da-66cc753c0e09", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# 没有 GPU\n", | ||
"!pip install mmdeploy-runtime==1.0.0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "1464235e-f0b9-4cbc-8a98-012ff27889a7", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# 有 GPU\n", | ||
"# !pip install mmdeploy-runtime-gpu==1.0.0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8e7edf15-c653-40bd-8522-5a1b44b56bf3", | ||
"metadata": {}, | ||
"source": [ | ||
"## 安装其他第三方工具包" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6701818c-6df2-4cd9-b601-0e849af94926", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install matplotlib tqdm opencv-python tqdm" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a46e082b-57f9-4cc6-bd62-641fcf6fbb57", | ||
"metadata": {}, | ||
"source": [ | ||
"## 下载待测图像文件" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a5f5e0c0-d33f-4cb1-9cf9-98db104e6b80", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!wget https://zihao-openmmlab.obs.myhuaweicloud.com/20220610-mmpose/triangle_dataset/test_img/triangle_4.jpg" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4b734a1b-56f7-41e0-a5b7-586d2d9e440b", | ||
"metadata": {}, | ||
"source": [ | ||
"## 下载待测视频文件" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"id": "95b9415a-0d0a-4a98-a548-099ade8d1779", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!wget https://zihao-openmmlab.obs.myhuaweicloud.com/20220610-mmpose/triangle_dataset/videos/triangle_9.mp4" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a7d7e6eb-cbac-439b-9038-a730e4b48d19", | ||
"metadata": {}, | ||
"source": [ | ||
"## 下载MMDeploy导出的ONNX模型文件" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "9692ed0f-f5c8-4eba-9fde-5d6484a669fb", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"--2023-05-25 19:48:53-- https://zihao-openmmlab.obs.cn-east-3.myhuaweicloud.com/20220610-mmpose/triangle_dataset/ckpt/RTMDet-RTMPose-Triangle-ONNX.zip\n", | ||
"正在连接 172.16.0.13:5848... 已连接。\n", | ||
"已发出 Proxy 请求,正在等待回应... 200 OK\n", | ||
"长度: 51995333 (50M) [application/zip]\n", | ||
"正在保存至: “RTMDet-RTMPose-Triangle-ONNX.zip”\n", | ||
"\n", | ||
"RTMDet-RTMPose-Tria 100%[===================>] 49.59M 46.2MB/s 用时 1.1s \n", | ||
"\n", | ||
"2023-05-25 19:48:54 (46.2 MB/s) - 已保存 “RTMDet-RTMPose-Triangle-ONNX.zip” [51995333/51995333])\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# 删除原有的模型目录(如有)\n", | ||
"!rm -rf rtmdet2onnx rtmpose2onnx\n", | ||
"\n", | ||
"# 下载压缩包\n", | ||
"!wget https://zihao-openmmlab.obs.cn-east-3.myhuaweicloud.com/20220610-mmpose/triangle_dataset/ckpt/RTMDet-RTMPose-Triangle-ONNX.zip\n", | ||
"\n", | ||
"# 解压\n", | ||
"!unzip RTMDet-RTMPose-Triangle-ONNX.zip >> /dev/null # 解压压缩包\n", | ||
"!rm -rf RTMDet-RTMPose-Triangle-ONNX.zip # 删除压缩包\n", | ||
"!rm -rf __MACOSX" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e196e871-69ee-449f-a4e0-e05743581416", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.