Skip to content
Snippets Groups Projects
Commit c07becfa authored by Paul Best's avatar Paul Best
Browse files

small fixes

parent 86633898
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -20,7 +20,8 @@ for i, metric in enumerate(metrics):
for specie in species:
df = pd.read_csv(f'scores/{specie}_scores{"_minusvocs" if drop_noisy_vocs else ""}{"_minusbins" if drop_noisy_bins else ""}.csv', index_col=0)
df['Specificity'] = 1 - df['False alarm']
ok.loc[specie, df.index] = df[metric]
ok.loc[specie.replace('_',' '), df.index] = df[metric]
ok = ok[algos]
# bar plot
m_ax = ax[int(i//2), i%2]
......
......@@ -60,7 +60,7 @@ for specie in species if args.specie =='all' else args.specie.split(' '):
out = pd.read_csv(f'{fn[:-4]}_preds.csv')
# check if everything has already been computed, and if yes skip the file
for algo in algos:
if out[algo].isna().all():
if algo in out.columns and out[algo].isna().all():
out.drop(algo, axis=1, inplace=True)
if pd.Series(algos).isin(out.columns).all():
continue
......
No preview for this file type
......@@ -18,15 +18,15 @@ model.load_state_dict(torch.load('/home/paul.best/.local/lib/python3.9/site-pack
model = model.train().to('cuda')
FS, n_in, f0 = 16000, 1024, 10
dt = n_in // 8 # winsize / 8
norm = lambda s : (s-np.mean(s))/max(1e-8, np.std(s))
if not os.path.isfile(f'crepe_ft/train_set_{suffix}.pkl'):
df = []
for specie in ([args.only] if args.only else set(species)-{args.omit} if args.omit else species):
wavpath, fs, nfft, downsample = species[specie].values()
wavpath, fs, nfft, downsample, step = species[specie].values()
dt = int(n_in * step) # winsize / 8
files = glob.glob(wavpath)
for fn in tqdm.tqdm(pd.Series(files).sample(min(len(files), 1000)), desc=specie):
for fn in tqdm.tqdm(pd.Series(files).sample(min(len(files), 1000)), desc='Peparing dataset for '+specie):
if os.path.isfile(f'noisy_pngs/{fn[:-4]}.png'):
continue
annot = pd.read_csv(fn[:-4]+'.csv').drop_duplicates(subset='Time')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment