wenbowen123 / catgrasp

[ICRA 2022] CaTGrasp: Learning Category-Level Task-Relevant Grasping in Clutter from Simulation
Apache License 2.0
298 stars 82 forks source link

The demo script cannot run due to an error #21

Closed robodreamer closed 2 years ago

robodreamer commented 2 years ago

Hi Bowen,

I really enjoyed listening to your talk at RSS2022. Your work was really inspiring and I am trying out your code example now to get a better understanding of your work. I tried to follow your instruction, and set up everything and was able to run the script run_grasp_simulation.py. The GUI simulation view showed up but crashed after a bit. It seems that there was an error saying CUDA out of memory (see the error messages below). The machine I use for testing your code has 4GB of GPU memory, and I think the memory should be enough? From my googling of the issues, it seems to be related to the batch size, but it still did not work after reducing all the batch_size settings in the code to half the sizes. Can you help me out? Thanks!

eval grasps 240/407
eval grasps 280/407
eval grasps 320/407
eval grasps 360/407
eval grasps 400/407
Traceback (most recent call last):
  File "run_grasp_simulation.py", line 717, in <module>
    simulate_grasp_with_arm()
  File "run_grasp_simulation.py", line 575, in simulate_grasp_with_arm
    for grasps in compute_candidate_grasp(rgb,depth,seg,i_pick=i_pick,env=env,ags=ags,symmetry_tfs=symmetry_tfs,ik_func=ik_func):
  File "run_grasp_simulation.py", line 310, in compute_candidate_grasp
    ret = grasp_predicter.predict_batch(data,grasp_poses)
  File "/home/catgrasp/predicter.py", line 85, in predict_batch
    pred = self.model(input_data)[0]
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/catgrasp/pointnet2.py", line 294, in forward
    x, trans, trans_feat = self.feat(x)
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/catgrasp/pointnet2.py", line 255, in forward
    trans_feat = self.fstn(x)
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/catgrasp/pointnet2.py", line 212, in forward
    x = F.relu(self.bn3(self.conv3(x)))
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward
    exponential_average_factor, self.eps)
  File "/opt/conda/envs/catgrasp/lib/python3.7/site-packages/torch/nn/functional.py", line 1656, in batch_norm
    training, momentum, eps, torch.backends.cudnn.enabled
RuntimeError: CUDA out of memory. Tried to allocate 656.00 MiB (GPU 0; 3.82 GiB total capacity; 840.13 MiB already allocated; 406.75 MiB free; 765.87 MiB cached)
numActiveThreads = 0
stopping threads
Thread with taskId 0 exiting
Thread TERMINATED
destroy semaphore
semaphore destroyed
destroy main semaphore
main semaphore destroyed

Best, -- Andy

wenbowen123 commented 2 years ago

Hi Andy, thanks for your interest! 4GB memory is too small. Please try with a larger memory GPU.