VIBE复现过程,使用nvidia和libOpenGL.so渲染出错及解决方案
VIBE全称是"Video Inference for Human Body Pose and Shape Estimation",是2020年CVPR(computer vision and pattern recognition)中关于人体姿态骨架的一篇论文。
论文地址:https://arxiv.org/abs/1912.05656
github源码地址:https://github.com/mkocabas/VIBE
问题描述
根据作者给出的源码,在复现过程中出现以下问题:
return self._finalCall( *args, **named )
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
解决方案
上述问题并不是VIBE本身的代码逻辑有问题,而是与nvidia驱动程序、OpenGL文件有关系。
这里给出了解决方案,也就是修改OpenGL/platform文件夹下的egl.py文件,将第36行的’GL’注释掉,换成’OpenGL’。
修改之后的egl.py完整文件如下:
import ctypes, ctypes.util
from OpenGL.platform import baseplatform, ctypesloader
class EGLPlatform( baseplatform.BasePlatform ):
"""EGL platform for opengl-es only platforms"""
@baseplatform.lazy_property
def GLES1(self):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'GLESv1_CM', # ick
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return None
@baseplatform.lazy_property
def GLES2(self):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'GLESv2',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return None
@baseplatform.lazy_property
def GLES3(self):
# implementers guide says to use the same name for the DLL
return self.GLES2
@baseplatform.lazy_property
def GL(self):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
#'GL',
'OpenGL',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return self.GLES2 or self.GLES1
@baseplatform.lazy_property
def GLU(self):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'GLU',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return None
@baseplatform.lazy_property
def GLUT( self ):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'glut',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return None
@baseplatform.lazy_property
def OpenGL(self): return self.GL
@baseplatform.lazy_property
def EGL(self):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'EGL',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
raise ImportError("Unable to load EGL library", *err.args)
@baseplatform.lazy_property
def getExtensionProcedure( self ):
eglGetProcAddress = self.EGL.eglGetProcAddress
eglGetProcAddress.restype = ctypes.c_void_p
return eglGetProcAddress
@baseplatform.lazy_property
def GLE( self ):
try:
return ctypesloader.loadLibrary(
ctypes.cdll,
'gle',
mode=ctypes.RTLD_GLOBAL
)
except OSError as err:
return None
DEFAULT_FUNCTION_TYPE = staticmethod( ctypes.CFUNCTYPE )
@baseplatform.lazy_property
def GetCurrentContext( self ):
return self.EGL.eglGetCurrentContext