Commit 94eace54 authored by Yuxin Wu's avatar Yuxin Wu

[FasterRCNN] restructure main function

parent 610bd283
...@@ -253,26 +253,26 @@ if __name__ == '__main__': ...@@ -253,26 +253,26 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
if args.datadir: if args.datadir:
config.BASEDIR = args.datadir config.BASEDIR = args.datadir
print_config()
if args.gpu: if args.gpu:
os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu
if args.visualize: if args.visualize or args.evaluate or args.predict:
assert args.load assert args.load
visualize(args.load) print_config()
elif args.evaluate is not None: if args.visualize:
assert args.evaluate.endswith('.json') visualize(args.load)
assert args.load elif args.evaluate:
# autotune is too slow for inference assert args.evaluate.endswith('.json')
os.environ['TF_CUDNN_USE_AUTOTUNE'] = '0' # autotune is too slow for inference
offline_evaluate(args.load, args.evaluate) os.environ['TF_CUDNN_USE_AUTOTUNE'] = '0'
elif args.predict is not None: offline_evaluate(args.load, args.evaluate)
COCODetection(config.BASEDIR, 'train2014') # to load the class names elif args.predict:
assert args.load COCODetection(config.BASEDIR, 'train2014') # to load the class names into caches
predict(args.load, args.predict) predict(args.load, args.predict)
else: else:
logger.set_logger_dir(args.logdir) logger.set_logger_dir(args.logdir)
print_config()
stepnum = 300 stepnum = 300
warmup_epoch = max(math.ceil(500.0 / stepnum), 5) warmup_epoch = max(math.ceil(500.0 / stepnum), 5)
factor = get_batch_factor() factor = get_batch_factor()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment