return performance_dict if __name__ == '__main__': parser = argparse.ArgumentParser( 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":
# results["mean_iou"] = IOULoss().forward(groundtruth, mesh_silhouettes).detach().cpu().numpy().tolist() # results["mean_dice"] = DiceCoeffLoss().forward(groundtruth, mesh_silhouettes) manager.set_pred_results(results) manager.close() if __name__ == "__main__": logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") args = get_args() args_dict = vars(args) 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