anibali / margipose

3D monocular human pose estimation
Apache License 2.0
97 stars 20 forks source link

Trying to run preprocess model in a remote server with ssh -X #35

Open Paulaquev opened 2 years ago

Paulaquev commented 2 years ago

When I try to execute run.sh this error comes up: ERROR X11 connection rejected because of wrong authentication. _tkinter.TclError: couldn't connect to display "localhost:10.0"

I have logged in the remote server with -X, I have plot some figures using matplotlib executing a really simple python script to try out if the host display is correctly connected with the server. It worked so the problem comes when docker try to connect with the display (localhost10:0). I have try a few things to solve it but they did not work. I have try xhost + and also adding the volume $HOME/.Xauthority:/root/.Xauthority:rw to allow docker to acces the .Xauthority file. I add the volume to the docke-compose.yml as you can see in the next screenshot: volume

¿Do you know how to solve this authentication error? I would really appreciate if you could help me.

anibali commented 2 years ago

This issue does not seem like it is specific to MargiPose. Could you try running the following to determine whether you can see a window in a simpler setup (replace "remote" with your server address):

local$ ssh -X remote
remote$ docker run --rm -it --init --net=host -e "DISPLAY" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --volume="$HOME/.Xauthority:/tmp/.Xauthority:ro" \
    anibali/pytorch:1.10.0-nocuda \
    sh -c 'sudo cp /tmp/.Xauthority ~/.Xauthority && sudo chown user ~/.Xauthority && python3 -c "import tkinter; tkinter.Tk().mainloop()"'

Also check out the answers here, I found them quite useful myself: https://superuser.com/questions/1202611/forward-x11-over-an-ssh-connection-to-containers-host

Paulaquev commented 2 years ago

Thank you. ¿Can I change de code to save the ouputs instead of ploting them? I can not use a display. I want to use the pretrained models buth withouth the GUI app.

anibali commented 2 years ago

Sure, that shouldn't be too difficult for you to do---just change https://github.com/anibali/margipose/blob/2933f30203b3cd5c636917a7c9ff107d02434598/src/margipose/bin/infer_single.py#L75 to write out norm_skel3d instead of plotting.