After updating my Arch system, I try to run OpenSeeFace with my usual script osf.sh
:
#!/bin/bash
cd "$(dirname "$0")"
source venv/bin/activate
sleep 1
python3.9 OpenSeeFace/facetracker.py \
-c $2 \
--fps 30 \
--faces 1 \
--silent 1 \
--model 3
However, it seems that OpenSeeFace is no longer working:
Traceback (most recent call last):
File "/home/exodrifter/bin/vsf/OpenSeeFace/facetracker.py", line 132, in <module>
from tracker import Tracker, get_model_base_path
File "/home/exodrifter/bin/vsf/OpenSeeFace/tracker.py", line 5, in <module>
import onnxruntime
File "/home/exodrifter/bin/vsf/venv/lib/python3.9/site-packages/onnxruntime/__init__.p
y", line 35, in <module>
raise import_capi_exception
File "/home/exodrifter/bin/vsf/venv/lib/python3.9/site-packages/onnxruntime/__init__.p
y", line 23, in <module>
from onnxruntime.capi._pybind_state import get_all_providers, get_available_provider
s, get_device, set_seed, \
File "/home/exodrifter/bin/vsf/venv/lib/python3.9/site-packages/onnxruntime/capi/_pybi
nd_state.py", line 32, in <module>
from .onnxruntime_pybind11_state import * # noqa
ImportError: /home/exodrifter/bin/vsf/venv/lib/python3.9/site-packages/onnxruntime/capi/
onnxruntime_pybind11_state.cpython-39-x86_64-linux-gnu.so: cannot enable executable stac
k as shared object requires: Invalid argument
Looking up this issue, I found microsoft/onnxruntime#16116. In particular, this comment suggested that I might need to install a specific version. Inspecting my installation script install-osf.sh
for OpenSeeFace, I see:
#!/bin/bash
cd "$(dirname "$0")"
source venv/bin/activate
python3.9 -m ensurepip
python3.9 -m pip install --upgrade pip
pip3.9 install onnxruntime opencv-python pillow numpy
deactivate
When I run this script, pip
reports that all of the requirements are already satisfied and doesn’t make any changes. In fact, if I runpip list --outdated
it appears that my packages are very out of date:
Package Version Latest Type
------------- -------- --------- -----
flatbuffers 2.0 25.2.10 wheel
numpy 1.23.1 2.0.2 wheel
onnxruntime 1.11.1 1.19.2 wheel
opencv-python 4.6.0.66 4.11.0.86 wheel
Pillow 9.2.0 11.1.0 wheel
protobuf 4.21.2 5.29.3 wheel
setuptools 58.1.0 75.8.0 wheel
So, I figured I could try updating to the latest version first instead of to a specific version (note the --upgrade
flag):
#!/bin/bash
cd "$(dirname "$0")"
source venv/bin/activate
python3.9 -m ensurepip
python3.9 -m pip install --upgrade pip
pip3.9 install --upgrade onnxruntime opencv-python pillow numpy
deactivate
This upgraded all of the packages, but now OpenSeeFace reports a different error:
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existi
ng code, use `float` by itself. Doing this will not modify any behavior and is safe. If
you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see t
he original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Traceback (most recent call last):
File "/home/exodrifter/bin/vsf/OpenSeeFace/facetracker.py", line 256, in <module>
faces = tracker.predict(frame)
File "/home/exodrifter/bin/vsf/OpenSeeFace/tracker.py", line 1172, in predict
face_info.success, face_info.quaternion, face_info.euler, face_info.pnp_error, face_
info.pts_3d, face_info.lms = self.estimate_depth(face_info)
File "/home/exodrifter/bin/vsf/OpenSeeFace/tracker.py", line 765, in estimate_depth
lms = np.concatenate((face_info.lms, np.array([[face_info.eye_state[0][1], face_info
.eye_state[0][2], face_info.eye_state[0][3]], [face_info.eye_state[1][1], face_info.eye_
state[1][2], face_info.eye_state[1][3]]], np.float)), 0)
File "/home/exodrifter/bin/vsf/venv/lib/python3.9/site-packages/numpy/__init__.py", li
ne 394, in __getattr__
raise AttributeError(__former_attrs__[attr])
In fact, it reports this error a lot. I figure this is because OpenSeeFace needs to be updated as well, so I run git pull
to update OpenSeeFace from 91a556f
to e6e24ef
.
Trying to run OpenSeeFace with osf.sh
after the pull works!