Skip to content

Commit

Permalink
Merge pull request #1 from stanford-iprl-lab/data-viz
Browse files Browse the repository at this point in the history
Add PointNet2 dependency and installation info
  • Loading branch information
ClaireLC authored Mar 4, 2024
2 parents 3fc2b90 + 93cc2df commit 072f292
Show file tree
Hide file tree
Showing 52 changed files with 2,813 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Summary

<!--- Why is this change required? What problem does it solve? -->

Motivation:

<!--- List all new functionality with high level descriptions. -->

Changes:
- First change
- Second change

<!--- Please link to an existing issue here if one exists. -->

Fixes # (issue)

## Test plan

<!--- Please describe here how your modifications have been tested. -->
<!--- What command line was used to run or test your change? -->
<!--- Provide learning curves if you tested the change with training models. -->

Screenshot of before versus after: <img>

Link to wandb report: <URL>

## Type of change

- [ ] Documentation only change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] Refactor (non-breaking change that isn't a bug)
- [ ] New feature (non-breaking change that adds a new functionality)
- [ ] Breaking change (fix or feature that would break some existing functionality downstream)

## Type of requested review

- [ ] I want a high level review.
- [ ] I want a design review.
- [ ] I want a review of the implementation.

## Checklist:

- [ ] I have performed manual end-to-end testing of the feature in my environment.
- [ ] I have added tests that show that the PR is functional.
- [ ] I have documented my changes.
- [ ] I have added relevant collaborators to review the PR before merge.
33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint

on:
push:
branches:
- '**'

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install Python dependencies
run: pip install black

- name: Run linters
uses: wearerequired/lint-action@v2
with:
auto_fix: true
black: true
black_auto_fix: true
git_name: "Lint Action"
git_email: "[email protected]"

20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# AO-Grasp: Articulated Object Grasp Generation

## Installation

1. Create a conda environment:
```
conda create -n <ENV_NAME> python==3.7
```

2. Install PyTorch:

```
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
```

3. Install PointNet++. In the `ao-grasp` conda env, install PointNet2_PyTorch from the directory contained within this repo by running the following commands:
```
cd ao-grasp/ao-grasp/Pointnet2_PyTorch
pip install -r requirements.txt
pip install -e .
```
25 changes: 25 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
__pycache__
*.pth*
.autoenv*
runs
build
checkpoints
*.prof
.lvimrc
.vimtags
.ccls
.ccls-cache/
dist/
pointnet2.egg-info/
*.zip
*.so
.tox/
.mypy_cache
**/*.pyc
pointnet2_ops.egg-info/


pointnet2/data/modelnet40_normal_resampled/
pointnet2/data/modelnet40_normal_resampled_cache/
pointnet2/data/modelnet40_ply_hdf5_2048/
outputs/
126 changes: 126 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Pointnet2/Pointnet++ PyTorch
============================


**Project Status**: Unmaintained. Due to finite time, I have no plans to update this code and I will not be responding to issues.

* Implemention of Pointnet2/Pointnet++ written in `PyTorch <http://pytorch.org>`_.

* Supports Multi-GPU via `nn.DataParallel <https://pytorch.org/docs/stable/nn.html#torch.nn.DataParallel>`_.

* Supports PyTorch version >= 1.0.0. Use `v1.0 <https://github.com/erikwijmans/Pointnet2_PyTorch/releases/tag/v1.0>`_
for support of older versions of PyTorch.


See the official code release for the paper (in tensorflow), `charlesq34/pointnet2 <https://github.com/charlesq34/pointnet2>`_,
for official model definitions and hyper-parameters.

The custom ops used by Pointnet++ are currently **ONLY** supported on the GPU using CUDA.

Setup
-----

* Install ``python`` -- This repo is tested with ``{3.6, 3.7}``

* Install ``pytorch`` with CUDA -- This repo is tested with ``{1.4, 1.5}``.
It may work with versions newer than ``1.5``, but this is not guaranteed.


* Install dependencies

::

pip install -r requirements.txt







Example training
----------------

Install with: ``pip install -e .``

There example training script can be found in ``pointnet2/train.py``. The training examples are built
using `PyTorch Lightning <https://github.com/williamFalcon/pytorch-lightning>`_ and `Hydra <https://hydra.cc/>`_.


A classifion pointnet can be trained as

::

python pointnet2/train.py task=cls

# Or with model=msg for multi-scale grouping

python pointnet2/train.py task=cls model=msg


Similarly, semantic segmentation can be trained by changing the task to ``semseg``

::

python pointnet2/train.py task=semseg



Multi-GPU training can be enabled by passing a list of GPU ids to use, for instance

::

python pointnet2/train.py task=cls gpus=[0,1,2,3]


Building only the CUDA kernels
----------------------------------


::

pip install pointnet2_ops_lib/.

# Or if you would like to install them directly (this can also be used in a requirements.txt)

pip install "git+git://github.com/erikwijmans/Pointnet2_PyTorch.git#egg=pointnet2_ops&subdirectory=pointnet2_ops_lib"






Contributing
------------

This repository uses `black <https://github.com/ambv/black>`_ for linting and style enforcement on python code.
For c++/cuda code,
`clang-format <https://clang.llvm.org/docs/ClangFormat.html>`_ is used for style. The simplest way to
comply with style is via `pre-commit <https://pre-commit.com/>`_

::

pip install pre-commit
pre-commit install



Citation
--------

::

@article{pytorchpointnet++,
Author = {Erik Wijmans},
Title = {Pointnet++ Pytorch},
Journal = {https://github.com/erikwijmans/Pointnet2_PyTorch},
Year = {2018}
}

@inproceedings{qi2017pointnet++,
title={Pointnet++: Deep hierarchical feature learning on point sets in a metric space},
author={Qi, Charles Ruizhongtai and Yi, Li and Su, Hao and Guibas, Leonidas J},
booktitle={Advances in Neural Information Processing Systems},
pages={5099--5108},
year={2017}
}
2 changes: 2 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/pointnet2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from pointnet2 import data, models, utils
from pointnet2._version import __version__
1 change: 1 addition & 0 deletions ao-grasp/models/Pointnet2_PyTorch/pointnet2/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "3.0.0"
19 changes: 19 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/pointnet2/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defaults:
- task: cls
- model: ssg
- task_model: ${defaults.0.task}-${defaults.1.model}

hydra:
run:
dir: outputs

gpus:
- 0

optimizer: ???

task_model: ???

model: ???

distrib_backend: dp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model:
use_xyz: True
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model:
use_xyz: True
12 changes: 12 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/pointnet2/config/task/cls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
optimizer:
weight_decay: 0.0
lr: 1e-3
lr_decay: 0.7
bn_momentum: 0.5
bnm_decay: 0.5
decay_step: 2e4


num_points: 4096
epochs: 200
batch_size: 32
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
optimizer:
weight_decay: 0.0
lr: 1e-3
lr_decay: 0.5
bn_momentum: 0.5
bnm_decay: 0.5
decay_step: 3e5

num_points: 4096
epochs: 50
batch_size: 24
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task_model:
class: pointnet2.models.PointNet2ClassificationMSG
name: cls-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task_model:
class: pointnet2.models.PointNet2ClassificationSSG
name: cls-ssg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task_model:
class: pointnet2.models.PointNet2SemSegMSG
name: sem-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
task_model:
class: pointnet2.models.PointNet2SemSegSSG
name: sem-ssg
2 changes: 2 additions & 0 deletions ao-grasp/models/Pointnet2_PyTorch/pointnet2/data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
indoor3d_sem_seg_hdf5_data
modelnet40_ply_hdf5_2048
Loading

0 comments on commit 072f292

Please sign in to comment.