def main(): args = parse_args() cfg = load_config(args) launch_job( cfg=cfg, init_method=args.init_method, func=benchmark_data_loading )
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) if cfg.DEMO.ENABLE: original_num_gpus = cfg.NUM_GPUS # Set num_gpus to 1 for the demo cfg.NUM_GPUS = 1 launch_job(cfg=cfg, init_method=args.init_method, func=run_demo) # Set num gpus back to original cfg.NUM_GPUS = original_num_gpus # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) if cfg.DEMO_ORIGINAL.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=demo_original) if cfg.TENSORBOARD.ENABLE and cfg.TENSORBOARD.MODEL_VIS.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=visualize)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) # Perform training. if cfg.TRAIN.ENABLE: if cfg.KD.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train_KD) else: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) # Perform model visualization. if cfg.TENSORBOARD.ENABLE and (cfg.TENSORBOARD.MODEL_VIS.ENABLE or cfg.TENSORBOARD.WRONG_PRED_VIS.ENABLE): launch_job(cfg=cfg, init_method=args.init_method, func=visualize) # Run demo. if cfg.DEMO.ENABLE: demo(cfg)
def main(): args = parse_args() cfg = load_config(args) # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) # Perform feature extraction. if cfg.MODEL.EXTRACTOR: extract(cfg) if cfg.MODEL.VIDEO_EXTRACTOR: video_extract(cfg)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() print("config files: {}".format(args.cfg_files)) for path_to_config in args.cfg_files: cfg = load_config(args, path_to_config) # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) # Perform model visualization. if cfg.TENSORBOARD.ENABLE and (cfg.TENSORBOARD.MODEL_VIS.ENABLE or cfg.TENSORBOARD.WRONG_PRED_VIS.ENABLE): launch_job(cfg=cfg, init_method=args.init_method, func=visualize) # Run demo. if cfg.DEMO.ENABLE: demo(cfg)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) #cfg.DEMO.WEBCAM = 0 cfg.DEMO.WEBCAM = -1 cfg.DEMO.INPUT_VIDEO = "demo_test/demo_in2.mp4" cfg.NUM_GPUS = 1 cfg.TRAIN.ENABLE = False cfg.TEST.ENABLE = False cfg.DEMO.OUTPUT_FILE = "demo_test/demo_out2.mp4" cfg.DEMO.ENABLE = True # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) # Perform model visualization. if cfg.TENSORBOARD.ENABLE and cfg.TENSORBOARD.MODEL_VIS.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=visualize) # Run demo. if cfg.DEMO.ENABLE: demo(cfg)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) uuid = datetime.datetime.now().strftime("%Y%m%d%H%M%S") cfg.OUTPUT_DIR = os.path.join(cfg.OUTPUT_DIR, uuid) os.makedirs(cfg.OUTPUT_DIR) # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # # Perform multi-clip testing. # if cfg.TEST.ENABLE: # launch_job(cfg=cfg, init_method=args.init_method, func=test) # if cfg.DEMO.ENABLE: # launch_job(cfg=cfg, init_method=args.init_method, func=demo) if cfg.TENSORBOARD.ENABLE and cfg.TENSORBOARD.MODEL_VIS.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=visualize)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) # Perform training. if cfg.TRAIN.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=train) # Perform multi-clip testing. if cfg.TEST.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=test) if cfg.DEMO.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=demo) if cfg.TENSORBOARD.ENABLE and cfg.TENSORBOARD.MODEL_VIS.ENABLE: launch_job(cfg=cfg, init_method=args.init_method, func=visualize)
def main(): """ Main function to spawn the train and test process. """ args = parse_args() cfg = load_config(args) if cfg.TRAIN.ENABLE: if cfg.TRAIN.ONLY_DES: launch_job(cfg=cfg, init_method=args.init_method, func=train_des) else: launch_job(cfg=cfg, init_method=args.init_method, func=train) else: if cfg.TRAIN.ONLY_DES: launch_job(cfg=cfg, init_method=args.init_method, func=test_implementation_des) else: launch_job(cfg=cfg, init_method=args.init_method, func=test_implementation)
def main(): argsOrig = ParseArgs() host_name = socket.gethostname() host_ip = socket.gethostbyname(host_name) print("Starting on host {} host_ip {}".format(host_name, host_ip)) for config_file in argsOrig.config_files: args = copy.deepcopy(argsOrig) args.config_file = config_file with YamlConfig(args, now='') as config: args = config.ApplyConfigFile(args) args = updatePaths(args) with TempDir(baseDir=args.output_dir, deleteOnExit=True) as tmp: # Convert args to cfg format tmpFile = createFullPathTree(tmp.tempDir, 'cfgTmp') args.cfg_file = tmpFile config.SaveConfig(file=tmpFile) cfg = load_config(args) with CreateLogger(args, logger_type=args.logger_type) as logger: logger.log_value('title', args.log_title, 'Run Title entered when job started') logger.info("Starting on host {} host_ip {}".format( host_name, host_ip)) logger.info("cv2 version {}".format(cv2.__version__)) logger.info("torch version {}".format(torch.__version__)) logger.info("Cuda enabled {} num GPU {}".format( torch.cuda.is_available(), torch.cuda.device_count())) logger.info("Torchvision version {}".format( torchvision.__version__)) logger.info(config.ReportConfig()) args.master_addr = host_ip if cfg.NUM_SHARDS <= 1 or cfg.SHARD_ID == 0 else args.master_addr os.environ["MASTER_ADDR"] = args.master_addr os.environ["MASTER_PORT"] = str(args.master_port) os.environ["WORLD_SIZE"] = str(cfg.NUM_SHARDS * cfg.NUM_GPUS) logger.info( "MASTER_ADDR {} MASTER_PORT {} WORLD_SIZE {}".format( os.environ["MASTER_ADDR"], os.environ["MASTER_PORT"], os.environ["WORLD_SIZE"])) logger.info("MASTER_ADDR {} MASTER_PORT {} ".format( os.environ["MASTER_ADDR"], os.environ["MASTER_PORT"], )) logger.info("CFG") logger.info(cfg) for op in args.operations: if op.lower() == 'train': trainer = Trainer(cfg) launch_job(cfg=cfg, init_method=None, func=trainer.train) elif op.lower() == 'to_onnx': onnx = OnnxUtils(cfg, logger) onnx.saveOnnxModel() elif op.lower() == 'eval_onnx': onnx = OnnxUtils(cfg, logger) onnx.evalOnnx() else: logger.info( "Unrecognized option {} expect one of [train, to_onnx, eval_onnx]" )
def run_exp(cfg): init_method = 'tcp://localhost:9999' with open(cfg.TRAIN.TRAIN_STATS_FILE, 'a') as f: f.write(str(dict(cfg.items()))) f.write('\n') launch_job(cfg=cfg, init_method=init_method, func=train_des)