镜像烧录
1.下载Etche 2. 选择内存卡,烧录镜像(镜像地址) 3. 内存卡插入nano板子,进行初始化设置
环境部署
linux启动终端出现To run a command as administrator:
touch ~/.sudo_as_admin_successful
安装python3.7.5
- 开发板连接网络后,打开命令行
sudo apt-get install python3.7 - 输入
python3.7 ,可进入python3.7.5则安装成功 sudo apt-get install libpython3.7 sudo apt-get install libpython3.7-dev sudo apt-get install python3.7-dev
安装pip3
- 删除python3软链接:
sudo rm /usr/bin/python3 - 创建到python3.7的软链接:
sudo ln -s /usr/bin/python3.7 /usr/bin/python3 - 安装python3-pip:
sudo apt-get install python3-pip
安装pytorch1.7.0
- 从pytorch的github官网下载1.7.0版本的源码;
- 解压后,进入根目录;
- 打开命令行,增加swap空间:
dd if=/dev/zero of=/home/swapfile bs=1M count=1024 mkswap /home/swapfile swapon /home/swapfile - 一定记得先安装numpy
sudo apt remove python3-numpy
pip3 install cython
pip3 install numpy
pip3 install dist/torch-1.7.0-cp37-cp37m-linux_aarch64.whl
安装pyaudio
sudo apt-get install portaudio19-dev python3-all-dev
pip3 install pyaudio
安装librosa
pip3 install pybind11
pip3 install pythran
sudo apt-get install gfortran
pip3 install scipy
sudo apt-get install llvm-7
alias llvm-config="llvm-config-7"
export LLVM_CONFIG="/usr/bin/llvm-config-7"
pip3 install numba==0.48.0
sudo pip3 install librosa.....whl
安装其他依赖
pip3 install pixel_ring
pip3 install voice_engine
sudo apt-get install swig
sudo apt-get install clang
下载webrtc_audio_processing的[源码](https://github.com/xiongyihui/python-webrtc-audio-processing),进行安装。
设置开机自启动(阻塞在开机界面前)
- 建立rc-local.service文件
sudo vim /etc/systemd/system/rc-local.service
- 将下列内容复制进rc-local.service文件
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
- 创建文件rc.local
sudo vim /etc/rc.local
- 制作bash脚本
cd /home/xyh/user-xyh/DetectCough && sh test.sh
- 添加权限,启动服务
sudo chmod +x /etc/rc.local sudo systemctl enable rc-local sudo systemctl start rc-local.service sudo systemctl status rc-local.service
制作镜像
sudo fdisk -l
sudo dd if=/dev/sdb of=./imgname.img bs=512
下载https://github.com/Drewsif/PiShrink中的描述下载提供好的脚本
sudo pishrink.sh imgname.img imgname_small.img
烧录镜像
sudo dd if=./imgname.img of=/dev/sdb bs=512
|