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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stephane Chavin
RAVEN2YOLO
Commits
279b542a
Commit
279b542a
authored
5 months ago
by
Stephane Chavin
Browse files
Options
Downloads
Patches
Plain Diff
correct
parent
a7e42490
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_train_val.py
+7
-6
7 additions, 6 deletions
get_train_val.py
with
7 additions
and
6 deletions
get_train_val.py
+
7
−
6
View file @
279b542a
...
...
@@ -4,6 +4,7 @@ import argparse
import
os
import
pandas
as
pd
import
utils
import
glob
from
tqdm
import
tqdm
...
...
@@ -24,7 +25,7 @@ def export_split(argument, entry, path, directory):
if
argument
.
test
:
test_set
=
entry
[
2
]
test_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
.
'
)[:
-
1
])
test_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
/
'
)[
-
1
].
split
(
'
.
'
)[:
-
1
])
for
num
,
x
in
enumerate
(
test
.
file
)]
utils
.
copy_files_to_directory
(
test_set
.
file
,
path
,
os
.
path
.
join
(
...
...
@@ -32,9 +33,9 @@ def export_split(argument, entry, path, directory):
utils
.
copy_files_to_directory
(
test_set
.
file
,
os
.
path
.
join
(
path
,
'
../images/all
'
),
os
.
path
.
join
(
directory
,
'
images/test
'
),
'
jpg
'
)
val_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
.
'
)[:
-
1
])
val_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
/
'
)[
-
1
].
split
(
'
.
'
)[:
-
1
])
for
_
,
x
in
enumerate
(
val
.
file
)]
train_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
.
'
)[:
-
1
])
train_set
.
file
=
[
'
.
'
.
join
(
x
.
split
(
'
/
'
)[
-
1
].
split
(
'
.
'
)[:
-
1
])
for
_
,
x
in
enumerate
(
train_set
.
file
)]
# Copy the validation set into the folder
...
...
@@ -71,7 +72,7 @@ def prepare_data(arguments):
"""
annotations
=
[]
background
=
[]
for
f
in
tqdm
(
arguments
.
path_to_data
,
desc
=
"
Processing
"
,
for
f
in
tqdm
(
glob
.
glob
(
os
.
path
.
join
(
arguments
.
path_to_data
))
,
desc
=
"
Processing
"
,
ascii
=
'
░▒▓█
'
):
file_annotation
=
pd
.
read_csv
(
f
,
sep
=
'
'
,
names
=
[
'
species
'
,
'
x
'
,
'
y
'
,
'
w
'
,
'
h
'
])
if
len
(
file_annotation
)
==
0
:
...
...
@@ -120,7 +121,7 @@ if __name__ == '__main__':
print
(
f
'
Train saved in
{
saved_directory
}
\n
'
)
print
(
'
To train your model, use the following command :
\n
'
)
current_path
=
os
.
getcwd
(
)
current_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)
)
directory_path
=
os
.
path
.
join
(
current_path
,
saved_directory
)
...
...
@@ -131,7 +132,7 @@ if __name__ == '__main__':
command
=
f
'
python
{
yolo_path
}
--data
{
data_path
}
--imgsz 640 --epochs 100 --weights
{
weights_path
}
--hyp
{
hyp_path
}
--cache
'
print
(
command
,
'
\n
'
)
if
len
(
background
==
0
)
:
if
len
(
background
)
==
0
:
print
(
'
\u26A0\uFE0F
Be aware that it is recommended to have background images that
'
,
'
represents 10% of your dataset. If you do not have background, use the script
"
get_spectrogram.py
"'
,
'
with --background arguments. Comptue on recordings that contains multiple type of noise...
'
)
...
...
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