def set_up_config_dict(config_file, train_subjects, test_subjects, job_identifier, batch_size_test, dataset_path, input_to_get, output_to_get, train_subjects_model, test_subjects_model, config_file_model, job_identifier_encdec, epoch_encdec): config_dict_for_saved_model = rhodin_utils_io.loadModule( config_file_model).config_dict config_dict_for_saved_model[ 'implicit_rotation'] = config_dict_for_saved_model.get( 'implicit_rotation', False) config_dict_for_saved_model[ 'skip_background'] = config_dict_for_saved_model.get( 'skip_background', True) config_dict_for_saved_model[ 'loss_weight_pose3D'] = config_dict_for_saved_model.get( 'loss_weight_pose3D', 0) config_dict_for_saved_model[ 'n_hidden_to3Dpose'] = config_dict_for_saved_model.get( 'n_hidden_to3Dpose', 2) config_dict_for_saved_model['train_subjects'] = train_subjects_model config_dict_for_saved_model['test_subjects'] = test_subjects_model config_dict_module = rhodin_utils_io.loadModule(config_file) config_dict = config_dict_module.config_dict config_dict_for_saved_model['job_identifier'] = job_identifier_encdec config_dict['job_identifier_encdec'] = job_identifier_encdec config_dict['job_identifier'] = job_identifier config_dict['train_subjects'] = train_subjects config_dict['test_subjects'] = test_subjects config_dict['data_dir_path'] = dataset_path config_dict['dataset_folder_train'] = dataset_path config_dict['dataset_folder_test'] = dataset_path config_dict['dataset_folder_mocap'] = os.path.join( dataset_path, 'treadmill_lameness_mocap_ci_may11/mocap/') config_dict['dataset_folder_rgb'] = os.path.join(dataset_path, 'animals_data/') root = dataset_path.rsplit('/', 2)[0] config_dict['bg_folder'] = config_dict_for_saved_model['bg_folder'] config_dict['rot_folder'] = config_dict_for_saved_model['rot_folder'] config_dict['pretrained_network_path'] = tep.get_model_path( config_dict_for_saved_model, epoch=epoch_encdec) assert os.path.exists(config_dict['pretrained_network_path']) for val in input_to_get: if val not in config_dict['input_types']: config_dict['input_types'].append(val) config_dict['output_types'] = [] for val in output_to_get: if val not in config_dict['output_types']: config_dict['output_types'].append(val) return config_dict
def set_up_config_dict(config_path, train_subjects, test_subjects, job_identifier, batch_size_test, dataset_path, input_to_get, output_to_get): config_dict = rhodin_utils_io.loadModule(config_path).config_dict config_dict['job_identifier'] = job_identifier config_dict['train_subjects'] = train_subjects config_dict['test_subjects'] = test_subjects config_dict['implicit_rotation'] = config_dict.get('implicit_rotation', False) config_dict['skip_background'] = config_dict.get('skip_background', True) config_dict['loss_weight_pose3D'] = config_dict.get('loss_weight_pose3D', 0) config_dict['n_hidden_to3Dpose'] = config_dict.get('n_hidden_to3Dpose', 2) config_dict['batch_size_test'] = batch_size_test config_dict['data_dir_path'] = dataset_path config_dict['dataset_folder_train'] = dataset_path config_dict['dataset_folder_test'] = dataset_path # config_dict['bg_folder'] = '../data/median_bg/' # config_dict['rot_folder'] = '../data/rotation_cal_1/' for val in input_to_get: if val not in config_dict['input_types']: config_dict['input_types'].append(val) for val in output_to_get: if val not in config_dict['output_types']: config_dict['output_types'].append(val) return config_dict
def main(args): train_subjects = re.split('/', args.train_subjects) test_subjects = re.split('/', args.test_subjects) train_subjects_model = re.split('/', args.train_subjects_model) test_subjects_model = re.split('/', args.test_subjects_model) config_dict_for_saved_model = rhodin_utils_io.loadModule( args.config_file_model).config_dict config_dict_for_saved_model[ 'implicit_rotation'] = config_dict_for_saved_model.get( 'implicit_rotation', False) config_dict_for_saved_model[ 'skip_background'] = config_dict_for_saved_model.get( 'skip_background', True) config_dict_for_saved_model[ 'loss_weight_pose3D'] = config_dict_for_saved_model.get( 'loss_weight_pose3D', 0) config_dict_for_saved_model[ 'n_hidden_to3Dpose'] = config_dict_for_saved_model.get( 'n_hidden_to3Dpose', 2) config_dict_for_saved_model['train_subjects'] = train_subjects_model config_dict_for_saved_model['test_subjects'] = test_subjects_model config_dict_module = rhodin_utils_io.loadModule(args.config_file) config_dict = config_dict_module.config_dict config_dict_for_saved_model['job_identifier'] = args.job_identifier_encdec config_dict['job_identifier_encdec'] = args.job_identifier_encdec config_dict['job_identifier'] = args.job_identifier config_dict['train_subjects'] = train_subjects config_dict['test_subjects'] = test_subjects config_dict['data_dir_path'] = args.dataset_path config_dict['dataset_folder_train'] = args.dataset_path config_dict['dataset_folder_test'] = args.dataset_path root = args.dataset_path.rsplit('/', 2)[0] config_dict['pretrained_network_path'] = tedp.get_model_path( config_dict_for_saved_model, epoch=args.epoch_encdec) config_dict['rot_folder'] = config_dict_for_saved_model['rot_folder'] config_dict['bg_folder'] = config_dict_for_saved_model['bg_folder'] ignite = IgniteTestPainFromLatent(config_dict_module.__file__, config_dict, config_dict_for_saved_model, epoch=args.epoch) if ignite.model is not None: ignite.run()
def set_up_config_dict(config_path, train_subjects, test_subjects, job_identifier, job_identifier_encdec, batch_size_test, dataset_path): config_dict_module = rhodin_utils_io.loadModule(config_path) config_dict = config_dict_module.config_dict config_dict['job_identifier_encdec'] = job_identifier_encdec config_dict['job_identifier'] = job_identifier config_dict['train_subjects'] = train_subjects config_dict['test_subjects'] = test_subjects config_dict['batch_size_test'] = batch_size_test config_dict['data_dir_path'] = dataset_path config_dict['dataset_folder_train'] = dataset_path config_dict['dataset_folder_test'] = dataset_path config_dict['implicit_rotation'] = config_dict.get('implicit_rotation', False) config_dict['skip_background'] = config_dict.get('skip_background', True) config_dict['loss_weight_pose3D'] = config_dict.get( 'loss_weight_pose3D', 0) config_dict['n_hidden_to3Dpose'] = config_dict.get('n_hidden_to3Dpose', 2) return config_dict
help="Job identifier for the saved model to load.") parser.add_argument('--epoch_encdec', type=str, help="Which epoch for the saved model to load.") return parser.parse_args(argv) if __name__ == "__main__": args = parse_arguments(sys.argv[1:]) print(args) train_subjects = re.split('/', args.train_subjects) test_subjects = re.split('/', args.test_subjects) train_subjects_model = re.split('/', args.train_subjects_model) test_subjects_model = re.split('/', args.test_subjects_model) config_dict_for_saved_model = rhodin_utils_io.loadModule( args.config_file_model).config_dict config_dict_for_saved_model[ 'implicit_rotation'] = config_dict_for_saved_model.get( 'implicit_rotation', False) config_dict_for_saved_model[ 'skip_background'] = config_dict_for_saved_model.get( 'skip_background', True) config_dict_for_saved_model[ 'loss_weight_pose3D'] = config_dict_for_saved_model.get( 'loss_weight_pose3D', 0) config_dict_for_saved_model[ 'n_hidden_to3Dpose'] = config_dict_for_saved_model.get( 'n_hidden_to3Dpose', 2) config_dict_for_saved_model['train_subjects'] = train_subjects_model config_dict_for_saved_model['test_subjects'] = test_subjects_model
type=str, help="Slurm job ID, or other identifier, to not overwrite output.") parser.add_argument('--resume', type=int, default=0, help="epoch num to resume from") return parser.parse_args(argv) if __name__ == "__main__": args = parse_arguments(sys.argv[1:]) # print(args) train_subjects = re.split('/', args.train_subjects) test_subjects = re.split('/', args.test_subjects) # print (args.config_file) config_dict_module = rhodin_utils_io.loadModule(args.config_file) config_dict = config_dict_module.config_dict config_dict['job_identifier'] = args.job_identifier config_dict['train_subjects'] = train_subjects config_dict['test_subjects'] = test_subjects config_dict['data_dir_path'] = args.dataset_path config_dict['dataset_folder_train'] = args.dataset_path config_dict['dataset_folder_test'] = args.dataset_path root = args.dataset_path.rsplit('/', 2)[0] print(config_dict['test_subjects']) ignite = IgniteTrainNVS(config_dict_module.__file__, config_dict, args.resume) # if ignite is not None: ignite.run() # config_dict_module.__file__, config_dict)
df_reduced.reset_index(drop=True) return df_reduced def get_label_df_for_subjects(data_folder, subjects): subject_fi_dfs = [] print('Iterating over frame indices per subject (.csv files)') for subject in subjects: subject_frame_index_dataframe = pd.read_csv(data_folder + subject + '_reduced_frame_index.csv') subject_fi_dfs.append(subject_frame_index_dataframe) frame_index_df = pd.concat(subject_fi_dfs, ignore_index=True) return frame_index_df if __name__ == '__main__': config_dict_module = rhodin_utils_io.loadModule("configs/config_pain_debug.py") config_dict = config_dict_module.config_dict print (config_dict['save_every']) train_subjects = ['aslan','brava','herrera','julia','kastanjett','naughty_but_nice','sir_holger'] config_dict['train_subjects'] = train_subjects config_dict['dataset_folder_train'] = '/local_storage/users/sbroome/SLU_LPS/pain_no_pain_x2h_intervals_for_extraction_128_128_2fps/' dataset = SimpleFrameDataset(data_folder=config_dict['dataset_folder_train'], subjects = config_dict['train_subjects'], input_types=config_dict['input_types'], label_types=config_dict['label_types_train']) sampler = SimpleRandomFrameSampler( data_folder=config_dict['dataset_folder_train'], subjects=config_dict['train_subjects'], views=config_dict['views'], every_nth_frame=config_dict['every_nth_frame'])
# str_aft = '_'.join(['','reduced','thresh','%.2f'%float(thresh),'frame','index'])+'.csv' # else: # str_aft = '_reduced_frame_index.csv' for subject in subjects: csv_file = os.path.join(data_folder, subject + str_aft) subject_frame_index_dataframe = pd.read_csv(csv_file) # print (csv_file,len(subject_frame_index_dataframe)) subject_fi_dfs.append(subject_frame_index_dataframe) frame_index_df = pd.concat(subject_fi_dfs, ignore_index=True) return frame_index_df if __name__ == '__main__': config_dict_module = rhodin_utils_io.loadModule( "configs/config_train_rotation_bl.py") config_dict = config_dict_module.config_dict print(config_dict['save_every']) train_subjects = [ 'aslan', 'brava', 'herrera', 'inkasso', 'julia', 'kastanjett', 'naughty_but_nice', 'sir_holger' ] config_dict['train_subjects'] = train_subjects dataset = MultiViewDataset(data_folder=config_dict['dataset_folder_train'], bg_folder=config_dict['bg_folder'], input_types=config_dict['input_types'], label_types=config_dict['label_types_train'], subjects=config_dict['train_subjects'], rot_folder=config_dict['rot_folder']) # batch_sampler = MultiViewDatasetSampler(