Skip to content

Commit

Permalink
Allowing to pass any scan_id format
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardramon committed Jan 4, 2021
1 parent 9c8aaef commit 5ad56f2
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For training IDR run:
cd ./code
python training/exp_runner.py --conf ./confs/dtu_fixed_cameras.conf --scan_id SCAN_ID
```
where SCAN_ID is the id of the DTU scene to reconstruct.
where SCAN_ID is the folder of the DTU scene to reconstruct, ie 'scan64'

Then, to produce the meshed surface, run:
```
Expand Down
2 changes: 1 addition & 1 deletion code/confs/ablation/dtu_fixed_noisy_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 114
scan_id = scan114
cam_file = cameras_linear_init.npz
}
model{
Expand Down
2 changes: 1 addition & 1 deletion code/confs/ablation/dtu_no_feature_vector.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 114
scan_id = scan114
}
model{
feature_vector_size = 0
Expand Down
2 changes: 1 addition & 1 deletion code/confs/ablation/dtu_no_normal.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 114
scan_id = scan114
}
model{
feature_vector_size = 256
Expand Down
2 changes: 1 addition & 1 deletion code/confs/ablation/dtu_no_view_dir.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 114
scan_id = scan114
}
model{
feature_vector_size = 256
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_fixed_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [600, 800]
scan_id = 65
scan_id = scan65
}
model{
feature_vector_size = 256
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_fixed_cameras_disentangled.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = CRX
img_res = [600, 804]
scan_id = 65
scan_id = scan65
}
model{
geometry_network
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_trained_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loss{
dataset{
data_dir = CRX
img_res = [600, 804]
scan_id = 65
scan_id = scan65
}
model{
feature_vector_size = 256
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_trained_cameras_disentangled.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loss{
dataset{
data_dir = CRX
img_res = [600, 804]
scan_id = 65
scan_id = scan65
}
model{
geometry_network
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_trained_cameras_prior.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loss{
dataset{
data_dir = CRX
img_res = [600, 804]
scan_id = 65
scan_id = scan65
}
model{
geometry_network
Expand Down
2 changes: 1 addition & 1 deletion code/confs/crx_trained_cameras_prior_latent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loss{
dataset{
data_dir = CRX
img_res = [600, 804]
scan_id = 65
scan_id = scan65
}
model{
geometry_network
Expand Down
2 changes: 1 addition & 1 deletion code/confs/dtu_fixed_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 65
scan_id = scan65
}
model{
feature_vector_size = 256
Expand Down
2 changes: 1 addition & 1 deletion code/confs/dtu_trained_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ loss{
dataset{
data_dir = DTU
img_res = [1200, 1600]
scan_id = 65
scan_id = scan65
}
model{
feature_vector_size = 256
Expand Down
3 changes: 2 additions & 1 deletion code/confs/dummy_fixed_cameras.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ loss{
dataset{
data_dir = dummy
img_res = [64, 64]
scan_id = 0
scan_id = scan0
}
model{
geometry_network
Expand All @@ -38,6 +38,7 @@ model{
weight_norm = True
multires = 0
latent_size = 8
deep_sdf_trainable = True
}
appearance_network
{
Expand Down
2 changes: 1 addition & 1 deletion code/datasets/scene_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self,
cam_file=None
):

self.instance_dir = os.path.join('../data', data_dir, 'scan{0}'.format(scan_id))
self.instance_dir = os.path.join('../data', data_dir, '{0}'.format(scan_id))

self.total_pixels = img_res[0] * img_res[1]
self.img_res = img_res
Expand Down
8 changes: 4 additions & 4 deletions code/evaluation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def evaluate(**kwargs):
eval_rendering = kwargs['eval_rendering']

expname = conf.get_string('train.expname') + kwargs['expname']
scan_id = kwargs['scan_id'] if kwargs['scan_id'] != -1 else conf.get_int('dataset.scan_id', default=-1)
if scan_id != -1:
scan_id = kwargs['scan_id'] if kwargs['scan_id'] else conf.get_string('dataset.scan_id', default=None)
if scan_id:
expname = expname + '_{0}'.format(scan_id)

if kwargs['timestamp'] == 'latest':
Expand All @@ -52,7 +52,7 @@ def evaluate(**kwargs):
model.cuda()

dataset_conf = conf.get_config('dataset')
if kwargs['scan_id'] != -1:
if kwargs['scan_id']:
dataset_conf['scan_id'] = kwargs['scan_id']
eval_dataset = utils.get_class(conf.get_string('train.dataset_class'))(eval_cameras, **dataset_conf)

Expand Down Expand Up @@ -245,7 +245,7 @@ def calculate_psnr(img1, img2, mask):
parser.add_argument('--gpu', type=str, default='auto', help='GPU to use [default: GPU auto]')
parser.add_argument('--timestamp', default='latest', type=str, help='The experiemnt timestamp to test.')
parser.add_argument('--checkpoint', default='latest',type=str,help='The trained model checkpoint to test')
parser.add_argument('--scan_id', type=int, default=-1, help='If set, taken to be the scan id.')
parser.add_argument('--scan_id', type=str, help='If set, taken to be the scan id.')
parser.add_argument('--resolution', default=512, type=int, help='Grid resolution for marching cube')
parser.add_argument('--is_uniform_grid', default=False, action="store_true", help='If set, evaluate marching cube with uniform grid.')
parser.add_argument('--eval_cameras', default=False, action="store_true", help='If set, evaluate camera accuracy of trained cameras.')
Expand Down
2 changes: 1 addition & 1 deletion code/training/exp_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
parser.add_argument('--timestamp', default='latest', type=str, help='The timestamp of the run to be used in case of continuing from a previous run.')
parser.add_argument('--checkpoint', default='latest',type=str,help='The checkpoint epoch number of the run to be used in case of continuing from a previous run.')
parser.add_argument('--train_cameras', default=False, action="store_true", help='If set, optimizing also camera location.')
parser.add_argument('--scan_id', type=int, default=-1, help='If set, taken to be the scan id.')
parser.add_argument('--scan_id', type=str, help='If set, taken to be the scan id.')

opt = parser.parse_args()

Expand Down
6 changes: 3 additions & 3 deletions code/training/idr_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def __init__(self,**kwargs):
self.train_cameras = kwargs['train_cameras']

self.expname = self.conf.get_string('train.expname') + kwargs['expname']
scan_id = kwargs['scan_id'] if kwargs['scan_id'] != -1 else self.conf.get_int('dataset.scan_id', default=-1)
if scan_id != -1:
scan_id = kwargs['scan_id'] if kwargs['scan_id'] else self.conf.get_string('dataset.scan_id', default=None)
if scan_id:
self.expname = self.expname + '_{0}'.format(scan_id)

if kwargs['is_continue'] and kwargs['timestamp'] == 'latest':
Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(self,**kwargs):
print('Loading data ...')

dataset_conf = self.conf.get_config('dataset')
if kwargs['scan_id'] != -1:
if kwargs['scan_id']:
dataset_conf['scan_id'] = kwargs['scan_id']

self.train_dataset = utils.get_class(self.conf.get_string('train.dataset_class'))(self.train_cameras,
Expand Down

0 comments on commit 5ad56f2

Please sign in to comment.