Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PSI-BIOM-deprecated
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
Stephane Chavin
PSI-BIOM-deprecated
Compare revisions
85f3e7162d58657e08cde9431726c2db0ac8834b to aeddecc032f3a80e3e0dbb948ed5bb96fb2a6a60
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
stephane.chavin/psi-biom
Select target project
No results found
aeddecc032f3a80e3e0dbb948ed5bb96fb2a6a60
Select Git revision
Branches
main
1 result
Swap
Target
stephane.chavin/psi-biom
Select target project
stephane.chavin/psi-biom
1 result
85f3e7162d58657e08cde9431726c2db0ac8834b
Select Git revision
Branches
main
1 result
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
correction
· 191ad7b7
Stephane Chavin
authored
2 years ago
191ad7b7
Merge branch 'main' of
https://gitlab.lis-lab.fr/stephane.chavin/psi-biom
· aeddecc0
Stephane Chavin
authored
2 years ago
aeddecc0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
get_json_file_YOLO.py
+11
-8
11 additions, 8 deletions
get_json_file_YOLO.py
with
11 additions
and
8 deletions
get_json_file_YOLO.py
View file @
aeddecc0
# /!\ TO DO before : globox convert input_YOLO/labels/val/ output_../classifier/test_convert_labels/ --format yolo --save_fmt labelme --img_folder YOLO/images/val/ #path to images
import
argparse
import
os
import
os
import
json
import
json
import
labelme
import
labelme
import
base64
import
base64
import
pandas
as
pd
import
pandas
as
pd
mode
=
'
train
'
#or val
parser
=
argparse
.
ArgumentParser
(
formatter_class
=
argparse
.
ArgumentDefaultsHelpFormatter
,
description
=
'
TODO
'
)
img_dir
=
str
(
'
../annot/YOLO/images/
'
+
mode
+
'
/
'
)
parser
.
add_argument
(
'
-p
'
,
'
--path_to_json
'
,
type
=
str
,
help
=
'
Path of the folder that contain the .json
'
,
required
=
True
)
parser
.
add_argument
(
'
-i
'
,
'
--path_to_img
'
,
type
=
str
,
help
=
'
Path of the folder that contain the .jpg
'
,
required
=
True
)
parser
.
add_argument
(
'
-d
'
,
'
--direction
'
,
type
=
str
,
help
=
'
Directory to wich modified .json files will be stored
'
,
required
=
True
)
args
=
parser
.
parse_args
()
filename
=
'
test_convert_labels_train/
'
#
path
to
.
json
filename
=
args
.
path
_
to
_
json
out_file
=
'
test_convert_labels_train_2/
'
#
direction
out_file
=
args
.
direction
img_path
=
'
/nfs/NAS7/manip_stephane/annot/YOLO/images/train/
'
img_path
=
args
.
path_to_img
liste_file
=
os
.
listdir
(
filename
)
liste_file
=
os
.
listdir
(
filename
)
liste_file
=
pd
.
DataFrame
(
liste_file
,
columns
=
[
'
fn
'
])
liste_file
=
pd
.
DataFrame
(
liste_file
,
columns
=
[
'
fn
'
])
...
@@ -24,7 +27,7 @@ liste_file = liste_file.reset_index()
...
@@ -24,7 +27,7 @@ liste_file = liste_file.reset_index()
for
i
,
row
in
liste_file
.
iterrows
():
for
i
,
row
in
liste_file
.
iterrows
():
if
len
(
row
.
fn
)
>
30
:
if
len
(
row
.
fn
)
>
30
:
data
=
labelme
.
LabelFile
.
load_image_file
(
img_dir
+
row
.
fn
[:
-
4
]
+
'
jpg
'
)
data
=
labelme
.
LabelFile
.
load_image_file
(
str
(
img_path
+
row
.
fn
[:
-
4
]
+
'
jpg
'
)
)
image_data
=
base64
.
b64encode
(
data
).
decode
(
'
utf-8
'
)
image_data
=
base64
.
b64encode
(
data
).
decode
(
'
utf-8
'
)
else
:
else
:
continue
continue
...
...
This diff is collapsed.
Click to expand it.