Deep3DFaceReconstruction
Deep3DFaceReconstruction copied to clipboard
tensorflow.python.framework.errors_impl.NotFoundError: ./renderer/rasterize_triangles_kernel.so: undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs
when I run "python demo.py", I get this error, the detail message is:
Traceback (most recent call last):
File "demo.py", line 12, in <module>
from face_decoder import Face3D
File "/home/ly/yanyan/Deep3DFaceReconstruction/face_decoder.py", line 10, in <module>
from renderer import mesh_renderer
File "/home/ly/yanyan/Deep3DFaceReconstruction/renderer/mesh_renderer.py", line 25, in <module>
from renderer import rasterize_triangles
File "/home/ly/yanyan/Deep3DFaceReconstruction/renderer/rasterize_triangles.py", line 30, in <module>
rasterize_triangles_module = tf.load_op_library('./renderer/rasterize_triangles_kernel.so')
File "/home/ly/.conda/envs/deep3d/lib/python3.6/site-packages/tensorflow/python/framework/load_library.py", line 60, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: ./renderer/rasterize_triangles_kernel.so: undefined symbol: _ZN10tensorflow12OpDefBuilder4AttrESs
I suspect the problem is about the file " rasterize_triangles_kernel.so ". I just download the pre-compiled binary file (rasterize_triangles_kernel.so), but I'm sure my tensorflow version is 1.12.
Your help would be highly appreciated.
Hi, the pre-compiled binary file only works if you install tensorflow 1.12 via pip install and use cuda 9.0. If you install tensorflow via conda with other version of cudatoolkit, you have to compile tf_mesh_renderer from source using bazel.
I have tensorflow v=2.5.0, and cuda 9.0
But still this error persists. Please let me know, what else can go wrong!
I have tensorflow v=2.5.0, and cuda 9.0 But still this error persists. Please let me know, what else can go wrong!
Hi, I'm not sure if tensorflow version >= 2.0 can work.
@YuDeng Thank you for the response. I downgraded to the TensorFlow version=1.12 and the demo ran successfully.
@rakaar what version of the cuda and cudnn did you use for TensorFlow==1.12? Can we run it on CPU only without having need for cuda? I use TensorFlow==2.4 and CUDA==11 and ended with a similar problem https://github.com/microsoft/Deep3DFaceReconstruction/issues/139
Can someone provide pre-compiled binary file rasterize_triangles_kernel.so that can work with TensorFlow >= 2.0 ?
@fisakhan It doesn't work with TensorFlow version 2.0, you need to degrade the tensorflow version to 1.12 (ref) And I think CUDA is necessary, I tried running without CUDA, it didn't work.
#tensorflow1.x #!/bin/bash
TF_INC=$(python3 -c "import tensorflow as tf; print(tf.sysconfig.get_include())") TF_LIB=$(python3 -c "import tensorflow as tf; print(tf.sysconfig.get_lib())")
echo "TF_INC: $TF_INC" >&2
echo "TF_LIB: $TF_LIB" >&2
#if tensorflow2.x (cd $TF_LIB && ln -sf libtensorflow_framework.so.2 libtensorflow_framework.so)
TF_MESH_RENDERER_PATH=$PWD/tf_mesh_renderer/mesh_renderer/kernels/
g++ -std=c++11
-shared
$TF_MESH_RENDERER_PATH/rasterize_triangles_grad.cc
$TF_MESH_RENDERER_PATH/rasterize_triangles_op.cc
$TF_MESH_RENDERER_PATH/rasterize_triangles_impl.cc
$TF_MESH_RENDERER_PATH/rasterize_triangles_impl.h
-o $TF_MESH_RENDERER_PATH/rasterize_triangles_kernel.so
-fPIC -D_GLIBCXX_USE_CXX11_ABI=0
-I$TF_INC -L$TF_LIB -ltensorflow_framework -O2
if [ "$?" -ne 0 ]; then echo "compile rasterizer failed"; exit 1; fi