description='running experiments on multimodal datasets.') parser.add_argument('-config', action='store', dest='config_file', help='please enter configuration file.', default='config/run.ini') args = parser.parse_args() params = Params() params.parse_config(args.config_file) params.config_file = args.config_file mode = 'run' if 'mode' in params.__dict__: mode = params.mode set_seed(params) params.device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') if mode == 'run': results = [] reader = setup(params) reader.read(params) print(params.output_dim_emo) params.reader = reader if params.train_type == "joint": emo, act = run(params) save_performance(params, emo, "joint_emotion") save_performance(params, act, "joint_act") else: performance_dict = run(params) save_performance(params, performance_dict, params.train_type)
params = Params() params.config_file = args_dict['config_file'] params.__post_init__() params._set_with_dict(args_dict) params.ransac_iou_threshold = args_dict['ransac_iou_threshold'] # Set the device dev_num = params.gpu_num os.environ["CUDA_VISIBLE_DEVICES"] = dev_num os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" device = torch.device(f"cuda" if torch.cuda.is_available() else "cpu") logging.info(f"Using {device} as computation device") if device == f"cuda": torch.cuda.set_device() logging.info(f"Using {device} as computation device") params.device = device params.logger = logging try: exper_path = os.path.join(params.exper_dir, params.name) os.makedirs(exper_path, exist_ok=True) with open(os.path.join(exper_path, 'config.json'), 'w') as file: file.write(json.dumps(params.as_dict())) if params.is_real_data: unet = UNetDynamic.load(params) unet = nn.DataParallel(unet).to(device) logging.info(unet) logging.info( f"Loaded UNet Model from {params.model_cpt}- Starting training" ) pred_evimo(unet, params, device)