当前位置:   article > 正文

esp32cam和esp32-s3烧录human_face_detect实现人脸识别_quad_psram: psram id read error: 0x00ffffff, psram

quad_psram: psram id read error: 0x00ffffff, psram chip not found or not sup

如果使用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)
  • 1

一、环境搭建


1. 下载esp-dl

git clone https://github.com/espressif/esp-dl.git
  • 1

2. 安装esp-idf

官方文档: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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

在需要运行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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

二、esp32-cam


在这里插入图片描述

烧录human_face_detect

cd esp-dl/examples/human_face_detect
idf.py set-target esp32
idf.py flash monitor -p /dev/ttyUSB0
  • 1
  • 2
  • 3

如果报错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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

esp32的结果跑出来和官方的不一样,应该是芯片性能原因。

在这里插入图片描述

三、esp32-s3


在这里插入图片描述

烧录human_face_detect

esp32-s3的指导文件:esp32-s3-eye,esp32-s3连接linux显示的串口名称是ttyACM*

cd esp-dl/examples/human_face_detect
idf.py set-target esp32s3
idf.py flash monitor -p /dev/ttyACM0
  • 1
  • 2
  • 3

如果报错A fatal error occurred: Could not open /dev/ttyACM0, the port doesn't exist,先修改权限sudo chmod a+rw /dev/ttyACM0,再重新运行。

报错:

(359) quad_psram: PSRAM ID read error: 0x00ffffff, PSRAM chip not found or not supported, or wrong PSRAM line mode
E (362) cpu_start: Failed to init external RAM!
  • 1
  • 2

在这里插入图片描述

原因是PSRAM的模式错误,ESP32-S3内置的PSRAM为八线模式(Octal mode PSRAM)。参考ESP32 s3 PSRAM ID read error: 0x00ffffff 已解决。解决方法如下:
终端运行idf.py menuconfig打开工程配置,按照下图修改PSRAM的模式,然后S键+回车保存,Q键退出。

在这里插入图片描述
再重新运行idf.py flash monitor -p /dev/ttyACM0

~$ idf.py flash monitor -p /dev/ttyACM0
...
I (803) cpu_start: Max chip rev:     v0.99 
I (808) cpu_start: Chip rev:         v0.1
I (812) heap_init: Initializing. RAM available for dynamic allocation:
I (820) heap_init: At 3FC99248 len 000504C8 (321 KiB): DRAM
I (826) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (833) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (839) esp_psram: Adding pool of 8192K of PSRAM memory to heap allocator
I (847) spi_flash: detected chip: generic
I (851) spi_flash: flash io: qio
W (855) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
I (873) app_start: Starting scheduler on CPU0
I (873) app_start: Starting scheduler on CPU1
I (873) main_task: Started on CPU0
I (883) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (893) main_task: Calling app_main()
Inference latency:           55619 us
[0] score: 0.987812, box: [137, 75, 246, 215]
    left eye: (157, 131), right eye: (199, 133)
    nose: (170, 163)
    mouth left: (158, 177), mouth right: (193, 180)

I (963) main_task: Returned from app_main()

Done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

按照它的输出查看下识别效果,可以看到效果不错,说明s3的芯片性能还是很不错的。

cd /home/zhouying/Desktop/esp32-cam/esp-dl/examples/tool

python display_image.py -i /home/zhouying/Desktop/esp32-cam/esp-dl/examples/human_face_detect/image.jpg -b "(137, 75, 246, 215)" -k "(157, 131, 199, 133, 170, 163, 158, 177, 193, 180)"
  • 1
  • 2
  • 3

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/441087
推荐阅读
相关标签
  

闽ICP备14008679号