Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
Vocal Repertoire Embedder
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
Vocal Repertoire Embedder
Commits
12a8ee28
Commit
12a8ee28
authored
2 years ago
by
Paul Best
Browse files
Options
Downloads
Patches
Plain Diff
add fetch annot from pngs
parent
f7d19c2c
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
new_specie/fetch_annot_from_pngs.py
+20
-0
20 additions, 0 deletions
new_specie/fetch_annot_from_pngs.py
with
20 additions
and
0 deletions
new_specie/fetch_annot_from_pngs.py
0 → 100755
+
20
−
0
View file @
12a8ee28
import
pandas
as
pd
import
os
import
argparse
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
\
description
=
"""
This script fetches the annotations stored via the sorting of .png files.
For each sample (.png file), the name of its parent folder will be set as label in the detection.pkl file (column type).
For instance, create a folder named annotation_toto. In it, create a folder Phee containing .png spectrograms of Phee vocalisations,
and another folder named Trill etc...
In these folders, add samples of the correct type to store annotations.
"""
)
parser
.
add_argument
(
'
annot_folder
'
,
type
=
str
,
help
=
'
Name of the folder containing annotations.
'
)
parser
.
add_argument
(
"
detections
"
,
type
=
str
,
help
=
"
.csv file with detections that were clustered (labels will be added to it)
"
)
args
=
parser
.
parse_args
()
df
=
pd
.
read_csv
(
args
.
detections
))
for
label
in
os
.
listdir
(
args
.
annot_folder
+
'
/
'
):
for
file
in
os
.
listdir
(
f
'
{
args
.
annot_folder
}
/
{
label
}
/
'
):
df
.
loc
[
int
(
file
.
split
(
'
.
'
)[
0
]),
'
type
'
]
=
label
df
.
to_csv
(
args
.
detections
,
index
=
False
)
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