Giter VIP home page Giter VIP logo

graspgpt_public's Introduction

An Official Code Implementation of GraspGPT & FoundationGrasp

GraspGPT: Leveraging Semantic Knowledge from a Large Language Model for Task-Oriented Grasping (RA-L 2023)

[paper] [website] [video]

Chao Tang, Dehao Huang, Wenqi Ge, Weiyu Liu, Hong Zhang
Southern University of Science and Technology, Georgia Institute of Technology

This is a Pytorch implementation of GraspGPT. If you find this work useful, please cite:

@article{tang2023graspgpt,
  title={GraspGPT: Leveraging Semantic Knowledge from a Large Language Model for Task-Oriented Grasping},
  author={Tang, Chao and Huang, Dehao and Ge, Wenqi and Liu, Weiyu and Zhang, Hong},
  journal={IEEE Robotics and Automation Letters},
  year={2023},
  publisher={IEEE}
}

We have borrowed tons of code from GCNGrasp. Please also consider citing their work:

@inproceedings{murali2020taskgrasp,
  title={Same Object, Different Grasps: Data and Semantic Knowledge for Task-Oriented Grasping},
  author={Murali, Adithyavairavan and Liu, Weiyu and Marino, Kenneth and Chernova, Sonia and Gupta, Abhinav},
  booktitle={Conference on Robot Learning},
  year={2020}
}

Note that we provide a light-weight version of GraspGPT in this repo. It is with faster inference speed and easier to train. Also, the model achieves comparable performance to the one described in our paper.

Installation

Our code is tested on Ubuntu 20.04, python 3.7, cuda 11.3, pytorch 1.11.0, and pytorch lightning 0.7.1.

  1. Create a virtual env or conda environment with python 3.7:
conda create --name graspgpt python=3.7
conda activate graspgpt
  1. Git clone the repo to your machine:
git clone https://github.com/mkt1412/GraspGPT_public.git
  1. Install dependencies:
cd GraspGPT_public
conda install pytorch==1.11.0 torchvision==0.12.0 cudatoolkit=11.3 -c pytorch
pip install -r requirements.txt

Dataset

The Language Augmented TaskGrasp (LA-TaskGrasp) dataset is developed based on TaskGrasp dataset. To perform training and evaluation on the LA-TaskGrasp dataset, download the dataset here and place it in the root folder as data:

unzip ~/Downloads/data.zip -d ./
rm ~/Downloads/data.zip

To visualize the collected point clouds and labeled task-oriented grasps, please refer to the github repo of TaskGrasp dataset under Usage section.

To run any of the demo scripts below, download the pre-trained models here and put them in the checkpoints folder.

Demo

We provide two types of demos:

  • Database version, where GraspGPT uses the pre-generated natural language descriptions for task-oriented grasp pose prediction.
  • Interactive version, where GraspGPT interacts with an LLM via prompts to generate language descriptions for task-oriented grasping.

Pre-trained models for each class and task split are provided:

gcngrasp_split_mode_o_split_idx_0_.yml
gcngrasp_split_mode_o_split_idx_1_.yml
gcngrasp_split_mode_o_split_idx_2_.yml
gcngrasp_split_mode_o_split_idx_3_.yml

gcngrasp_split_mode_t_split_idx_0_.yml
gcngrasp_split_mode_t_split_idx_1_.yml
gcngrasp_split_mode_t_split_idx_2_.yml
gcngrasp_split_mode_t_split_idx_3_.yml

Database version

Objetc class: pan, task: pour

python gcngrasp/demo_db.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name pan --obj_class saucepan --task pour

Objetc class: spatula, task: scoop

python gcngrasp/demo_db.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name spatula --obj_class spatula --task scoop

Objetc class: mug, task: drink

python gcngrasp/demo_db.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name mug --obj_class mug --task drink

Interactive version

To run interactive version on your machine, you need to set your OpenAI API key in gcngrasp/data_specificatgion.py line 116.

