7、TPU 手机操控Google Edge TPU开发板
作者:互联网
1、首先进入TPU终端;具体操作参考:https://model.gravitylink.com/doc/guide.html#/
mkdir /home/mendel/edge_tpu_server
cd /home/mendel/edge_tpu_server
wget http://glink-model-store.oss-cn-hongkong.aliyuncs.com/server/server
然后修改下载的文件,设置成可执行的权限
sudo chmod a+x server
2、然后设置默认开机自动启动,打开配置文件,然后在文件中添加两句,保存退出
sudo vim /etc/bash.bashrc
设置到配置文件中
cd /home/mendel/edge_tpu_server
nohup ./server >> /home/mendel/edge_tpu_server/server.log &
{ 官方手册给出了另一种方法:
首先,设置启动服务文件;
mendel@tuned-ibis:~/edge_tpu_server$ vim tpu.service
然后写入文件内容
[Unit]
Description=Edge TPU Server Demo
After=weston.target
[Service]
Environment=DISPLAY=:0
PAMName=login
Type=simple
Restart=always
User=mendel
WorkingDirectory=/home/mendel/edge_tpu_server
#RootDirectoryStartOnly=true
ExecStart=/home/mendel/edge_tpu_server/server
[Install]
WantedBy=multi-user.target
然后建立软连接,启动服务
mendel@tuned-ibis:~/edge_tpu_server$ sudo ln -s /home/mendel/edge_tpu_server/tpu.service /lib/systemd/system
mendel@tuned-ibis:~/edge_tpu_server$ sudo systemctl daemon-reload
mendel@tuned-ibis:~/edge_tpu_server$ sudo systemctl enable tpu.service
Created symlink /etc/systemd/system/multi-user.target.wants/tpu.service → /home/mendel/edge_tpu_server/tpu.service.
mendel@tuned-ibis:~/edge_tpu_server$ sudo service tpu start
mendel@tuned-ibis:~/edge_tpu_server$ sudo reboot
}
之后将显示我们设置两种方式都都成功了(任选一种即可)
Linux tuned-ibis 4.9.51-imx #1 SMP PREEMPT Fri Apr 5 00:17:46 UTC 2019 aarch64
The programs included with the Mendel GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Mendel GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Jun 26 00:21:21 2019
nohup: redirecting stderr to stdout
[1]+ Done nohup ./server >> /home/mendel/edge_tpu_server/server.log
mendel@tuned-ibis:~/edge_tpu_server$ ps -ef | grep server
mendel 3046 1 0 00:21 ? 00:00:00 /home/mendel/edge_tpu_server/server
mendel 3571 3543 0 00:24 pts/0 00:00:00 grep server
mendel@tuned-ibis:~/edge_tpu_server$ sudo service tpu status
● tpu.service - Edge TPU Server Demo
Loaded: loaded (/home/mendel/edge_tpu_server/tpu.service; enabled; vendor pre
Active: active (running) since Wed 2019-06-26 00:21:21 UTC; 3min 4s ago
Main PID: 3046 (server)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/tpu.service
‣ 3046 /home/mendel/edge_tpu_server/server
Jun 26 00:21:21 tuned-ibis systemd[1]: Started Edge TPU Server Demo.
Jun 26 00:21:21 tuned-ibis systemd[3046]: pam_lastlog(login:session): file /var/
Jun 26 00:21:21 tuned-ibis systemd[3046]: pam_unix(login:session): session opene
lines 1-11/11 (END)
}
3、然后在个人手机上安装apk链接:https://pan.baidu.com/s/1FdhyT5_3tuxsLBXRwWJ_xg 密码:k0w7
{
涉及到摄像头问题,本想使用用手机摄像头作为usb摄像头上使用
在手机终端安装app链接:https://pan.baidu.com/s/1n84P7vDdW5mocdFrhkJEzg 密码:ryut
然后在网页输入http://IP:port/
用户名和密码即可显示手机摄像头的图像;
下一步希望链接TPU访问(手机充当)摄像头
import cv2
url = "http://admin:admin@IP:PORT"
cap = cv2.VideoCapture(url)
while True:
ret,frame=cap.read()
cv2.imshow("frame",frame)
if cv2.waitKey(1)&0xFF==ord('q'):
break
cap.release()
cv2.destroyAllWindows()
}
注册账户名和密码,之后进行添加设备和填入TPU的IP
然后添加模型 ;就ok~~~
标签:00,Google,tuned,tpu,server,TPU,edge,mendel,开发板 来源: https://blog.csdn.net/sxj731533730/article/details/93644879