Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
RODNet
Commits
7c3fd6f9
Commit
7c3fd6f9
authored
Jan 27, 2022
by
yizhou-wang
Browse files
update prepare_dataset.py when camera images and annotations are not available for testing set
parent
ecfa4fc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
tools/prepare_dataset/prepare_data.py
tools/prepare_dataset/prepare_data.py
+13
-5
No files found.
tools/prepare_dataset/prepare_data.py
View file @
7c3fd6f9
...
@@ -124,10 +124,15 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
...
@@ -124,10 +124,15 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
if
not
overwrite
and
os
.
path
.
exists
(
save_path
):
if
not
overwrite
and
os
.
path
.
exists
(
save_path
):
print
(
"%s already exists, skip"
%
save_path
)
print
(
"%s already exists, skip"
%
save_path
)
continue
continue
image_dir
=
os
.
path
.
join
(
seq_path
,
camera_configs
[
'image_folder'
])
image_dir
=
os
.
path
.
join
(
seq_path
,
camera_configs
[
'image_folder'
])
image_paths
=
sorted
([
os
.
path
.
join
(
image_dir
,
name
)
for
name
in
os
.
listdir
(
image_dir
)
if
if
os
.
path
.
exists
(
image_dir
):
name
.
endswith
(
camera_configs
[
'ext'
])])
image_paths
=
sorted
([
os
.
path
.
join
(
image_dir
,
name
)
for
name
in
os
.
listdir
(
image_dir
)
if
n_frame
=
len
(
image_paths
)
name
.
endswith
(
camera_configs
[
'ext'
])])
n_frame
=
len
(
image_paths
)
else
:
# camera images are not available
image_paths
=
None
n_frame
=
None
radar_dir
=
os
.
path
.
join
(
seq_path
,
dataset
.
sensor_cfg
.
radar_cfg
[
'chirp_folder'
])
radar_dir
=
os
.
path
.
join
(
seq_path
,
dataset
.
sensor_cfg
.
radar_cfg
[
'chirp_folder'
])
if
radar_configs
[
'data_type'
]
==
'RI'
or
radar_configs
[
'data_type'
]
==
'AP'
:
if
radar_configs
[
'data_type'
]
==
'RI'
or
radar_configs
[
'data_type'
]
==
'AP'
:
...
@@ -151,7 +156,10 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
...
@@ -151,7 +156,10 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
frame_paths
.
append
(
radar_paths_chirp
[
chirp_id
][
frame_id
])
frame_paths
.
append
(
radar_paths_chirp
[
chirp_id
][
frame_id
])
radar_paths
.
append
(
frame_paths
)
radar_paths
.
append
(
frame_paths
)
elif
radar_configs
[
'data_type'
]
==
'ROD2021'
:
elif
radar_configs
[
'data_type'
]
==
'ROD2021'
:
assert
len
(
os
.
listdir
(
radar_dir
))
==
n_frame
*
len
(
radar_configs
[
'chirp_ids'
])
if
n_frame
is
not
None
:
assert
len
(
os
.
listdir
(
radar_dir
))
==
n_frame
*
len
(
radar_configs
[
'chirp_ids'
])
else
:
# camera images are not available
n_frame
=
int
(
len
(
os
.
listdir
(
radar_dir
))
/
len
(
radar_configs
[
'chirp_ids'
]))
radar_paths
=
[]
radar_paths
=
[]
for
frame_id
in
range
(
n_frame
):
for
frame_id
in
range
(
n_frame
):
chirp_paths
=
[]
chirp_paths
=
[]
...
@@ -173,7 +181,7 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
...
@@ -173,7 +181,7 @@ def prepare_data(dataset, config_dict, data_dir, split, save_dir, viz=False, ove
anno
=
None
,
anno
=
None
,
)
)
if
split
==
'demo'
:
if
split
==
'demo'
or
not
os
.
path
.
exists
(
seq_anno_path
)
:
# no labels need to be saved
# no labels need to be saved
pickle
.
dump
(
data_dict
,
open
(
save_path
,
'wb'
))
pickle
.
dump
(
data_dict
,
open
(
save_path
,
'wb'
))
continue
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment