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
154ca507
Commit
154ca507
authored
1 year ago
by
Stephane Chavin
Browse files
Options
Downloads
Patches
Plain Diff
correct
parent
da905b31
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
get_spectrogram.py
+7
-4
7 additions, 4 deletions
get_spectrogram.py
with
7 additions
and
4 deletions
get_spectrogram.py
+
7
−
4
View file @
154ca507
...
@@ -37,8 +37,8 @@ def create_spectrogram(y, directory, filename, offset, duration, window_arg, hop
...
@@ -37,8 +37,8 @@ def create_spectrogram(y, directory, filename, offset, duration, window_arg, hop
os
.
makedirs
(
os
.
path
.
join
(
directory
,
'
Spectrogram
'
),
exist_ok
=
True
)
os
.
makedirs
(
os
.
path
.
join
(
directory
,
'
Spectrogram
'
),
exist_ok
=
True
)
plt
.
savefig
(
name
+
'
.jpg
'
)
plt
.
savefig
(
name
+
'
.jpg
'
)
def
process_recordings
(
args
):
def
process_recordings
(
data
,
img_per_rec
,
args
):
_
,
(
i
)
=
args
_
,
(
i
)
=
data
duration
=
args
.
duration
duration
=
args
.
duration
overlap
=
args
.
overlap
overlap
=
args
.
overlap
...
@@ -84,5 +84,8 @@ if __name__ == "__main__":
...
@@ -84,5 +84,8 @@ if __name__ == "__main__":
elif
args
.
input
==
'
folder
'
:
elif
args
.
input
==
'
folder
'
:
df
=
pd
.
DataFrame
(
glob
.
glob
(
os
.
path
.
join
(
path_to_data
,
'
*
'
),
recursive
=
True
),
columns
=
[
'
Path
'
])
df
=
pd
.
DataFrame
(
glob
.
glob
(
os
.
path
.
join
(
path_to_data
,
'
*
'
),
recursive
=
True
),
columns
=
[
'
Path
'
])
p_map
(
process_recordings
,
enumerate
(
df
.
groupby
(
'
Path
'
),
img_per_rec
=
img_per_rec
),
num_cpus
=
args
.
cpu
,
total
=
len
(
df
.
groupby
(
'
Path
'
)))
img_per_rec
=
[
img_per_rec
]
*
len
(
df
.
groupby
(
'
Path
'
))
print
(
f
'
Saved to
{
args
.
directory
}
/Spectrogram
'
)
args
=
[
args
]
*
len
(
df
.
groupby
(
'
Path
'
))
p_map
(
process_recordings
,
enumerate
(
df
.
groupby
(
'
Path
'
)),
img_per_rec
,
args
,
num_cpus
=
args
[
0
].
cpu
,
total
=
len
(
df
.
groupby
(
'
Path
'
)))
print
(
f
'
Saved to
{
args
[
0
].
directory
}
/Spectrogram
'
)
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