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
9066e7e4
Commit
9066e7e4
authored
2 years ago
by
Stephane Chavin
Browse files
Options
Downloads
Patches
Plain Diff
add_frequency
parent
f1d91af8
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_time_freq_detection.py
+7
-2
7 additions, 2 deletions
get_time_freq_detection.py
with
7 additions
and
2 deletions
get_time_detection.py
→
get_time_
freq_
detection.py
+
7
−
2
View file @
9066e7e4
...
...
@@ -14,6 +14,8 @@ def arg_directory(path):
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
description
=
'
TODO
'
)
parser
.
add_argument
(
'
-p
'
,
'
--path_to_data
'
,
type
=
arg_directory
,
help
=
'
Path of the folder that contain the .txt files
'
,
required
=
True
)
parser
.
add_argument
(
'
-d
'
,
'
--directory
'
,
type
=
arg_directory
,
help
=
'
Directory to wich the dataframe will be stored
'
,
required
=
True
)
parser
.
add_argument
(
'
-t
'
,
'
--duration
'
,
type
=
int
,
help
=
'
Duration of the spectrogram
'
,
required
=
True
)
parser
.
add_argument
(
'
-s
'
,
'
--SR
'
,
type
=
int
,
help
=
'
Sampling Rate of the spectrogram
'
)
args
=
parser
.
parse_args
()
annots
=
args
.
path_to_data
...
...
@@ -32,8 +34,8 @@ del df['index']
df
[
'
idx
'
]
=
df
.
file
.
str
.
split
(
'
_
'
).
str
[
-
1
].
str
.
split
(
'
.
'
).
str
[
0
]
df
.
file
=
df
.
file
.
str
.
rsplit
(
'
.
'
,
1
).
str
[
0
]
+
'
.wav
'
DUREE_SPECTRO
=
8
OVERLAP
=
2
DUREE_SPECTRO
=
args
.
duration
SR
=
args
.
SR
#put the classes here
names
=
[]
...
...
@@ -44,6 +46,9 @@ for j in range (len(df)):
print
(
'
Calculating the positions
'
,
'
\n
'
)
df
[
'
midl
'
]
=
(
df
.
x
*
8
)
+
(
df
.
idx
.
astype
(
int
))
df
[
'
freq_center
'
]
=
(
1
-
df
.
y
)
*
(
SR
/
2
)
df
[
'
freq_min
'
]
=
df
.
freq_center
-
(
df
.
h
*
(
SR
/
2
))
/
2
df
[
'
freq_max
'
]
=
df
.
freq_center
+
(
df
.
h
*
(
SR
/
2
))
/
2
df
.
to_csv
(
os
.
path
.
join
(
outdir
,
str
(
out_file
+
'
.csv
'
)),
index
=
False
)
print
(
'
saved as
'
,
os
.
path
.
join
(
outdir
,
str
(
out_file
+
'
.csv
'
)))
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