Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Dockerfile #80

Closed
florianblume opened this issue Mar 30, 2020 · 11 comments
Closed

Create Dockerfile #80

florianblume opened this issue Mar 30, 2020 · 11 comments
Labels
feature General new features that are not UI features.

Comments

@florianblume
Copy link
Owner

Make it easier for users to run the program by creating a Dockerfile.

@florianblume florianblume added the ui-feature Something the user can actually see (not just code improvements). label Mar 31, 2020
@aditya2592
Copy link

Hi

I was looking at the repo and could see that the Dockerfile is already present. Do you also have the corresponding docker image pushed to dockerhub that I can pull?

@florianblume
Copy link
Owner Author

Hi aditya2592,

sorry for the late response, saw your comment only just now. The docker image actually builds but there are some issues.

It's a two-stage build to use only the compiled libraries of OpenCV in the second stage. This makes the image significantly smaller because OpenCV's unnecessary build files are omitted (2.7GB vs 500MB). But in this two stage build when I try to run the program it doesn't find the OpenCV libraries, although they are definitely there (checkout my question on stackoverflow).

The second issue is that if you omit the two-stage build an accept that the image is 2.7GB, the program doesn't run because it can't connect to the X-display server. So if you have any suggestions on these two issues I'd be happy to implement them ;)

By the way, if I can help you install the program the "normal" way, let me know.

Cheers,
Florian

@aditya2592
Copy link

aditya2592 commented Apr 6, 2020

Hi @florianblume

I was able to get the code running using Docker with the following steps:

  1. Pulled the environment image from Docker (this contains only the build environment as I understand and not the 6D-PAT code) :
docker pull florianblume/6dpat
  1. Clone the repo locally (outside Docker) :
git clone https://github.com/florianblume/6d-pat
  1. For enabling display, execute the following before running the image :
xhost +local:root
  1. Run the image by mounting the 6D-PAT code, NVidia driver folders (for display and rendering using OpenGL) and the images/model folders. The code builds even if you dont mount the NVidia folders but gives an error during runtime :
docker run --privileged \
     -v {models_path}:/data/models \
     -v {images_path}:/data/images \
     -v /usr/lib/nvidia-410:/usr/lib/nvidia-410 \
     -v /usr/lib32/nvidia-410:/usr/lib32/nvidia-410 \
     --env="DISPLAY"  --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"  \
     -v {6D-PAT Code}:/data/6d-pat \
     -it florianblume/6dpat:latest
  • Note, 410 in the above command is my currently active driver version on Ubuntu 16.04. This needs to be changed accordingly for other driver versions
  1. Build 6D-PAT. :
cd /data/6d-pat
mkdir build
cd build 
qmake ../6D-PAT.pro
make -j4
  1. Run 6D-PAT. I dont get any errors with respect to OpenCV this way.
export PATH="/usr/lib/nvidia-410/bin":${PATH}
export LD_LIBRARY_PATH="/usr/lib/nvidia-410:/usr/lib32/nvidia-384":${LD_LIBRARY_PATH}
./6D-PAT

References :

  1. GUI on Docker
  2. NVidia Drivers on Docker

System :

Ubuntu 16.04
NVidia Driver 440.33
NVidia GTX 1070 8GB Graphic Card
Docker 18.09.0

I believe similar steps would also work for a Docker image that contains the 6D-PAT code. But when I tried using that, I was getting errors related to OpenCV as you have pointed out. So I continued to use the environment only image.

After running the steps above, I get the 6D-PAT window as follows. But as you can see I am not able to visualize the renderings of the Models. Do you know what could be the possible reason for this? I am not getting any errors in the terminal as you can see.

6dpat_error

@florianblume
Copy link
Owner Author

Nice that you got it to run using the Dockerfile - you're right, it's just the environment. I should rename it probably to make this more clear. I'd still like to find out how to provide a fully built Dockerfile which allows users to run the project out of the box. I'll try to make a release, too, but a Dockerfile would be nice anyway.

Regarding your rendering problem, it's difficult to tell from the distance what the issue could be. Could you somehow send me one of your models so I can have a look? I'm busy doing my PhD but will try to squeeze it in at some point. I think it might be related to how I set the camera. I'm retrieving the largest coordinates of all vertices and set the camera distance accordingly. I had some issues using other models than the ones from T-Less, so maybe this is not just your problem.

Two more notes:
You seem to have depth images - if you wanted, you could use those as the segmentation images. This would allow you to flip the switch at the bottom of the PoseViewer and this way toggle whether you're seeing the actual image or the depth image.

You also seem to have textured models, I apologize for that my program is currently not able to load textures. I'm planning to implement this (see #44) but am not sure when I'll get round to this.

And I'm always happy to accept pull requests if you want to help improve the program :)

@florianblume florianblume added feature General new features that are not UI features. and removed ui-feature Something the user can actually see (not just code improvements). labels Apr 7, 2020
@aditya2592
Copy link

Thanks for your reply @florianblume. Here is a link to the models I was trying to load. If you get a chance to try them, you can pickup the file called "textured.ply" from the link or "textured.obj". These models are part of the YCB objects standard and the YCB Video dataset. Also, I don't particularly need to load the textures, so if the program skips loading those then its fine.

Regarding the rendering, could it be due to a mismatch of units? The unit used in the model file is "m".

@florianblume
Copy link
Owner Author

I can't see the models either, so it's definitely not the way you ran the tool. The coordinates in the models seem to be really small (e.g. 0.006) so maybe that's the issue although I actually made the program flexible and adapt to the object's size. I'll try to have a deeper look into it some time this week.

@florianblume
Copy link
Owner Author

I was thinking, maybe you could try to find out what the differences are between the T-Less and the YCB dataset. If for example there's a size difference and you get the YCB dataset models to show when you resize them, this would help me narrow down the error. I'm not sure when I'll have time to investigate this in-depth, unfortunately.

@aditya2592
Copy link

Thanks for the quick check @florianblume. I will check the differences between the models.

@florianblume
Copy link
Owner Author

Hey @aditya2592, did you make any progress on the models? I tried some simple Qt3D code and was able to display them. Might be that the camera settings are wrong as they are now in 6D-PAT. There's an issue here that I opened regarding this problem.

I'm closing this issue now because I was able to create a full docker image. You can find it here: https://hub.docker.com/repository/docker/florianblume/6dpat. But I feel like it's a bit more laggy that's why I created a second repository https://hub.docker.com/repository/docker/florianblume/6dpat-environment which I'll push an image to shortly which you can use like you described in your comment. I also used your manual how to build and launch the program this way in a readme. I hope that's ok for you :)

@aditya2592
Copy link

Hi @florianblume. Thank you for looking into the issue earlier. I was able to use the environment image and run the code on a different machine. However, I was trying to annotate another dataset and I am facing a similar issue as with the YCB models. Though I am using a different very simple model this time that has no texture. Its present here. Would it be possible to check why the rendering is not happening with this model?

@florianblume
Copy link
Owner Author

Could you verify that with the new release the issue is gone? I switched back to Qt3D and the models should show now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature General new features that are not UI features.
Projects
None yet
Development

No branches or pull requests

2 participants