From bcb525a42202f16ca6ea73c6b9ccb269350c9a0c Mon Sep 17 00:00:00 2001
From: lamipaul <paulobest25@gmail.com>
Date: Wed, 12 Jul 2023 13:31:47 +0200
Subject: [PATCH] minor change

---
 new_specie/{print_annot.py => print_detections.py} | 1 -
 new_specie/sort_cluster.py                         | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename new_specie/{print_annot.py => print_detections.py} (99%)

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 f178499..0e1d86e 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 8716769..a5d7d33 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()
-- 
GitLab