'dirname': 'file_path' }) video_info = video_info[~video_info['strain'].isin(bad_labels)] fnames = root_dir + '/' + video_info['file_path'] + '/' + video_info[ 'basename'].str.replace('.hdf5', '_featuresN.hdf5') is_valid = [os.path.exists(x) for x in fnames.values] video_info = video_info[is_valid] fnames = [Path(x) for e, x in zip(is_valid, fnames.values) if e] return video_info, fnames #%% if __name__ == '__main__': p = 'osx' if sys.platform == 'darwin' else 'centos_oxford' root = _root_dirs[p] emb_sets = ['angles'] set_type = 'CeNDRAgg' root_dir = root + 'screenings/Serena_WT_Screening/Results' video_info, fnames = get_video_info_from_csv_agg(root_dir) for emb_set in emb_sets: save_file = root + 'experiments/classify_strains/{}_{}.hdf5'.format( set_type, emb_set) calculate_embeddings(video_info, fnames, emb_set, save_file)
fnames = root_dir + '/' + video_info['file_path'] + '/' + video_info[ 'basename'].str.replace('.hdf5', '_featuresN.hdf5') is_valid = [os.path.exists(x) for x in fnames.values] video_info = video_info[is_valid] fnames = [Path(x) for e, x in zip(is_valid, fnames.values) if e] return video_info, fnames #%% if __name__ == '__main__': p = 'osx' if sys.platform == 'darwin' else 'centos_oxford' root = _root_dirs[p] set_type = 'CeNDR' emb_set = 'AE2DWithSkels32_emb32_20180620' root_dir = root + 'experiments/autoencoders/embeddings/CeNDR_ROIs_embeddings/20180620_173601_AE2DWithSkels32_skel-1-1_adam_lr0.001_batch16' video_info, fnames = get_video_info_from_files(root_dir, f_ext='_embeddings.hdf5') save_file = root + 'experiments/classify_strains/{}_{}.hdf5'.format( set_type, emb_set) calculate_embeddings(video_info, fnames, emb_set, save_file, col_label='roi_index', embeddings_field='/embeddings')