ammar-n-abbas / FoundationPoseROS2

FoundationPoseROS2 is a ROS2-integrated system for 6D object pose estimation and tracking, based on the FoundationPose architecture. It uses RealSense2 with the Segment Anything Model 2 (SAM2) framework for end-to-end, model-based, real-time pose estimation and tracking of novel objects.
MIT License
19 stars 6 forks source link

torch.cuda.OutOfMemoryError: #4

Closed Muhayyuddin closed 2 weeks ago

Muhayyuddin commented 2 weeks ago

Hi, Thank you very much for your nice work. I successfully build FoundationPoseRos2 within a docker container, when I run the code it shows the selection window after selecting it also display the segmentation but when i select the cube in the segmented image, it generate an error of cuda outofMemory. below are some screenshots of the execution and the error. any Idea to fix this issue thanks. Screenshot from 2024-11-08 23-59-59 Screenshot from 2024-11-09 00-00-16 Screenshot from 2024-11-08 23-58-05

ammar-n-abbas commented 2 weeks ago

Do you have a 6GB GPU, it would be at least 8-16GB

Muhayyuddin commented 2 weeks ago

Oh ok thanks for highlighting the minimum GPU requirement issue. I will try with higher GPU thanks

ammar-n-abbas commented 2 weeks ago

Also, if you are using a custom model, make sure it's mesh is not too detailed (fine) and heavy.

mcres commented 1 week ago

I've experienced the same error (with a valid GPU). In my case, it helped lowering down both color and depth cameras resolution from 1280x720 to 848x480 to prevent the script from crashing.

I'd say the problem is the resolution, not so much the FPS. I guess that the reason is that images that are not processed are simply discarded, thus not adding computational load to the GPU.

@ammar-n-abbas do you have some intuition regarding maximum STL/OBJ file size allowed? Could you also illustrate what a detailed mesh could be with an example?

ammar-n-abbas commented 1 week ago

There was a minor bug in the code which has been fixed now, apologies for that. The demo data rosbag screen recording has now been added in the Readme along with the terminal log.

@Muhayyuddin can you test it out with your 6GB GPU?

Muhayyuddin commented 1 week ago

Thank you @ammar-n-abbas for your hard work ok, I will try it on the PC with lower GPU and will let you know.