facebookresearch / InterHand2.6M

Official PyTorch implementation of "InterHand2.6M: A Dataset and Baseline for 3D Interacting Hand Pose Estimation from a Single RGB Image", ECCV 2020
Other
675 stars 92 forks source link

render.py error #120

Closed redorangeyellowy closed 2 years ago

redorangeyellowy commented 2 years ago

Thank you for your great work.

When you run the render.py file, the following error occurs.

Traceback (most recent call last):
  File "render.py", line 117, in <module>
    rgb, depth = renderer.render(scene, flags=pyrender.RenderFlags.RGBA)
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/offscreen.py", line 86, in render
    self._platform.make_current()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 198, in make_current
    self._egl_context
  File "src/errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
        err = 12289,
        baseOperation = eglMakeCurrent,
        cArguments = (
                <OpenGL._opaque.EGLDisplay_pointer object at 0x7f96e527d680>,
                <OpenGL._opaque.EGLSurface_pointer object at 0x7f96e5755830>,
                <OpenGL._opaque.EGLSurface_pointer object at 0x7f96e5755830>,
                <OpenGL._opaque.EGLContext_pointer object at 0x7f96e527d8c0>,
        ),
        result = 0
)

It's hard to find a clear problem even if I google it. Can you tell me why this problem is happening?

mks0601 commented 2 years ago

Did you run the codes on a machine without a display device?

redorangeyellowy commented 2 years ago

Yes, I accessed the server through ssh and executed the code.

Can't I save the rendering result as an image file and check it without display device?

mks0601 commented 2 years ago

Try toswitch egl to osmesa in here: https://github.com/facebookresearch/InterHand2.6M/blob/2b8061d2c8e762aa6fcb8e6f5d18f8a9e83bfd0c/tool/MANO_render/render.py#L9

redorangeyellowy commented 2 years ago

When I switch egl to osmesa, the following error occured:

Traceback (most recent call last):
  File "render.py", line 11, in <module>
    import pyrender
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/__init__.py", line 3, in <module>
    from .light import Light, PointLight, DirectionalLight, SpotLight
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/light.py", line 10, in <module>
    from OpenGL.GL import *
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/GL/__init__.py", line 3, in <module>
    from OpenGL import error as _error
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/error.py", line 12, in <module>
    from OpenGL import platform, _configflags
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/__init__.py", line 35, in <module>
    _load()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/__init__.py", line 32, in _load
    plugin.install(globals())
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 92, in install
    namespace[ name ] = getattr(self,name,None)
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 14, in __get__
    value = self.fget( obj )
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/osmesa.py", line 66, in GetCurrentContext
    function = self.OSMesa.OSMesaGetCurrentContext
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 14, in __get__
    value = self.fget( obj )
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/osmesa.py", line 60, in OSMesa
    def OSMesa( self ): return self.GL
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 14, in __get__
    value = self.fget( obj )
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/platform/osmesa.py", line 28, in GL
    raise ImportError("Unable to load OpenGL library", *err.args)
ImportError: ('Unable to load OpenGL library', 'OSMesa: cannot open shared object file: No such file or directory', 'OSMesa', None)

So, I tried to googling and it was said that the command sudo apt-get install libosmesa6-dev solves the error, but as a result of the execution, the following error occurred:

Traceback (most recent call last):
  File "render.py", line 104, in <module>
    renderer = pyrender.OffscreenRenderer(viewport_width=img_width, viewport_height=img_height, point_size=1.0)
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/offscreen.py", line 149, in _create
    self._platform.init_context()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/platforms/osmesa.py", line 19, in init_context
    from OpenGL.osmesa import (
ImportError: cannot import name 'OSMesaCreateContextAttribs' from 'OpenGL.osmesa' (/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/OpenGL/osmesa/__init__.py)

As a result of googling again, it was determined that the above error was caused by a PyOpenGL version compatibility problem. So after upgrading it to 3.1.5 version, render.py was run. As a result, the following error occurred:

Traceback (most recent call last):
  File "render.py", line 112, in <module>
    renderer = pyrender.OffscreenRenderer(viewport_width=img_width, viewport_height=img_height, point_size=1.0)
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/offscreen.py", line 150, in _create
    self._platform.make_current()
  File "/home/abc/miniconda3/envs/interhand/lib/python3.7/site-packages/pyrender/platforms/osmesa.py", line 44, in make_current
    self.viewport_width, self.viewport_height
AssertionError

Do you have any other ideas on what to do?

mks0601 commented 2 years ago

Maybe you should try the rendering on a device with monitor :( Usually, you can render images on a devixe without moninor by switching egl to osmesa

redorangeyellowy commented 2 years ago

Okay, but thank you for your help.