-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #949 from BUG1989/add_doc
add the doc with superedge
- Loading branch information
Showing
4 changed files
with
249 additions
and
2 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
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
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,106 @@ | ||
# Tengine Video Capture User Manual | ||
|
||
|
||
|
||
## 约束 | ||
|
||
当前版本仅支持基于 Khadas VIM3 SBC 上的 NPU 网络模型推理演示,我们后续会逐步完善,支持基于更多硬件平台的功能演示。 | ||
|
||
默认大家手上的 Khadas VIM3 中的固件为最新版本。 | ||
|
||
### 硬件说明 | ||
|
||
| 物品 | 描述 | | ||
| ----------- | ------------------------------------------------------------ | | ||
| Khadas VIM3 | 内置 A311D SoC 的单板计算机,内置 5Tops NPU 加速器 | | ||
| USB 摄像头 | 输入实时视频流 | | ||
| 液晶显示器 | 控制台操作,实时输出示例运行结果 | | ||
| HDMI连接线 | 由于Khadas VIM3 的 TYPE C 接口与 HDMI 接口过于紧凑,需要寻找小一点接口的 HMDI 连接线 | | ||
|
||
### 软件说明 | ||
|
||
以下均为 Khadas VIM3 单板计算机上的软件描述。 | ||
|
||
- Ubuntu 20.04 | ||
- OpenCV 4.2 | ||
- gcc 9.3.0 | ||
- cmake 3.16.3 | ||
|
||
### 操作说明 | ||
|
||
后续步骤中的命令行操作均为基于 Khadas VIM3 单板计算机上的操作,其中: | ||
|
||
- **下载**、**编译**步骤 可以过 SSH 登陆或者直接在 Khadas VIM3 的 UBuntu 桌面启动控制台中执行; | ||
- **运行**步骤仅在 Khadas VIM3 的 UBuntu 桌面启动控制台中执行。 | ||
|
||
## 编译 | ||
|
||
### 下载 NPU 依赖库 TIM-VX | ||
|
||
``` | ||
$ git clone https://github.com/VeriSilicon/TIM-VX.git | ||
``` | ||
|
||
### 下载 Tengine | ||
|
||
``` | ||
$ git clone https://github.com/OAID/Tengine.git tengine-lite | ||
$ cd tengine-lite | ||
``` | ||
|
||
### 准备代码 | ||
|
||
``` | ||
$ cd <tengine-lite-root-dir> | ||
$ cp -rf ../TIM-VX/include ./source/device/tim-vx/ | ||
$ cp -rf ../TIM-VX/src ./source/device/tim-vx/ | ||
``` | ||
|
||
### 执行编译 | ||
|
||
``` | ||
$ cd <tengine-lite-root-dir> | ||
$ mkdir build && cd build | ||
$ cmake -DTENGINE_ENABLE_TIM_VX=ON -DTENGINE_ENABLE_MODEL_CACHE=ON -DTENGINE_BUILD_DEMO=ON .. | ||
$ make demo_yolo_camera -j`nproc` | ||
``` | ||
|
||
编译完成后,`libtengine-lite.so` 和 `demo_yolo_camera` 存放在以下路径: | ||
|
||
- `<tengine-lite-root-dir>/build/source/libtengine-lite.so` | ||
- `<tengine-lite-root-dir>/build/demos/demo_yolo_camera` | ||
|
||
## 运行 | ||
|
||
模型文件 `yolov3_uint8.tmfile` 可从 Model ZOO 中下载,按照以下顺序方式存放文件: | ||
|
||
``` | ||
...... | ||
├── demo_yolo_camera | ||
├── libtengine-lite.so | ||
├── models | ||
│ └── yolov3_uint8.tmfile | ||
...... | ||
``` | ||
|
||
执行当前路径下的 `demo_yolo_camera` : | ||
|
||
``` | ||
./demo_yolo_camera | ||
``` | ||
|
||
*P.S. :第一次运行因为会在线编译生成 NPU 运行依赖的 kernel file,会有一定的等待时间(大约30秒),后续运行直接加载所在目录下的 cache file 文件(小于1秒)。* | ||
|
||
## 关于容器 | ||
|
||
- 我们提供了基于 Khadas VIM3 平台的容器版本,具体操作可以参考 [superedge_user_manual](./superedge_user_manual.md); | ||
- 我们提供了腾讯云的 SuperEdge 版本,请参考(待补充)。 | ||
|
||
|
||
|
||
## FAQ | ||
|
||
Khadas VIM3 编译 Tengine + TIMVX 其余问题(包括 Khadas VIM3 购买渠道)可以参考 [npu_tim-vx_user_manual_zh](./npu_tim-vx_user_manual_zh.md)。 | ||
|
||
|
||
|
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,122 @@ | ||
# [SuperEdge](https://github.com/superedge/superedge "SuperEdge") & [Tengine](https://github.com/OAID/Tengine "Tengine") | ||
|
||
------------ | ||
## Quickstart Guide | ||
### Install edge Kubernetes master node | ||
|
||
```shell | ||
wget http://tengine2.openailab.com:9527/openailab/edgeadm-linux-amd64-v0.4.0.tgz | ||
tar -zxvf edgeadm-linux-amd64-v0.4.0.tgz | ||
cd edgeadm-linux-amd64-v0.4.0 | ||
./edgeadm init --kubernetes-version=1.18.2 --image-repository superedge.tencentcloudcr.com/superedge --service-cidr=10.96.0.0/12 --pod-network-cidr=10.224.0.0/16 --install-pkg-path ./kube-linux-*.tar.gz --apiserver-cert-extra-sans=<Master Public IP> --apiserver-advertise-address=<Master Intranet IP> --enable-edge=true | ||
``` | ||
### Join edge node | ||
|
||
```shell | ||
wget http://tengine2.openailab.com:9527/openailab/edgeadm-linux-arm64-v0.4.0.tgz | ||
tar -zxvf edgeadm-linux-arm64-v0.4.0.tgz | ||
cd edgeadm-linux-arm64-v0.4.0 | ||
./edgeadm join <Master Public/Intranet IP Or Domain>:Port --token xxxx --discovery-token-ca-cert-hash sha256:xxxxxxxxxx --install-pkg-path kube-linux-arm64-v1.18.2.tar.gz --enable-edge=true | ||
``` | ||
### Build Docker images on Khadas VIM3 Device | ||
|
||
```shell | ||
wget http://tengine2.openailab.com:9527/openailab/yolo.tar.gz | ||
tar -zxvf yolo.tar.gz | ||
cd superedge | ||
docker build -t yolo:latest . | ||
``` | ||
Dockerfile | ||
``` | ||
FROM ubuntu:20.04 | ||
MAINTAINER openailab | ||
RUN apt-get update | ||
RUN apt-get install -y tzdata | ||
RUN apt-get install -y libopencv-dev | ||
RUN apt-get install -y libcanberra-gtk-module | ||
RUN useradd -m openailab | ||
COPY libtengine-lite.so /root/myapp/ | ||
COPY demo_yolo_camera /root/myapp/ | ||
COPY tm_330_330_330_1_3.tmcache /root/myapp/ | ||
ADD models /root/myapp/models/ | ||
COPY tm_88_88_88_1_1.tmcache /root/myapp/ | ||
COPY tm_classification_timvx /root/myapp/ | ||
COPY libOpenVX.so /lib/ | ||
COPY libGAL.so /lib/ | ||
COPY libVSC.so /lib/ | ||
COPY libArchModelSw.so /lib/ | ||
COPY libNNArchPerf.so /lib/ | ||
COPY libgomp.so.1 /lib/aarch64-linux-gnu/ | ||
COPY libm.so.6 /lib/aarch64-linux-gnu/ | ||
WORKDIR /root/myapp/ | ||
USER openailab | ||
CMD ["./demo_yolo_camera"] | ||
``` | ||
[Tengine lite source code Download](http://www.baidu.com "Tengine lite source code Download") | ||
|
||
### RUN yolo docker container on Khadas VIM3 Device | ||
|
||
```shell | ||
# Access to Xserver | ||
# Execute script on device Terminal | ||
xhost + | ||
# Run | ||
docker run -it --name yolo --privileged -v /dev:/dev -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=:0 -e GDK_SCALE -e GDK_DPI_SCALE yolo:latest | ||
``` | ||
### Deploy yolo with SuperEdge | ||
|
||
Edit yolo.yaml | ||
|
||
```yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: yolo | ||
labels: | ||
name: yolo | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: yolo | ||
template: | ||
metadata: | ||
labels: | ||
name: yolo | ||
spec: | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/hostname | ||
operator: In | ||
values: | ||
- khadas | ||
containers: | ||
- name: yolo | ||
image: registry.cn-shenzhen.aliyuncs.com/edge_studio/yolo:v1.0 | ||
env: | ||
- name: DISPLAY | ||
value: :0 | ||
volumeMounts: | ||
- name: dev | ||
mountPath: /dev | ||
- name: unix | ||
mountPath: /tmp/.X11-unix | ||
securityContext: | ||
privileged: true | ||
volumes: | ||
- name: dev | ||
hostPath: | ||
path: /dev | ||
- name: unix | ||
hostPath: | ||
path: /tmp/.X11-unix | ||
``` | ||
## Deploy yolo App | ||
```shell | ||
kubectl apply -f yolo.yaml | ||
``` | ||
![](http://tengine2.openailab.com:9527/openailab/yolo_demo.jpg) |