Skip to content

Commit

Permalink
Add training commands
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroharu-kato committed Dec 1, 2019
1 parent 63733ba commit 425b2dd
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 4 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ output the following images.
![](https://raw.githubusercontent.com/hiroharu-kato/view_prior_learning/master/data/examples/4231883e92a3c1a21c62d11641ffbd35_00.png)
![](https://raw.githubusercontent.com/hiroharu-kato/view_prior_learning/master/data/examples/4231883e92a3c1a21c62d11641ffbd35_00_shapenet_multi_color_nv20_uvr_cc.gif)

## Training

Training requires pre-trained AlexNet model.

```shell script
cd data
mkdir caffemodel
cd caffemodel
wget http://dl.caffe.berkeleyvision.org/bvlc_alexnet.caffemodel
cd ../../
```

Training of the provided pre-trained ShapeNet models is done by

```shell script
bash train_shapenet.sh
```

## Citation

```
Expand Down
3 changes: 1 addition & 2 deletions mesh_reconstruction/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def get_encoder(encoder_name, dim_in, dim_out):
if encoder_name == 'resnet18':
return ResNet18(dim_in, dim_out)
elif encoder_name == 'resnet18pt':
return PreTrainedResNet18(dim_in, dim_out, '/data/unagi0/kato/large_data/caffemodel/resnet-18.caffemodel')
# return PreTrainedResNet18(dim_in, dim_out, '/media/disk2/lab/caffemodel/resnet-18.caffemodel')
return PreTrainedResNet18(dim_in, dim_out, './data/caffemodel/resnet-18.caffemodel')
elif encoder_name == 'dummy':
return DummyEncoder()
3 changes: 1 addition & 2 deletions mesh_reconstruction/perceptual_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def __init__(self):
self.conv4 = cl.Convolution2D(None, 384, 3, pad=1)
self.conv5 = cl.Convolution2D(None, 256, 3, pad=1)

# caffe_model = chainer.links.caffe.CaffeFunction('/media/disk2/lab/caffemodel/bvlc_alexnet.caffemodel')
caffe_model = chainer.links.caffe.CaffeFunction('/home/mil/kato/large_data/caffemodel/bvlc_alexnet.caffemodel')
caffe_model = chainer.links.caffe.CaffeFunction('./data/caffemodel/bvlc_alexnet.caffemodel')
self.conv1.W.data = caffe_model.conv1.W.data.copy()
self.conv1.b.data = caffe_model.conv1.b.data.copy()
self.conv2.W.data = caffe_model.conv2.W.data.copy()
Expand Down
44 changes: 44 additions & 0 deletions train_shapenet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
####################################################################################################
# Single-view

# silhouettes, w/o regularization
python mesh_reconstruction/train.py -eid shapenet_single_sil_nv1 -dd $DD -ni 50000 -ds shapenet -svt 1 -nv 1 -sm 1

# silhouettes, w/ regularization
python mesh_reconstruction/train.py -eid shapenet_single_sil_nv1_uvr -dd $DD -ni 100000 -ds shapenet -svt 1 -nv 1 -ld 0.1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_single_sil_nv1_uvr_cc -dd $DD -ni 100000 -ds shapenet -svt 1 -nv 1 -ld 0.2 -cc 1 -sm 1

# color, w/o regularization
python mesh_reconstruction/train.py -eid shapenet_single_color_nv1 -dd $DD -ni 50000 -ds shapenet -svt 1 -nv 1 -lp 0.5 -sm 1

# color, w/ regularization
python mesh_reconstruction/train.py -eid shapenet_single_color_nv1_uvr -dd $DD -ni 100000 -ds shapenet -svt 1 -nv 1 -lp 0.5 -ld 2 -sm 1
python mesh_reconstruction/train.py -eid shapenet_single_color_nv1_uvr_cc -dd $DD -ni 100000 -ds shapenet -svt 1 -nv 1 -lp 0.5 -ld 2 -cc 1 -sm 1

####################################################################################################
# Multi-view

# silhouettes
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv20 -dd $DD -ni 500000 -ds shapenet -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv10 -dd $DD -ni 250000 -ds shapenet -nv 10 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv5 -dd $DD -ni 125000 -ds shapenet -nv 5 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv3 -dd $DD -ni 75000 -ds shapenet -nv 3 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv2 -dd $DD -ni 50000 -ds shapenet -nv 2 -sm 1

# silhouettes + regularization
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv20_uvr_cc_long -dd $DD -ni 1000000 -ds shapenet -ld 0.03 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv20_uvr_cc -dd $DD -ni 500000 -ds shapenet -ld 0.03 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv10_uvr_cc -dd $DD -ni 500000 -ds shapenet -nv 10 -ld 0.03 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv5_uvr_cc -dd $DD -ni 250000 -ds shapenet -nv 5 -ld 0.03 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv3_uvr_cc -dd $DD -ni 150000 -ds shapenet -nv 3 -ld 0.03 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_sil_nv2_uvr_cc -dd $DD -ni 100000 -ds shapenet -nv 2 -ld 0.03 -cc 1 -sm 1

# color
python mesh_reconstruction/train.py -eid shapenet_multi_color_nv20 -dd $DD -ni 500000 -ds shapenet -lp 0.1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_color_nv2 -dd $DD -ni 50000 -ds shapenet -lp 0.1 -nv 2 -sm 1

# color + regularization
python mesh_reconstruction/train.py -eid shapenet_multi_color_nv20_uvr_cc_long -dd $DD -ni 1000000 -ds shapenet -lp 0.1 -nv 20 -ld 0.3 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_color_nv20_uvr_cc -dd $DD -ni 500000 -ds shapenet -lp 0.1 -nv 20 -ld 0.3 -cc 1 -sm 1
python mesh_reconstruction/train.py -eid shapenet_multi_color_nv2_uvr_cc -dd $DD -ni 100000 -ds shapenet -lp 0.1 -nv 2 -ld 0.3 -cc 1 -sm 1

0 comments on commit 425b2dd

Please sign in to comment.