Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RAVEN2YOLO
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
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
Stephane Chavin
RAVEN2YOLO
Commits
e81e4b3b
Commit
e81e4b3b
authored
11 months ago
by
Stephane Chavin
Browse files
Options
Downloads
Patches
Plain Diff
debug utils
parent
7241b044
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils.py
+5
-5
5 additions, 5 deletions
utils.py
with
5 additions
and
5 deletions
utils.py
+
5
−
5
View file @
e81e4b3b
...
...
@@ -87,7 +87,7 @@ def signal_processing(sig, rf, fs, high=None, low=None):
return
sig
def
create_spectrogram
(
sig
,
directory
,
names
,
window_size
=
1024
,
overlap
=
.
5
):
def
create_spectrogram
(
sig
,
directory
,
names
,
cmap
,
window_size
=
1024
,
overlap
=
.
5
,
):
"""
Create a spectrogram STFT with hanning window and save it into a directory
...
...
@@ -101,15 +101,15 @@ def create_spectrogram(sig, directory, names, window_size=1024, overlap=.5):
print
(
f
'
You put a hop value over 1. This has been corrected to have
{
overlap
}
as overlap size between window
'
)
overlap_size
=
overlap
else
:
overlap_size
=
int
(
window_size
*
overlap
)
overlap_size
=
window_size
*
overlap
stft
=
librosa
.
stft
(
sig
,
n_fft
=
window_size
,
hop_length
=
overlap_size
,
window
=
'
hann
'
)
# Compute the STFT
stft
=
librosa
.
stft
(
sig
,
n_fft
=
int
(
window_size
)
,
hop_length
=
int
(
overlap_size
)
,
window
=
'
hann
'
)
# Compute the STFT
stft
=
np
.
log10
(
np
.
abs
(
stft
))
# Adapt the Complex-valued matrix
fig
=
plt
.
figure
()
# plot the spectrogram
plt
.
imshow
(
stft
[::
-
1
],
aspect
=
'
auto
'
,
interpolation
=
None
,
cmap
=
'
viridis
'
,
vmin
=
stft
.
mean
())
interpolation
=
None
,
cmap
=
cmap
,
vmin
=
stft
.
mean
())
# Remove all the borders around the plot
plt
.
subplots_adjust
(
top
=
1
,
bottom
=
0
,
left
=
0
,
right
=
1
)
if
names
:
...
...
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