diff --git a/new_specie/print_annot.py b/new_specie/print_detections.py similarity index 99% rename from new_specie/print_annot.py rename to new_specie/print_detections.py index f178499b2f9d22e25bcd63ecd50204df10be0313..0e1d86eb5e87481715a3b9bf243cd67a7f77e5a0 100755 --- a/new_specie/print_annot.py +++ b/new_specie/print_detections.py @@ -25,7 +25,6 @@ loader = torch.utils.data.DataLoader(u.Dataset(df, args.audio_folder, args.SR, a for x, idx in tqdm(loader): x = frontend(x).squeeze().detach() - plt.figure() plt.imshow(x, origin='lower', aspect='auto', vmin=torch.quantile(x, .25), cmap='Greys', vmax=torch.quantile(x, .98)) plt.subplots_adjust(top=1, bottom=0, left=0, right=1) plt.savefig(f'annot_pngs/{idx.item()}') diff --git a/new_specie/sort_cluster.py b/new_specie/sort_cluster.py index 87167693962eaa68cf84d76d3d773469ce39ac46..a5d7d3351a893031af8c436fa44874dafb3e0ca9 100755 --- a/new_specie/sort_cluster.py +++ b/new_specie/sort_cluster.py @@ -127,7 +127,8 @@ for c, grp in df.groupby('cluster'): loader = torch.utils.data.DataLoader(u.Dataset(grp.sample(min(len(grp), 200)), args.audio_folder, args.SR, args.sampleDur), batch_size=1, num_workers=8, collate_fn=u.collate_fn) with torch.no_grad(): for x, idx in tqdm(loader, leave=False, desc=str(int(c))): - plt.imshow(frontend(x).squeeze().numpy(), origin='lower', aspect='auto') + x = frontend(x).squeeze().detach() + plt.imshow(x, origin='lower', aspect='auto', vmin=torch.quantile(x, .25), cmap='Greys', vmax=torch.quantile(x, .98)) plt.subplots_adjust(top=1, bottom=0, left=0, right=1) plt.savefig(f'cluster_pngs/{c:.0f}/{idx.squeeze().item()}') plt.close()