Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FruitBin
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Guillaume Duret
FruitBin
Commits
ac710fa6
Commit
ac710fa6
authored
2 years ago
by
Guillaume Duret
Browse files
Options
Downloads
Patches
Plain Diff
add filtering multi countour for yolo, add some cmd argument for flexibility
parent
e4fcd45c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
compute_features.py
+2
-6
2 additions, 6 deletions
compute_features.py
main.py
+9
-4
9 additions, 4 deletions
main.py
prepare_data.py
+1
-0
1 addition, 0 deletions
prepare_data.py
slurm/process_dataset.slurm
+7
-2
7 additions, 2 deletions
slurm/process_dataset.slurm
with
19 additions
and
12 deletions
compute_features.py
+
2
−
6
View file @
ac710fa6
...
...
@@ -140,24 +140,18 @@ def process_compute(data_name, camera, camera_resized, new_size, Nb_camera, Worl
for
scenario_loop
in
scenarios
:
if
not
destination_folders
[
scenario_loop
]
==
"
dont_save
"
:
np
.
save
(
f
'
{
data_name
}
/
{
destination_folders
[
scenario_loop
]
}
/
{
categories
}
/Pose_transformed/
{
p
}
.npy
'
,
num_arr
)
# save
else
:
continue
if
data_Bbox_2d
[
k
][
'
id
'
]
==
categories_occ_array
[
categories
][
0
]:
bbox
=
bbox_2d
(
data_Bbox_2d
[
k
])
for
scenario_loop
in
scenarios
:
if
not
destination_folders
[
scenario_loop
]
==
"
dont_save
"
:
np
.
savetxt
(
f
'
{
data_name
}
/
{
destination_folders
[
scenario_loop
]
}
/
{
categories
}
/Bbox/
{
p
}
.txt
'
,
np
.
array
(
bbox
).
reshape
((
1
,
4
)))
# save
else
:
continue
if
data_Bbox_3d
[
k
][
'
id
'
]
==
categories_occ_array
[
categories
][
0
]:
bbox3d_size
=
data_Bbox_3d
[
k
][
'
bbox
'
][
'
size
'
]
for
scenario_loop
in
scenarios
:
if
not
destination_folders
[
scenario_loop
]
==
"
dont_save
"
:
np
.
savetxt
(
f
'
{
data_name
}
/
{
destination_folders
[
scenario_loop
]
}
/
{
categories
}
/Bbox_3d_Gen/
{
p
}
.txt
'
,
bbox3d_size
)
# save
else
:
continue
id
=
categories_occ_array
[
categories
][
0
]
img
=
cv2
.
imread
(
f
"
{
data_name
}
/Instance_Segmentation/
{
p
}
.png
"
,
cv2
.
IMREAD_UNCHANGED
)
# plt.imread(path)
...
...
@@ -173,6 +167,8 @@ def process_compute(data_name, camera, camera_resized, new_size, Nb_camera, Worl
image
=
cv2
.
imread
(
f
"
{
data_name
}
/
{
destination_folders
[
scenario_loop
]
}
/
{
categories
}
/Instance_Mask/
{
p
}
.png
"
,
0
)
image
=
image
/
255.0
contours
,
_
=
cv2
.
findContours
(
image
.
astype
(
np
.
uint8
),
cv2
.
RETR_TREE
,
cv2
.
CHAIN_APPROX_NONE
)
if
len
(
contours
)
>
1
:
continue
for
l
in
range
(
len
(
contours
[
0
])):
x
=
contours
[
0
][
l
][
0
][
0
]
/
640.0
res
.
append
(
x
)
...
...
This diff is collapsed.
Click to expand it.
main.py
+
9
−
4
View file @
ac710fa6
...
...
@@ -60,6 +60,8 @@ if __name__ == '__main__':
parser
.
add_argument
(
'
--Nb_worlds
'
,
type
=
int
,
required
=
True
)
parser
.
add_argument
(
'
--World_begin
'
,
type
=
int
,
required
=
True
)
parser
.
add_argument
(
'
--dataset_id
'
,
type
=
str
,
required
=
True
)
parser
.
add_argument
(
'
--rearrange
'
,
type
=
bool
,
required
=
True
)
parser
.
add_argument
(
'
--compute
'
,
type
=
bool
,
required
=
True
)
# Parse the argument
args
=
parser
.
parse_args
()
...
...
@@ -70,7 +72,7 @@ if __name__ == '__main__':
Nb_instance
=
1
occ_target
=
0.5
dataset_src
=
f
"
/gpfsscratch/rech/uli/ubn15wo/data
set
{
args
.
dataset_id
}
/s2rg/Fruits_all_medium/data/
"
dataset_src
=
f
"
/gpfsscratch/rech/uli/ubn15wo/data
{
args
.
dataset_id
}
"
#dataset_src = "/media/mahmoud/E/Fruits_easy/data"
#dataset_src = "/media/gduret/DATA/dataset/s2rg/Fruits_all_medium/data"
...
...
@@ -78,7 +80,8 @@ if __name__ == '__main__':
data_options
=
{
"
high
"
:
"
ground_truth_rgb
"
,
"
low
"
:
"
ground_truth_depth
"
}
dataset_type
=
data_options
[
choice
]
dataset_name
=
f
"
/gpfsscratch/rech/uli/ubn15wo/dataset
{
args
.
dataset_id
}
/s2rg/Fruits_all_medium/GUIMOD_
{
choice
}
"
dataset_name
=
f
"
/gpfsscratch/rech/uli/ubn15wo/GUIMOD_New_
{
choice
}
_
{
args
.
dataset_id
}
"
#dataset_name = f"/gpfsscratch/rech/uli/ubn15wo/dataset_new{args.dataset_id}/s2rg/Fruits_all_medium/GUIMOD_{choice}"
list_categories
=
[
"
banana1
"
,
"
kiwi1
"
,
"
pear2
"
,
"
apricot
"
,
"
orange2
"
,
"
peach1
"
,
"
lemon2
"
,
"
apple2
"
]
Nb_camera
=
15
#Nb_world = 10000
...
...
@@ -108,7 +111,8 @@ if __name__ == '__main__':
#np.savetxt(f'{dataset_name}/Generated/camera_{choice}.txt', camera)
#reform_data(dataset_src, dataset_name, dataset_type, Nb_camera, args.World_begin, args.Nb_worlds)
if
args
.
rearrange
:
reform_data
(
dataset_src
,
dataset_name
,
dataset_type
,
Nb_camera
,
args
.
World_begin
,
args
.
Nb_worlds
)
objs
=
{
"
banana1
"
:
[
0.02949700132012367249
,
0.1511049866676330566
,
0.06059300713241100311
],
"
kiwi1
"
:
[
0.04908600077033042908
,
0.07206099480390548706
,
0.04909799993038177490
],
...
...
@@ -138,5 +142,6 @@ if __name__ == '__main__':
bbox
=
get_3D_bbox
(
ext
)
np
.
savetxt
(
f
'
{
dataset_name
}
/Generated/
{
categories
}
/
{
categories
}
_bbox_3d.txt
'
,
bbox
)
# save
process_compute
(
dataset_name
,
camera
,
new_camera
,
new_size
,
Nb_camera
,
args
.
World_begin
,
args
.
Nb_worlds
,
list_categories
,
occ_target
,
False
)
if
args
.
compute
:
process_compute
(
dataset_name
,
camera
,
new_camera
,
new_size
,
Nb_camera
,
args
.
World_begin
,
args
.
Nb_worlds
,
list_categories
,
occ_target
,
False
)
This diff is collapsed.
Click to expand it.
prepare_data.py
+
1
−
0
View file @
ac710fa6
...
...
@@ -8,6 +8,7 @@ def reform_data(src, data_name, data_option, Nb_camera, World_begin, Nb_world):
shutil
.
copy
(
src_meta
,
dst_meta
)
for
j
in
range
(
1
,
Nb_camera
+
1
):
# cameras
count
=
((
i
-
1
)
*
Nb_camera
)
+
j
print
(
count
)
if
data_option
==
"
ground_truth_rgb
"
:
files_img
=
os
.
listdir
(
f
"
{
src
}
/
{
i
}
/grabber_
{
j
}
/color/image/
"
)
src_img
=
f
"
{
src
}
/
{
i
}
/grabber_
{
j
}
/color/image/
{
files_img
[
0
]
}
"
...
...
This diff is collapsed.
Click to expand it.
slurm/process_dataset.slurm
+
7
−
2
View file @
ac710fa6
...
...
@@ -20,7 +20,8 @@ cd ${SLURM_SUBMIT_DIR}
module purge
# chargement des modules
module load python/3.7.10
# echo des commandes lancées
set
-x
...
...
@@ -29,7 +30,11 @@ set -x
id_begin
=
$1
Nb
=
$2
id_dataset
=
$3
rearrange
=
$4
compute
=
$5
time
(
python3.6 main.py
--World_begin
=
"
$id_begin
"
--Nb_world
=
"
$Nb
"
)
conda activate stvNet
time
(
python main.py
--World_begin
=
"
$id_begin
"
--Nb_world
=
"
$Nb
"
--dataset_id
=
"
$id_dataset
"
--rearrange
=
$rearrange
--compute
=
$compute
)
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