naver / posescript

Other
104 stars 8 forks source link

demo_generative_modifier.py Error #13

Open minjung98 opened 1 month ago

minjung98 commented 1 month ago

Hello, I am learning a lot thanks to your nice project.

I have some errors running demo_generative_modifier.py file. Here is the command I used to run demo_generative_modifier.py.

(posefix) minjung@server8:~/posescript/src$ streamlit run text2pose/generative_modifier/demo_generative_modifier.py -- --model_paths /home/minjung/posescript/experiments/modgen_CAtransfPFAHPP_dataPFAftPFH/seed1/checkpoint_best.pth

  1. First, I'd like to ask if it's correct to run this command from the /posescript/src directory. I'm having an issue where text2pose is not recognized as a module, so I set the environment variable with the following command and resolved the ModuleNotFound error for text2pose. export PYTHONPATH="/home/minjung/posescript/src:$PYTHONPATH" I just want to confirm that the way I handled it was correct, which is why I asked the first question.

After resolving the error described above, I encountered the following issue when I ran the script. Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False. You can now view your Streamlit app in your browser. File not found: shortname_2_model_path.txt - Please ensure you are launching operations from the right directory. Simply reruning the app (hamburger menu > 'Rerun') may be enough to get rid of a potential 'GLError'. Loaded model from (epoch 399): /home/minjung/posescript/experiments/modgen_CAtransfPFAHPP_dataPFAftPFH/seed1/checkpoint_best.pth 2024-06-07 06:28:07.361 Uncaught app exception Traceback (most recent call last): File "/home/minjung/.conda/envs/posefix/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.__dict__) File "/home/minjung/posescript/src/text2pose/generative_modifier/demo_generative_modifier.py", line 65, in <module> pair_ID, pid_A, pid_B, pose_A_data, pose_B_data, pose_A_img, pose_B_img, default_modifier = demo.get_posefix_datapoint(number, query_type, split_for_research, triplet_data, pose_pairs, dataID_2_pose_info, body_model) File "/home/minjung/posescript/src/text2pose/demo.py", line 245, in get_posefix_datapoint pose_A_img = utils_visu.image_from_pose_data(pose_A_data, body_model, color="grey", add_ground_plane=True, two_views=60) File "/home/minjung/posescript/src/text2pose/utils_visu.py", line 152, in image_from_pose_data imgs = image_from_body_vertices(c2c(body_out.v[i]), c2c(body_model.f), viewpoints=viewpoints, color=color, add_ground_plane=add_ground_plane, two_views=two_views) File "/home/minjung/posescript/src/text2pose/utils_visu.py", line 223, in image_from_body_vertices body_image = mv.render(render_wireframe=False) File "/home/minjung/.conda/envs/posefix/lib/python3.8/site-packages/body_visualizer/mesh/mesh_viewer.py", line 148, in render color_img, depth_img = self.viewer.render(self.scene, flags=flags) File "/home/minjung/.conda/envs/posefix/lib/python3.8/site-packages/pyrender/offscreen.py", line 86, in render self._platform.make_current() File "/home/minjung/.conda/envs/posefix/lib/python3.8/site-packages/pyrender/platforms/egl.py", line 196, in make_current assert eglMakeCurrent( File "/home/minjung/.conda/envs/posefix/lib/python3.8/site-packages/OpenGL/error.py", line 228, in glCheckError raise GLError( OpenGL.error.GLError: GLError( err = 12290, baseOperation = eglMakeCurrent, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7f9eaa6bb440>, <OpenGL._opaque.EGLSurface_pointer object at 0x7f9eaa756dc0>, <OpenGL._opaque.EGLSurface_pointer object at 0x7f9eaa756dc0>, <OpenGL._opaque.EGLContext_pointer object at 0x7f9eaa6bb540>, ), result = 0 )

  1. My second question is about this line: 'File not found: shortname_2_model_path.txt - Please ensure you are launching operations from the right directory.' I definitely have this file in '/home/minjung/posescript/src/text2pose/shortname_2_model_path.txt', and I have accurately entered the locations of each model inside it, but I don't understand why it's not recognizing this txt file

  2. My third question is about a GLError. I tried clicking the 'Rerun' button from the hamburger menu as suggested in the error message, but it was no use.

I would like to express my thanks in advance to the author who will answer this question.

g-delmas commented 1 month ago

Hi,

I am glad you find this repo useful :)

  1. You should run the commands from /posescript/src/text2pose. To make text2pose recognized as a module, you can also run python setup.py develop from the main code directory (/posescript/).
  2. The underlying problem is the same as for point 1: you should run the command from /posescript/src/textpose. The command should look like: streamlit run generative_modifier/demo_generative_modifier.py -- --model_paths <your_model_path>.
  3. Unfortunately, these GLErrors tend to be a bit capricious... You can try to kill the process (ctrl+c) then re-run the command. Sometimes, when an error happens in the script and you correct it while it's running, it curiously messes up things on the OpenGL side, and you have to reinitialize the full process by starting the application again. The reason behind this is possibly the creation of multiple instances of the renderer (past instances need to be deleted) -- see hints here. I've run into this problem a few times, and I have been planning to write a cleaner process for this repo, but couldn't find the time for it yet. In the meantime, the current script should work, but it's prone to crash, depending on potential modifications... Please let me know if you still have this error after solving points 1 & 2, and relaunching the process with the command line.
minjung98 commented 1 month ago

Thank you for your prompt and kind reply. Thanks to your help, I was able to resolve issues 1 and 2, and they are no longer causing errors. However, issue 3 remains unresolved. You mentioned that GLError can be capricious, but in my experience, it's not that GLError comes and goes; the demo has never run properly, and GLError occurs every time I try to run it. I will try to find a solution myself, taking into account the hints you provided. If you happen to find a solution to this problem, I would appreciate it if you could let me know in a comment.

g-delmas commented 1 month ago

I will! Just by curiosity, do you have any GLError when running streamlit run posefix/explore_posefix.py?

minjung98 commented 1 month ago

No, I ran streamlit run generative_modifier/demo_generative_modifier.py -- --model_paths </path/to/model.pth>

g-delmas commented 1 month ago

If you want to debug GLErrors using a simpler application, you can use streamlit run posefix/explore_posefix.py; the rendering process throwing GLErrors is the same as for generative_modifier/demo_generative_modifier.py. Unfortunately, I could not reproduce the persistent error; both work on my side... maybe it's a problem of environment...