##################################### params = tune_window_preprocessing_params(audio_dirs, params) ################################################### # 2) Train a generative model on these syllables. # ################################################### partition = get_window_partition(audio_dirs, roi_dirs, 1) partition['test'] = partition['train'] num_workers = min(7, os.cpu_count() - 1) loaders = get_fixed_window_data_loaders(partition, params, \ num_workers=num_workers, batch_size=128) loaders['test'] = loaders['train'] model = VAE(save_dir=root) model.train_loop(loaders, epochs=101, test_freq=None) ######################## # 3) Plot and analyze. # ######################## from ava.plotting.tooltip_plot import tooltip_plot_DC from ava.plotting.latent_projection import latent_projection_plot_DC from ava.plotting.trace_plot import warped_trace_plot_DC loaders['test'].dataset.write_hdf5_files(spec_dirs[0], num_files=1000) latent_projection_plot_DC(dc, alpha=0.25, s=0.5) tooltip_plot_DC(dc, num_imgs=2000) if __name__ == '__main__': pass ###
################## # 4) Preprocess. # ################## n_jobs = os.cpu_count() - 1 gen = zip(audio_dirs, seg_dirs, spec_dirs, repeat(params['preprocess'])) Parallel(n_jobs=n_jobs)(delayed(process_sylls)(*args) for args in gen) ################################################### # 5) Train a generative model on these syllables. # ################################################### model = VAE(save_dir=root) # model.load_state(root+'checkpoint_150.tar') partition = get_syllable_partition(spec_dirs, split=1, max_num_files=2500) num_workers = os.cpu_count() - 1 loaders = get_syllable_data_loaders(partition, num_workers=num_workers) loaders['test'] = loaders['train'] model.train_loop(loaders, epochs=151, test_freq=None) ######################## # 6) Plot and analyze. # ######################## from ava.plotting.tooltip_plot import tooltip_plot_DC from ava.plotting.latent_projection import latent_projection_plot_DC latent_projection_plot_DC(dc) tooltip_plot_DC(dc, num_imgs=2000) if __name__ == '__main__': pass ###