OPENAI_API_KEY = "xx-xxxxxx"   

Objetc class: pan, task: pour

python gcngrasp/demo_llm.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name pan --obj_class saucepan --task pour

Objetc class: spatula, task: scoop

python gcngrasp/demo_llm.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name spatula --obj_class spatula --task scoop

Objetc class: mug, task: drink

python gcngrasp/demo_llm.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0_.yml --obj_name mug --obj_class mug --task drink

Training

To train GraspGPT from scratch:

python gcngrasp/train.py --cfg_file cfg/train/gcngrasp/gcngrasp_split_mode_t_split_idx_3_.yml

You can replace t_split_idx_3 with other split numbers (i.e., 0, 1, 2) or object class split (i.e., o_split_x).

Evaluation

To evaluate a pre-trained model:

python gcngrasp/eval.py cfg/eval/gcngrasp/gcngrasp_split_mode_t_split_idx_3_.yml --save

Similarly, feel free to try out different split numbers and object class split.

FoundationGrasp: Generalizable Task-Oriented Grasping with Foundation Models

[preprint] [website] [video]

Chao Tang, Dehao Huang, Wenlong Dong, Ruinian Xu, Hong Zhang

Since FoundationGrasp is an extension of GraspGPT, we do not provide a separate GitHub repo for the code implementation and data of FoundationGrasp. If you find FoundationGrasp useful in your research, please cite:

@article{tang2024foundationgrasp,
  title={FoundationGrasp: Generalizable Task-Oriented Grasping with Foundation Models},
  author={Tang, Chao and Huang, Dehao and Dong, Wenlong and Xu, Ruinian and Zhang, Hong},
  journal={arXiv preprint arXiv:2404.10399},
  year={2024}
}

Data

Step 1. Download the original LA-TaskGrasp dataset here and place it in the root folder as data.
Step 2. Download the updated language description data of the LaViA-TaskGrasp dataset here and replace the old one in the LA-TaskGrasp dataset (i.e., obj_gpt_vx, task_gpt_vx).
Step 3. For language instruction data, please refer to data/task_ins_v2.
Step 4. For image data, please refer to data/rgb_images.
Step 5. Modify the dataloader in gcngrasp/data/GCNLoader.py so that the model can read the updated language description and image data.

Code Implementation

Step 1. The semantic branch of FoundationGrasp is similar to GraspGPT. Feel free to use to the code implementation of GraspGPT provided above.
Step 2. The geometric branch of FoundationGrasp is largely inspired by XMFNet. Please refer to XMFnet/model.py to reproduce the geometric branch.

graspgpt_public's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

graspgpt_public's Issues

The Task-Oriented Grasp Evaluator

I re-implement the Task-Oriented Grasp Evaluator (TGE) module proposed in your paper, following the architecture depicted in your letter. Howerer, the performance is even worse. I am sure that I follow all the details (e.g. the dimension, the multi-head attention). I wonder if there are any more information about the TGE module, and what should I do to achieve the results you provided in the paper.

By the way, the links for downloading the LA-TaskGrasp and the checkpoints are invalid.

CUDA kernel failed : no kernel image is available for execution on the device

Hi team, thank you so much for your work.

