Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
f0_estimation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
f0_estimation
Commits
a00e3ff3
Commit
a00e3ff3
authored
1 year ago
by
Paul Best
Browse files
Options
Downloads
Patches
Plain Diff
nicer plots
parent
24614437
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
plot_freq_distrib.py
+1
-1
1 addition, 1 deletion
plot_freq_distrib.py
plot_scores_bars.py
+11
-6
11 additions, 6 deletions
plot_scores_bars.py
plot_scores_scatter.py
+37
-0
37 additions, 0 deletions
plot_scores_scatter.py
plot_snr_distrib.py
+11
-18
11 additions, 18 deletions
plot_snr_distrib.py
with
60 additions
and
25 deletions
plot_freq_distrib.py
+
1
−
1
View file @
a00e3ff3
...
...
@@ -6,7 +6,7 @@ import os, mir_eval
from
metadata
import
species
np
.
seterr
(
divide
=
'
ignore
'
)
fig
,
ax
=
plt
.
subplots
(
ncols
=
3
,
sharey
=
True
,
figsize
=
(
10
,
4.8
))
fig
,
ax
=
plt
.
subplots
(
ncols
=
3
,
sharey
=
True
,
figsize
=
(
10
,
3.5
))
ax
[
0
].
set_title
(
'
Frequency (Hz)
'
)
ax
[
1
].
set_title
(
'
# Voiced time bins
'
)
ax
[
2
].
set_title
(
'
Modulation rate (Hz/sec)
'
)
...
...
This diff is collapsed.
Click to expand it.
plot_scores.py
→
plot_scores
_bars
.py
+
11
−
6
View file @
a00e3ff3
import
matplotlib.pyplot
as
plt
import
pandas
as
pd
,
numpy
as
np
from
metadata
import
species
import
argparse
algos
=
[
'
praat
'
,
'
tcrepe_ftsp
'
,
'
tcrepe_ftoth
'
,
'
basic
'
,
'
pesto
'
,
'
pesto_ft
'
]
metrics
=
[
'
Recall
'
,
'
False alarm
'
,
'
Pitch acc
'
,
'
Chroma acc
'
]
metrics
=
[
'
Pitch acc
'
,
'
Chroma acc
'
,
'
Recall
'
,
'
Specificity
'
]
drop_noisy_bins
=
False
drop_noisy_vocs
=
False
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--drop_noisy_bins
'
,
type
=
bool
,
help
=
"
drop noisy vocalisations
"
,
default
=
False
)
parser
.
add_argument
(
'
--drop_noisy_vocs
'
,
type
=
bool
,
help
=
"
drop noisy STFT bins
"
,
default
=
False
)
args
=
parser
.
parse_args
()
drop_noisy_vocs
,
drop_noisy_bins
=
args
.
drop_noisy_vocs
,
args
.
drop_noisy_bins
fig
,
ax
=
plt
.
subplots
(
nrows
=
2
,
ncols
=
2
,
figsize
=
(
10
,
10
),
sharex
=
True
,
sharey
=
True
)
fig
,
ax
=
plt
.
subplots
(
nrows
=
2
,
ncols
=
2
,
figsize
=
(
10
,
5
),
sharex
=
True
,
sharey
=
True
)
ax
[
0
,
0
].
set_ylim
(
0
,
1
)
for
i
,
metric
in
enumerate
(
metrics
):
ok
=
pd
.
DataFrame
()
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
[
'
False alarm
'
]
=
1
-
df
[
'
False alarm
'
]
df
[
'
Specificity
'
]
=
1
-
df
[
'
False alarm
'
]
ok
.
loc
[
specie
,
df
.
index
]
=
df
[
metric
]
ok
=
ok
[
algos
]
# bar plot
m_ax
=
ax
[
int
(
i
//
2
),
i
%
2
]
ok
.
plot
.
bar
h
(
ax
=
m_ax
,
legend
=
None
)
ok
.
plot
.
bar
(
ax
=
m_ax
,
legend
=
None
,
rot
=
45
,
width
=
.
6
)
m_ax
.
grid
()
m_ax
.
set_title
(
metric
)
if
i
%
2
==
1
:
m_ax
.
legend
(
bbox_to_anchor
=
(
1
,
1
))
plt
.
tight_layout
()
plt
.
savefig
(
f
'
scores
{
"
_minusvocs
"
if
drop_noisy_vocs
else
""
}{
"
_minusbins
"
if
drop_noisy_bins
else
""
}
.pdf
'
)
This diff is collapsed.
Click to expand it.
plot_scores_scatter.py
0 → 100644
+
37
−
0
View file @
a00e3ff3
import
matplotlib.pyplot
as
plt
import
pandas
as
pd
,
numpy
as
np
from
metadata
import
species
import
argparse
algos
=
[
'
praat
'
,
'
tcrepe
'
,
'
tcrepe_ftsp
'
,
'
tcrepe_ftoth
'
,
'
basic
'
,
'
pesto
'
,
'
pesto_ft
'
]
metrics
=
[
'
Pitch acc
'
,
'
Chroma acc
'
,
'
Recall
'
,
'
False alarm
'
]
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--drop_noisy_bins
'
,
type
=
bool
,
help
=
"
drop noisy vocalisations
"
,
default
=
False
)
parser
.
add_argument
(
'
--drop_noisy_vocs
'
,
type
=
bool
,
help
=
"
drop noisy STFT bins
"
,
default
=
False
)
args
=
parser
.
parse_args
()
drop_noisy_vocs
,
drop_noisy_bins
=
args
.
drop_noisy_vocs
,
args
.
drop_noisy_bins
fig
,
ax
=
plt
.
subplots
(
nrows
=
2
,
ncols
=
2
,
figsize
=
(
10
,
5
),
sharex
=
True
,
sharey
=
True
)
ax
[
0
,
0
].
set_ylim
(
0
,
1
)
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
[
'
False alarm
'
]
=
1
-
df
[
'
False alarm
'
]
for
algo
in
algos
:
if
not
algo
in
df
.
index
:
df
.
loc
[
algo
,
metrics
]
=
[
None
]
*
len
(
metrics
)
for
i
,
metric
in
enumerate
(
metrics
):
ax
[
int
(
i
//
2
),
i
%
2
].
scatter
(
np
.
arange
(
len
(
algos
)),
df
.
loc
[
algos
,
metric
],
label
=
specie
)
for
i
,
metric
in
enumerate
(
metrics
):
m_ax
=
ax
[
int
(
i
//
2
),
i
%
2
]
m_ax
.
grid
()
m_ax
.
set_title
(
metric
)
plt
.
xticks
(
np
.
arange
(
len
(
algos
)),
algos
,
rotation
=
22
)
ax
[
1
,
0
].
set_xticklabels
(
algos
,
rotation
=
22
)
plt
.
tight_layout
(
rect
=
(
0
,
0
,
.
87
,
1
))
ax
[
0
,
1
].
legend
(
bbox_to_anchor
=
(
1
,
1
))
plt
.
savefig
(
f
'
scatter_scores
{
"
_minusvocs
"
if
drop_noisy_vocs
else
""
}{
"
_minusbins
"
if
drop_noisy_bins
else
""
}
.pdf
'
)
This diff is collapsed.
Click to expand it.
plot_snr_distrib.py
+
11
−
18
View file @
a00e3ff3
...
...
@@ -7,13 +7,10 @@ import mir_eval, librosa
from
metadata
import
species
np
.
seterr
(
divide
=
'
ignore
'
)
fig
,
ax
=
plt
.
subplots
(
ncols
=
2
,
share
x
=
True
,
figsize
=
(
10
,
4.8
))
fig
,
ax
=
plt
.
subplots
(
ncols
=
2
,
share
y
=
True
,
figsize
=
(
10
,
3.5
))
SNRs
,
SHRs
=
[],
[]
for
i
,
specie
in
enumerate
(
species
):
wavpath
,
FS
,
nfft
,
downsample
=
species
[
specie
].
values
()
dt
=
nfft
/
8
/
FS
fns
=
pd
.
Series
(
glob
(
wavpath
))
def
fun
(
fn
):
df
=
pd
.
read_csv
(
f
'
{
fn
[
:
-
4
]
}
_preds.csv
'
)
...
...
@@ -22,20 +19,16 @@ for i, specie in enumerate(species):
return
0
,
0
return
df
.
salience
.
quantile
(.
25
),
df
.
SHR
.
quantile
(.
25
)
ret
=
p_umap
(
fun
,
glob
(
wavpath
),
desc
=
specie
,
num_cpus
=
40
)
SNRs
.
append
(
list
(
zip
(
*
ret
))[
0
])
SHRs
.
append
(
list
(
zip
(
*
ret
))[
1
])
ret
=
p_umap
(
fun
,
glob
(
species
[
specie
][
'
wavpath
'
]
),
desc
=
specie
,
num_cpus
=
40
)
ax
[
0
].
violinplot
(
list
(
zip
(
*
ret
))[
0
]
,
positions
=
[
i
],
vert
=
False
)
ax
[
1
].
violinplot
(
list
(
zip
(
*
ret
))[
1
]
,
positions
=
[
i
],
vert
=
False
)
ax
[
0
].
set_title
(
'
f0 saliency
'
)
ax
[
1
].
set_title
(
'
SHR (dB)
'
)
plt
.
yticks
(
np
.
arange
(
len
(
species
)),
[
s
.
replace
(
'
_
'
,
'
'
)
for
s
in
species
])
ax
[
0
].
violinplot
(
SNRs
,
positions
=
np
.
arange
(
len
(
species
)))
ax
[
0
].
set_ylabel
(
'
f0 saliency
'
)
ax
[
1
].
violinplot
(
SHRs
,
positions
=
np
.
arange
(
len
(
species
)))
ax
[
1
].
set_ylabel
(
'
SHR (dB)
'
)
ax
[
0
].
set_xticks
(
np
.
arange
(
len
(
species
)))
ax
[
0
].
set_xticklabels
(
species
.
keys
(),
rotation
=
45
)
ax
[
1
].
set_xticklabels
(
species
.
keys
(),
rotation
=
45
)
ax
[
0
].
hlines
(.
2
,
.
5
,
len
(
species
)
-
.
5
,
linestyle
=
'
dashed
'
,
colors
=
'
k
'
)
ax
[
1
].
hlines
(
10
*
np
.
log10
(
0.2
),
-
.
5
,
len
(
species
)
-
.
5
,
linestyle
=
'
dashed
'
,
colors
=
'
k
'
)
ax
[
0
].
vlines
(.
2
,
.
5
,
len
(
species
)
-
.
5
,
linestyle
=
'
dashed
'
,
colors
=
'
k
'
)
ax
[
1
].
vlines
(
10
*
np
.
log10
(
0.2
),
-
.
5
,
len
(
species
)
-
.
5
,
linestyle
=
'
dashed
'
,
colors
=
'
k
'
)
plt
.
tight_layout
()
plt
.
savefig
(
'
SNR_distrib.pdf
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment