如果使用ubuntu 16.04在后续的步骤中会报错如下,因为ubuntu 16.04不支持glibc2.23以上的版本(可使用strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_
命令查询)。所以建议使用18.04以上的ubuntu进行烧录。
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /home/zhouying/Desktop/ESP32CAM/esp-dl/tools/tvm/python/tvm/libtvm.so)
git clone https://github.com/espressif/esp-dl.git
官方文档:Linux 和 macOS 平台工具链的标准设置
我安装的版本是5.0.4,其他的版本会在某一步出现版本不兼容的问题。
打开https://github.com/espressif/esp-idf/tree/v5.0.4,选择手动下载压缩文件到本地。
cd esp-idf-v5.0.4/
./install.sh # 也可以指定单个芯片安装 ./install.sh esp32
# 设置环境
export IDF_PATH=/home/zhouying/Downloads/esp-idf-v5.0.4
export IDF_TOOLS_PATH=/home/zhouying/.espressif
在需要运行ESP-IDF的终端窗口运行(不建议直接将export.sh添加到shell的配置文件,这样会导致在每个终端会话中都激活IDF虚拟环境):
~$ source /home/zhouying/Downloads/esp-idf-v5.0.4/export.sh
Detecting the Python interpreter
Checking "python3" ...
Python 3.10.9
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /home/zhouying/.espressif/espidf.constraints.v5.0.txt
Requirement files:
- /home/zhouying/Downloads/esp-idf-v5.0.4/tools/requirements/requirements.core.txt
Python being checked: /home/zhouying/.espressif/python_env/idf5.0_py3.10_env/bin/python
Python requirements are satisfied.
Added the following directories to PATH:
/home/zhouying/Downloads/esp-idf-v5.0.4/components/espcoredump
/home/zhouying/Downloads/esp-idf-v5.0.4/components/partition_table
/home/zhouying/Downloads/esp-idf-v5.0.4/components/app_update
/home/zhouying/.espressif/python_env/idf5.0_py3.10_env/bin
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
cd esp-dl/examples/human_face_detect
idf.py set-target esp32
idf.py flash monitor -p /dev/ttyUSB0
如果报错A fatal error occurred: Could not open /dev/ttyUSB0, the port doesn't exist
,先修改权限sudo chmod a+rw /dev/ttyUSB0
,再重新运行
~$ idf.py flash monitor -p /dev/ttyUSB0
...
I (1214) main_task: Calling app_main()
Inference latency: 411416 us
[0] score: 0.999874, box: [-1, -1, 268, 299]
left eye: (126, 75), right eye: (189, 73)
nose: (119, 194)
mouth left: ( 41, 141), mouth right: (263, 212)
[1] score: 0.999810, box: [5, 206, 233, 506]
left eye: (118, 268), right eye: (170, 291)
nose: (115, 352)
mouth left: ( 55, 303), mouth right: (303, 415)
[2] score: 0.896976, box: [125, 255, 385, 556]
left eye: (217, 330), right eye: (252, 341)
nose: (185, 390)
mouth left: (194, 333), mouth right: (349, 465)
I (1674) main_task: Returned from app_main()
Done
esp32的结果跑出来和官方的不一样,可能芯片性能原因。