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
mmdetection3d
Commits
5a3f5a37
Commit
5a3f5a37
authored
Jul 06, 2020
by
wangtai
Committed by
zhangwenwei
Jul 06, 2020
Browse files
convert absolute path to relative version in Lyft
parent
1d2ac994
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
tools/data_converter/lyft_converter.py
tools/data_converter/lyft_converter.py
+7
-2
tools/data_converter/nuscenes_converter.py
tools/data_converter/nuscenes_converter.py
+7
-0
No files found.
tools/data_converter/lyft_converter.py
View file @
5a3f5a37
import
mmcv
import
mmcv
import
numpy
as
np
import
numpy
as
np
import
os
from
lyft_dataset_sdk.lyftdataset
import
LyftDataset
as
Lyft
from
lyft_dataset_sdk.lyftdataset
import
LyftDataset
as
Lyft
from
os
import
path
as
osp
from
os
import
path
as
osp
from
pyquaternion
import
Quaternion
from
pyquaternion
import
Quaternion
...
@@ -115,8 +116,12 @@ def _fill_trainval_infos(lyft,
...
@@ -115,8 +116,12 @@ def _fill_trainval_infos(lyft,
cs_record
=
lyft
.
get
(
'calibrated_sensor'
,
cs_record
=
lyft
.
get
(
'calibrated_sensor'
,
sd_rec
[
'calibrated_sensor_token'
])
sd_rec
[
'calibrated_sensor_token'
])
pose_record
=
lyft
.
get
(
'ego_pose'
,
sd_rec
[
'ego_pose_token'
])
pose_record
=
lyft
.
get
(
'ego_pose'
,
sd_rec
[
'ego_pose_token'
])
lidar_path
,
boxes
,
_
=
lyft
.
get_sample_data
(
lidar_token
)
abs_lidar_path
,
boxes
,
_
=
lyft
.
get_sample_data
(
lidar_token
)
lidar_path
=
str
(
lidar_path
)
# nuScenes devkit returns more convenient relative paths while
# lyft devkit returns absolute paths
abs_lidar_path
=
str
(
abs_lidar_path
)
# absolute path
lidar_path
=
abs_lidar_path
.
split
(
f
'
{
os
.
getcwd
()
}
/'
)[
-
1
]
# relative path
mmcv
.
check_file_exist
(
lidar_path
)
mmcv
.
check_file_exist
(
lidar_path
)
...
...
tools/data_converter/nuscenes_converter.py
View file @
5a3f5a37
import
mmcv
import
mmcv
import
numpy
as
np
import
numpy
as
np
import
os
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
nuscenes.nuscenes
import
NuScenes
from
nuscenes.nuscenes
import
NuScenes
from
nuscenes.utils.geometry_utils
import
view_points
from
nuscenes.utils.geometry_utils
import
view_points
...
@@ -117,6 +118,10 @@ def get_available_scenes(nusc):
...
@@ -117,6 +118,10 @@ def get_available_scenes(nusc):
while
has_more_frames
:
while
has_more_frames
:
lidar_path
,
boxes
,
_
=
nusc
.
get_sample_data
(
sd_rec
[
'token'
])
lidar_path
,
boxes
,
_
=
nusc
.
get_sample_data
(
sd_rec
[
'token'
])
lidar_path
=
str
(
lidar_path
)
lidar_path
=
str
(
lidar_path
)
if
os
.
getcwd
()
in
lidar_path
:
# path from lyftdataset is absolute path
lidar_path
=
lidar_path
.
split
(
f
'
{
os
.
getcwd
()
}
/'
)[
-
1
]
# relative path
if
not
mmcv
.
is_filepath
(
lidar_path
):
if
not
mmcv
.
is_filepath
(
lidar_path
):
scene_not_exist
=
True
scene_not_exist
=
True
break
break
...
@@ -286,6 +291,8 @@ def obtain_sensor2top(nusc,
...
@@ -286,6 +291,8 @@ def obtain_sensor2top(nusc,
sd_rec
[
'calibrated_sensor_token'
])
sd_rec
[
'calibrated_sensor_token'
])
pose_record
=
nusc
.
get
(
'ego_pose'
,
sd_rec
[
'ego_pose_token'
])
pose_record
=
nusc
.
get
(
'ego_pose'
,
sd_rec
[
'ego_pose_token'
])
data_path
=
str
(
nusc
.
get_sample_data_path
(
sd_rec
[
'token'
]))
data_path
=
str
(
nusc
.
get_sample_data_path
(
sd_rec
[
'token'
]))
if
os
.
getcwd
()
in
data_path
:
# path from lyftdataset is absolute path
data_path
=
data_path
.
split
(
f
'
{
os
.
getcwd
()
}
/'
)[
-
1
]
# relative path
sweep
=
{
sweep
=
{
'data_path'
:
data_path
,
'data_path'
:
data_path
,
'type'
:
sensor_type
,
'type'
:
sensor_type
,
...
...
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