Skip to content

Commit f20fe5d

Browse files
committed
cleanup + readme update
1 parent 7a46a37 commit f20fe5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+160
-2385
lines changed

.style.yapf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[style]
2+
based_on_style = chromium
3+
column_limit = 100
4+
indent_width = 4

README.md

+70-123
Original file line numberDiff line numberDiff line change
@@ -2,146 +2,93 @@
22

33
This is the source code for the paper `3D-R2N2: A Unified Approach for Single and Multi-view 3D Object Reconstruction, ECCV 2016`. Given one or multiple views of an object, the network generate voxelized (voxel is 3D equivalent of pixel) reconstruction of the object in 3D.
44

5+
## Citing this work
56

6-
## Overview
7-
8-
Given a set of images
9-
10-
- [ShapeNet rendering](http://cvgl.stanford.edu/data2/ShapeNetRendering.tgz)
11-
- [ShapeNet voxelized models](http://cvgl.stanford.edu/data2/ShapeNetVox32.tgz)
12-
13-
## Installation
14-
15-
1. Download `ShapeNetCore` dataset
16-
2. Set the `MODEL_ROOT_PATH` in `lib/config.py` to the extracted `ShapeNetCore`
17-
3. Download model lists from the website. Some models do not have any faces.
18-
4. Generate dataset `json` file by running `python tools/gen_category_list.py`
19-
5. Voxelize all the models by running `python tools/voxelize_models.py`
20-
6. Render all the models by runnning `python tools/render_models.py`. To run this step, you have to setup `blender`.
21-
7. Set `cfg.DIR.MODEL_PATH`, `cfg.DIR.RENDERING_PATH` and `cfg.DIR.VOXEL_PATH` in `lib/config.py` accoringly
22-
8. Run experiments `bash ./experiments/script/mv_lstm_vec_net.sh`
23-
24-
## Installation
25-
26-
### CUDA Setup
27-
28-
Follow the [instruction](http://deeplearning.net/software/theano/install.html) and set GPU + CUDA.
29-
30-
1. `CUDA_ROOT=/path/to/cuda/root`
31-
2. add a cuda.root flag to THEANO_FLAGS, as in `THEANO_FLAGS='cuda.root=/path/to/cuda/root'`
32-
3. add a [cuda] section to your .theanorc file containing the option root = /path/to/cuda/root.
33-
34-
Download `cuDNN3` and follow the [instruction](http://deeplearning.net/software/theano/library/sandbox/cuda/dnn.html)
35-
36-
A non-intrusive installation is to set
37-
38-
```
39-
export LD_LIBRARY_PATH=/home/user/path_to_CUDNN_folder/lib64:$LD_LIBRARY_PATH
40-
export CPATH=/home/user/path_to_CUDNN_folder/include:$CPATH
41-
export LIBRARY_PATH=/home/user/path_to_CUDNN_folder/lib64:$LD_LIBRARY_PATH
42-
```
43-
44-
### Theano
45-
46-
Install bleeding-edge Theano.
7+
If you find this work useful in your research, please consider citing:
478

489
```
49-
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
50-
```
51-
52-
#### Theanorc Setup
53-
54-
```
55-
[global]
56-
floatX = float32
57-
base_compiledir = /var/tmp
58-
59-
# Get an error message if cuDNN is not available
60-
optimizer_including = cudnn
10+
@article{choy20163d,
11+
title={3D-R2N2: A Unified Approach for Single and Multi-view 3D Object Reconstruction},
12+
author={Choy, Christopher B and Xu, Danfei and Gwak, JunYoung and Chen, Kevin and Savarese, Silvio},
13+
journal={arXiv preprint arXiv:1604.00449},
14+
year={2016}
15+
}
16+
17+
@inproceedings{choy_eccv16,
18+
author={Choy, Christopher B and Xu, Danfei and Gwak, JunYoung and Chen, Kevin and Savarese, Silvio},
19+
title={3D-R2N2: A Unified Approach for Single and Multi-view 3D Object Reconstruction},
20+
booktitle={European Conference on Computer Vision (ECCV)},
21+
year={2016}
22+
}
6123
```
6224

63-
#### Issues
64-
65-
- Upgrading from cuDNNv2
66-
67-
If you encounter
68-
69-
```
70-
ImportError: libcudnn.so.6.5: cannot open shared object file: No such file or directory
71-
```
72-
73-
Delete all binary files in the `base_compiledir` [link](http://deeplearning.net/software/theano/library/config.html#config.base_compiledir)
74-
75-
76-
### Blender
77-
78-
Go to the blender website and download the [latest blender](https://developer.blender.org/diffusion/B/)
79-
80-
```
81-
# read-only access
82-
git clone git://git.blender.org/blender.git
25+
## Overview
8326

84-
# read/write access
85-
git clone git@git.blender.org:blender.git
27+
![Overview](imgs/overview.png)
28+
*Left: images found on Ebay, Amazon, Right: overview of `3D-R2N2`*
8629

87-
cd blender
88-
git submodule update --init --recursive
89-
git submodule foreach git checkout master
90-
git submodule foreach git pull --rebase origin master
91-
```
30+
Traditionally, single view reconstruction and multi view reconstruction are disjoint problmes that has been dealt using different approaches. In this work, we first propose a unified framework for both single and multi view reconstruction using a `3D Recurrent Reconstruction Neural Network` (3D-R2N2).
9231

93-
Then, follow the instruction on compiling the blender with the python module support [http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule]
32+
| Schematics of `3D-Convolutional LSTM` | Inputs for each cell |
33+
|:-------------------------------------:|:-------------------------:|
34+
| ![3D-LSTM](imgs/lstm_time.png) | ![3D-LSTM](imgs/lstm.png) |
9435

95-
Make sure to set the following flags correctly.
36+
We can feed images in a random order but the network is invariant to the order. The ciritical component that enables the network to be invariant to the order is the `3D-Convolutional LSTM` which we first proposed in this work. The `3D-Convolutional LSTM` selectively updates parts that are visible and keeps the parts that are self occluded (please refer to [http://cvgl.stanford.edu/3d-r2n2/](http://cvgl.stanford.edu/3d-r2n2/) for the supplementary material for analysis).
9637

97-
```
98-
WITH_PYTHON_INSTALL=OFF
99-
WITH_PLAYER=OFF
100-
WITH_PYTHON_MODULE=ON
101-
...
102-
WITH_OPENCOLLADA=ON
103-
```
38+
## Datasets
10439

105-
OpenCollada is optional if you wan to use collada (.dae) files. Install OpenCollada first.
40+
We used [ShapeNet](http://shapenet.cs.stanford.edu) models to generated rendered images and voxelized models which are available below (you can follow the installation instruction below to extract it on the default directory).
10641

42+
- ShapeNet rendered images [ftp://cs.stanford.edu/cs/cvgl/ShapeNetRendering.tgz](ftp://cs.stanford.edu/cs/cvgl/ShapeNetRendering.tgz)
43+
- ShapeNet voxelized models [ftp://cs.stanford.edu/cs/cvgl/ShapeNetVox32.tgz](ftp://cs.stanford.edu/cs/cvgl/ShapeNetVox32.tgz)
10744

108-
### OpenCollada
45+
## Installation
10946

110-
This will requires gcc4.7
47+
The package requires python3. You can follow the direction below to install virtual environment within the repository or install anaconda for python 3.
48+
49+
- Download the repository
50+
```
51+
git clone https://github.com/chrischoy/3D-R2N2.git
52+
```
53+
- Setup virtual environment and install requirements
54+
```
55+
cd 3D-R2N2
56+
pip install virtualenv
57+
virtualenv -p python3 py3
58+
source py3/bin/activate
59+
pip install -r requirements.txt
60+
```
61+
- Download trained network weight
62+
```
63+
wget asdfasdf
64+
```
65+
- run the demo code
66+
```
67+
python demo.py
68+
```
69+
70+
### Training the network
71+
72+
- Download datasets and place them in a folder named `ShapeNet`
73+
```
74+
mkdir ShapeNet/
75+
wget ftp://cs.stanford.edu/cs/cvgl/ShapeNetRendering.tgz
76+
wget ftp://cs.stanford.edu/cs/cvgl/ShapeNetVox32.tgz
77+
tar -xzf ShapeNetRendering.tgz -C ShapeNet/
78+
tar -xzf ShapeNetVox32.tgz -C ShapeNet/
79+
```
80+
- Run experiments `bash ./experiments/script/mv_lstm_vec_net.sh`
81+
82+
### Miscellaneous setup
83+
84+
#### CUDA Setup
11185

112-
```
113-
git clone https://github.com/KhronosGroup/OpenCOLLADA
114-
mkdir OpenCOLLADA-build
115-
cd OpenCOLLADA-build
116-
cmake ../OpenCOLLADA -DUSE_SHARED=ON
117-
make
118-
make install
119-
```
86+
Follow the [instruction](http://deeplearning.net/software/theano/install.html) and set GPU + CUDA.
12087

121-
## Python 3 Requirements
88+
#### Theano
12289

123-
On the root path, run
90+
Install bleeding-edge Theano using
12491

12592
```
126-
pip3 install -r requirements.txt
93+
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git
12794
```
128-
129-
130-
# Dataset Setting
131-
132-
- Download ShapeNet
133-
- Set variables in lib/config.py
134-
- Generate training dataset lists
135-
```
136-
python tools/generate_category_list.py
137-
```
138-
- Generate rendering and voxelization
139-
- Run the training script
140-
141-
142-
# Erroneous Files
143-
144-
03624134/67ada28ebc79cc75a056f196c127ed77/model.obj
145-
04090263/4a32519f44dc84aabafe26e2eb69ebf4/model.obj
146-
04074963/b65b590a565fa2547e1c85c5c15da7fb/model.obj
147-

_init_paths.py

-14
This file was deleted.

demo.py

Whitespace-only changes.

experiments/cfgs/local_shapenet.yaml

-7
This file was deleted.

experiments/cfgs/no_random_background.yaml

-3
This file was deleted.

experiments/cfgs/shapenet_1000.yaml

-1
This file was deleted.

experiments/dataset/ShapeNet.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Erroneous Files
2+
3+
03624134/67ada28ebc79cc75a056f196c127ed77/model.obj
4+
04090263/4a32519f44dc84aabafe26e2eb69ebf4/model.obj
5+
04074963/b65b590a565fa2547e1c85c5c15da7fb/model.obj
6+
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"04256520": {
3+
"id": "04256520",
4+
"name": "sofa,couch,lounge"
5+
},
6+
"02691156": {
7+
"id": "02691156",
8+
"name": "airplane,aeroplane,plane"
9+
},
10+
"03636649": {
11+
"id": "03636649",
12+
"name": "lamp"
13+
},
14+
"04401088": {
15+
"id": "04401088",
16+
"name": "telephone,phone,telephone set"
17+
},
18+
"04530566": {
19+
"id": "04530566",
20+
"name": "vessel,watercraft"
21+
},
22+
"03691459": {
23+
"id": "03691459",
24+
"name": "loudspeaker,speaker,speaker unit,loudspeaker system,speaker system"
25+
},
26+
"03001627": {
27+
"id": "03001627",
28+
"name": "chair"
29+
},
30+
"02933112": {
31+
"id": "02933112",
32+
"name": "cabinet"
33+
},
34+
"04379243": {
35+
"id": "04379243",
36+
"name": "table"
37+
},
38+
"03211117": {
39+
"id": "03211117",
40+
"name": "display,video display"
41+
},
42+
"02958343": {
43+
"id": "02958343",
44+
"name": "car,auto,automobile,machine,motorcar"
45+
},
46+
"02828884": {
47+
"id": "02828884",
48+
"name": "bench"
49+
},
50+
"04090263": {
51+
"id": "04090263",
52+
"name": "rifle"
53+
}
54+
}

experiments/scripts/analyze_mv_lstm_vec_net.sh

-29
This file was deleted.

experiments/scripts/mv_deep_res_gru_net_3x3x3.sh

+1-10
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,13 @@ export THEANO_FLAGS="floatX=float32,device=gpu,assert_no_cpu_op='raise'"
2121
python main.py \
2222
--batch-size 24 \
2323
--iter 60000 \
24-
--cfg ./experiments/cfgs/shapenet_1000.yaml \
25-
--cfg ./experiments/cfgs/random_crop.yaml \
26-
--cfg ./experiments/cfgs/no_random_background.yaml \
27-
--cfg ./experiments/cfgs/max_5_views.yaml \
28-
--cfg ./experiments/cfgs/local_shapenet.yaml \
2924
--out $OUT_PATH \
3025
--model $NET_NAME \
3126
${*:1}
3227

3328
python main.py \
3429
--test \
35-
--batch-size 24 \
36-
--cfg ./experiments/cfgs/shapenet_1000.yaml \
37-
--cfg ./experiments/cfgs/no_random_background.yaml \
38-
--cfg ./experiments/cfgs/max_5_views.yaml \
39-
--cfg ./experiments/cfgs/local_shapenet.yaml \
30+
--batch-size 1 \
4031
--out $OUT_PATH \
4132
--weights $OUT_PATH/weights.npy \
4233
--model $NET_NAME \

0 commit comments

Comments
 (0)