-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun_idr.py
43 lines (36 loc) · 2.17 KB
/
run_idr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
sys.path.append('./idr')
import argparse
import GPUtil
from training.idr_train import IDRTrainRunner
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=1, help='input batch size')
parser.add_argument('--nepoch', type=int, default=2000, help='number of epochs to train for')
parser.add_argument('--conf', type=str, default='./configs/dtu_stylize.conf')
parser.add_argument('--expname', type=str, default='')
parser.add_argument('--gpu', type=str, default='auto', help='GPU to use [default: GPU auto]')
parser.add_argument('--is_continue', default=False, action="store_true", help='If set, indicates continuing from a previous run.')
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.')
opt = parser.parse_args()
if opt.gpu == "auto":
deviceIDs = GPUtil.getAvailable(order='memory', limit=1, maxLoad=0.5, maxMemory=0.5, includeNan=False, excludeID=[], excludeUUID=[])
gpu = deviceIDs[0]
else:
gpu = opt.gpu
trainrunner = IDRTrainRunner(conf=opt.conf,
batch_size=opt.batch_size,
nepochs=opt.nepoch,
expname=opt.expname,
gpu_index=gpu,
exps_folder_name='logs',
is_continue=opt.is_continue,
timestamp=opt.timestamp,
checkpoint=opt.checkpoint,
scan_id=opt.scan_id,
train_cameras=opt.train_cameras
)
trainrunner.run()