I got a problem as the tittle shows. A lot of search work has been done, I eventially found it is an old problem of PointNet2. (see https://github.com/erikwijmans/Pointnet2_PyTorch/issues?q=furthest_point_sampling_kernel_wrapper)

I believe the problem is caused by the version of python, pytorch and CUDA.

I followed your instruction and tried:
1. Python 3.7.1 + torcu 1.11.0 + CUDA 11.3
2. Python 3.7.9 + torch 1.11.0 + CUDA 11.3
3. Python 3.7.9 + torch 1.11.0 + CUDA 10.0
but there is no lucky.

My GPU is 4090.

Please can I ask what specific version of python you used? And if you can advise me of any hint for the problem, it would be much appreciated.

Any schedule to release FoundationGrasp code?

Hi, thank you for open-sourcing the GraspGPT code for re-implementation. I noticed that you recently released a more advanced method, FoundationGrasp. It would be grateful if you could release its code as well.

Missing Description Files

Hi,
thanks for the great work, I got the following error during evaluation 'No such object description dir: gcngrasp/../data/taskgrasp/obj_gpt_v2/scrub_brush/descriptions/5', where should I download this obj_gpt_v2 folder?

The full version of GraspGPT

I have tried the lite version of GraspGPT, and the performance is relatively low. Therefore, I wonder when will you open source the full version of GraspGPT (i.e. the attention-based implementation of the Task-Oriented Grasp Evaluator). Thank you !

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (32,) + inhomogeneous part.

Hi, team
Thanks for sharing the wonderful project!
I followed the README and successfully configured the env. However, when I was running the Database version Demo (Objetc class: pan, task: pour) by: python gcngrasp/demo_db.py --cfg_file cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0.yml --obj_name pan --obj_class saucepan --task pour_, I met this BUG:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (32,) + inhomogeneous part.
################################################
Here is the content shown in my terminal when I was running the demo:

-task pour
algorithm_class: GCNGrasp
base_dir: gcngrasp/../data
batch_size: 16
dataset_class: GCNTaskGrasp
distrib_backend: dp
embedding_mode: 2
embedding_model: numberbatch
embedding_size: 300
epochs: 50
folder_dir: taskgrasp
gcn_conv_type: GCNConv
gcn_num_layers: 6
gcn_skip_mode: 0
gpus: [0]
graph_data_path: kb2_task_wn_noi
include_reverse_relations: True
instance_agnostic_mode: 1
log_dir: checkpoints/
model:
use_normal: False
use_xyz: True
name: gcngrasp_split_mode_o_split_idx_0_
num_points: 4096
optimizer:
bn_momentum: 0.5
bnm_clip: 0.01
bnm_decay: 0.5
decay_step: 20000.0
lr: 0.0001
lr_clip: 1e-05
lr_decay: 0.7
weight_decay: 0.0001
patience: 50
pc_scaling: True
pretrained_weight_file:
pretraining_mode: 0
sampling_radius: 2
split_idx: 0
split_mode: o
split_version: 1
subgraph_sampling: True
use_class_list: True
use_task1_grasps: True
weight_file: checkpoints/gcngrasp_split_mode_o_split_idx_0__2023-08-15-18-59/weights/ckpt_epoch_42.ckpt
weighted_sampling: True
########################
Namespace(cfg_file='cfg/eval/gcngrasp/gcngrasp_split_mode_o_split_idx_0
.yml', data_dir='gcngrasp/../data/sample_data', obj_class='saucepan', obj_name='pan', task='pour')
Unable to find clean pc and grasps
Traceback (most recent call last):
File "gcngrasp/demo_db.py", line 273, in
main(args, cfg)
File "gcngrasp/demo_db.py", line 126, in main
pc, grasps = load_pc_and_grasps(os.path.join(data_dir, 'pcs'), obj_name)
File "gcngrasp/demo_db.py", line 97, in load_pc_and_grasps
grasps = farthest_grasps(
File "/home/zhengshen/GraspGPT_public/gcngrasp/data/../../geometry_utils.py", line 230, in farthest_grasps
grasps_fps = cluster_grasps(grasps, num_clusters=num_clusters)
File "/home/zhengshen/GraspGPT_public/gcngrasp/data/../../geometry_utils.py", line 107, in cluster_grasps
output_grasps = np.asarray(output_grasps)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (32,) + inhomogeneous part.
################################################
When I tried the other two examples (Objetc class: spatula, task: scoop, Objetc class: mug, task: drink), I also met the same BUG.
Could you please help me to solve this BUG?

Best regards,
Zhengshen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.