Fix MediaPipe doctor recognition missing libGLESv2 in Docker.
Install Mesa/GLVND GLES/EGL runtime libraries and verify mediapipe import at image build time so headless doctor pose inference no longer fails on libGLESv2.so.2. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,21 +12,26 @@ RUN sed -i \
|
||||
-e 's|http://deb.debian.org/debian|https://mirrors.aliyun.com/debian|g' \
|
||||
/etc/apt/sources.list.d/debian.sources
|
||||
|
||||
# OpenCV / MediaPipe (doctor pose) need GL + GLES in slim images; omit X11/GUI stack.
|
||||
# OpenCV / MediaPipe (doctor pose) need GLVND + Mesa GLES/EGL in slim images; omit X11/GUI stack.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
docker.io \
|
||||
ffmpeg \
|
||||
fontconfig \
|
||||
fonts-noto-cjk \
|
||||
fonts-wqy-microhei \
|
||||
libegl-mesa0 \
|
||||
libegl1 \
|
||||
libgbm1 \
|
||||
libgl1 \
|
||||
libgl1-mesa-dri \
|
||||
libglx-mesa0 \
|
||||
libgles2 \
|
||||
libglib2.0-0 \
|
||||
libgomp1 \
|
||||
libxcb1 \
|
||||
&& fc-cache -fv \
|
||||
&& ldconfig \
|
||||
&& ldconfig -p | grep -F 'libGLESv2.so.2' >/dev/null \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# ghcr.io:「增加前缀」形式(与 kindest/node 示例一致)
|
||||
@@ -59,7 +64,8 @@ ENV UV_DEFAULT_INDEX=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-dev && \
|
||||
.venv/bin/python -c "import alembic"
|
||||
.venv/bin/python -c "import alembic" && \
|
||||
.venv/bin/python -c "import mediapipe as mp; print('mediapipe', mp.__version__)"
|
||||
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
|
||||
@@ -25,6 +25,17 @@
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Linux 系统库(MediaPipe Pose)
|
||||
|
||||
在 Debian/Ubuntu 等 slim/最小化环境上,若出现 `libGLESv2.so.2: cannot open shared object file`,需安装 OpenGL ES / EGL 运行时(Docker 镜像见 `backend/Dockerfile`):
|
||||
|
||||
```bash
|
||||
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
|
||||
libegl-mesa0 libegl1 libgbm1 libgl1 libgl1-mesa-dri libglx-mesa0 libgles2 libglib2.0-0
|
||||
```
|
||||
|
||||
推理脚本已强制 MediaPipe **CPU delegate**;上述库仅用于加载原生 `.so`,不依赖显示器或 X11。
|
||||
|
||||
## 运行方法
|
||||
|
||||
### 方法1:一键脚本
|
||||
|
||||
@@ -27,7 +27,7 @@ operation-room-monitor/
|
||||
- 复制 `backend/.env.example` 为 `backend/.env` 并填写
|
||||
- 算法子进程包:`backend/algorithm_subprocesses/5.15/`(含 `main.py` 与 `weights/`;镜像构建时会 `COPY` 进容器,勿在 `.dockerignore` 中整目录排除)
|
||||
- 标注视频中文字体:镜像内已安装 `fonts-noto-cjk`、`fonts-wqy-microhei`(供 `visualize_result_video.py` 绘制耗材标签)
|
||||
- 医生识别(MediaPipe Pose):镜像内已安装 `libgles2`、`libegl1`;子进程强制 CPU delegate,避免无 GPU 图形栈时出现 `libGLESv2.so.2` 错误
|
||||
- 医生识别(MediaPipe Pose):镜像内已安装 `libgles2`、`libegl1`、`libegl-mesa0`、`libglx-mesa0`、`libgl1-mesa-dri` 等 Mesa/GLVND 库;构建阶段会 `import mediapipe` 校验 `libGLESv2.so.2` 可用。子进程强制 CPU delegate。若仍见该错误,请 **`docker compose build --no-cache api`** 后重启(勿沿用旧 tarball 镜像)
|
||||
- 可选备用权重:`backend/app/resources/actionformer_epoch_045.pth.tar`
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user