# Deploy Edge AI App In a Second With Tengine and SuperEdge
------------
## Introduction
This example demonstrates how to deploy edge AI apps in a second. With the help of Tengine, an open-source inferencing Framework, developers can leverage CPU, GPU or edge AI accelerator to process real-time object detection task within a container. And also using the open-source edge computing orchestration, SuperEdge, developers can deploy applications to the edge node rapidly with a full set of edge computing features available.
[Tengine](https://github.com/OAID/Tengine"Tengine") is developed by **[OPEN AI LAB](http://www.openailab.com/)**. This project meet the demand of **fast** and **efficient** deployment of deep learning neural network models on embedded devices. In order to achieve cross-platform deployment in many **AIoT** applications, this project is based on the original Tengine project using **C language** for reconstruction, and deep frame tailoring for the characteristics of limited embedded device resources. Also, it adopts a completely separated front-end/back-end design, which makes it possible to be transplanted and deployed onto CPU, GPU, NPU and other heterogeneous computing units rapidly, conveniently. At the same time, it is compatible with the original API and model format `tmfile` of **Tengine**, which reduces the cost of evaluation and migration.
[SuperEdge](https://github.com/superedge/superedge"SuperEdge") is an open source **container management system for edge computing** to manage compute resources and container applications in multiple edge regions. These resources and applications, in the current approach, are managed as one single **Kubernetes** cluster. A native Kubernetes cluster can be easily converted to a SuperEdge cluster.
# Since the demo uses the desktop GUI, the application cannot be bringup normally in reboot case if the login windows is on, so it is better to set automatically login when device restarts
#Steps: Turn on "Setting" - "Users"- "AutoLogin" configuration at the upper right of GUI desktop. Now,device skips the login screean after reboot and bringup.
#Disable fenix-zram-config service to disable the swap
sudo systemctl disable fenix-zram-config
sudo systemctl status fenix-zram-config
# Download edgeadm arm64 version to install SuperEdge Node
If you want to compile and generate the demo_yolo_camera program yourself, please refer to the specific operation in [demo_videocapture user manual](https://github.com/OAID/Tengine/blob/tengine-lite/doc/demo_videocapture_user_manual.md"demo_videocapture user manual")
### 3.Preprare the Deployment File
- Create k8s Deployment file yolo.yaml in master
```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:tengine3/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
```
### 4.Apply the Application
- Execute cli to apply the deployment
```shell
kubectl apply -f yolo.yaml
```
### 5.Result and Verification
- Check the status of deployments and pods with k8s cli in master
```
peter@peter-VirtualBox:~$ kubectl get deployment yolo -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR