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
cda6a1a3
".github/vscode:/vscode.git/clone" did not exist on "ace4848434eff38d7652ea7431bbbbebf364e318"
Commit
cda6a1a3
authored
May 08, 2020
by
liyinhao
Browse files
create color module, delete somr extra files, change npz to npy
parent
c4b2f80b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
21 deletions
+30
-21
mmdet3d/datasets/pipelines/indoor_loading.py
mmdet3d/datasets/pipelines/indoor_loading.py
+24
-12
tests/data/scannet/meta_data/scannetv2.txt
tests/data/scannet/meta_data/scannetv2.txt
+0
-1
tests/data/sunrgbd/sunrgbd_infos.pkl
tests/data/sunrgbd/sunrgbd_infos.pkl
+0
-0
tests/data/sunrgbd/sunrgbd_trainval/data_idx.txt
tests/data/sunrgbd/sunrgbd_trainval/data_idx.txt
+0
-1
tests/test_indoor_loading.py
tests/test_indoor_loading.py
+3
-4
tools/data_converter/sunrgbd_data_utils.py
tools/data_converter/sunrgbd_data_utils.py
+3
-3
No files found.
mmdet3d/datasets/pipelines/indoor_loading.py
View file @
cda6a1a3
...
...
@@ -5,7 +5,28 @@ import numpy as np
from
mmdet.datasets.registry
import
PIPELINES
@
PIPELINES
.
register_module
@
PIPELINES
.
register_module
()
class
PointsColorNormalize
(
object
):
"""Points Color Normalize
Normalize color of the points.
Args:
color_mean (List[float]): Mean color of the point cloud.
"""
def
__init__
(
self
,
color_mean
):
self
.
color_mean
=
color_mean
def
__call__
(
self
,
results
):
points
=
results
.
get
(
'results'
,
None
)
assert
points
.
shape
[
1
]
>=
6
points
[:,
3
:
6
]
=
points
[:,
3
:
6
]
-
np
.
array
(
self
.
color_mean
)
/
256.0
results
[
'points'
]
=
points
return
results
@
PIPELINES
.
register_module
()
class
LoadPointsFromFile
(
object
):
"""Load Points From File.
...
...
@@ -13,32 +34,23 @@ class LoadPointsFromFile(object):
Args:
use_height (bool): Whether to use height.
color_mean (List[float]): Mean color of the point cloud.
load_dim (int): The dimension of the loaded points.
Default: 6.
use_dim (List[int]): Which dimensions of the points to be used.
Default: [0, 1, 2].
"""
def
__init__
(
self
,
use_height
,
color_mean
,
load_dim
=
6
,
use_dim
=
[
0
,
1
,
2
]):
def
__init__
(
self
,
use_height
,
load_dim
=
6
,
use_dim
=
[
0
,
1
,
2
]):
self
.
use_height
=
use_height
self
.
color_mean
=
color_mean
assert
max
(
use_dim
)
<
load_dim
self
.
load_dim
=
load_dim
self
.
use_dim
=
use_dim
def
__call__
(
self
,
results
):
pts_filename
=
results
.
get
(
'pts_filename'
,
None
)
info
=
results
.
get
(
'info'
,
None
)
name
=
'scannet'
if
info
.
get
(
'image'
,
None
)
is
None
else
'sunrgbd'
assert
osp
.
exists
(
pts_filename
)
if
name
==
'scannet'
:
points
=
np
.
load
(
pts_filename
)
else
:
points
=
np
.
load
(
pts_filename
)[
'pc'
]
points
=
np
.
load
(
pts_filename
)
points
=
points
.
reshape
(
-
1
,
self
.
load_dim
)
if
self
.
load_dim
>=
6
:
points
[:,
3
:
6
]
=
points
[:,
3
:
6
]
-
np
.
array
(
self
.
color_mean
)
/
256.0
points
=
points
[:,
self
.
use_dim
]
if
self
.
use_height
:
...
...
tests/data/scannet/meta_data/scannetv2.txt
deleted
100644 → 0
View file @
c4b2f80b
scene0000_00
tests/data/sunrgbd/sunrgbd_infos.pkl
deleted
100644 → 0
View file @
c4b2f80b
File deleted
tests/data/sunrgbd/sunrgbd_trainval/data_idx.txt
deleted
100644 → 0
View file @
c4b2f80b
1
tests/test_indoor_loading.py
View file @
cda6a1a3
...
...
@@ -8,21 +8,20 @@ from mmdet3d.datasets.pipelines.indoor_loading import (LoadAnnotations3D,
def
test_load_points_from_file
():
sunrgbd_info
=
mmcv
.
load
(
'./tests/data/sunrgbd/sunrgbd_infos.pkl'
)
sunrgbd_load_points_from_file
=
LoadPointsFromFile
(
True
,
[
0.5
,
0.5
,
0.5
],
6
)
sunrgbd_load_points_from_file
=
LoadPointsFromFile
(
True
,
6
)
sunrgbd_results
=
dict
()
data_path
=
'./tests/data/sunrgbd/sunrgbd_trainval'
sunrgbd_info
=
sunrgbd_info
[
0
]
scan_name
=
sunrgbd_info
[
'point_cloud'
][
'lidar_idx'
]
sunrgbd_results
[
'info'
]
=
sunrgbd_info
sunrgbd_results
[
'pts_filename'
]
=
osp
.
join
(
data_path
,
'lidar'
,
'%06d.np
z
'
%
scan_name
)
'%06d.np
y
'
%
scan_name
)
sunrgbd_results
=
sunrgbd_load_points_from_file
(
sunrgbd_results
)
sunrgbd_point_cloud
=
sunrgbd_results
.
get
(
'points'
,
None
)
assert
sunrgbd_point_cloud
.
shape
==
(
100
,
4
)
scannet_info
=
mmcv
.
load
(
'./tests/data/scannet/scannet_infos.pkl'
)
scannet_load_data
=
LoadPointsFromFile
(
True
,
[
0.5
,
0.5
,
0.5
]
)
scannet_load_data
=
LoadPointsFromFile
(
True
)
scannet_results
=
dict
()
data_path
=
'./tests/data/scannet/scannet_train_instance_data'
scannet_results
[
'data_path'
]
=
data_path
...
...
tools/data_converter/sunrgbd_data_utils.py
View file @
cda6a1a3
...
...
@@ -117,9 +117,9 @@ class SUNRGBDData(object):
# TODO : sample points in loading process and test
pc_upright_depth_subsampled
=
random_sampling
(
pc_upright_depth
,
SAMPLE_NUM
)
np
.
save
z_compressed
(
os
.
path
.
join
(
self
.
root_dir
,
'lidar'
,
'%06d.np
z
'
%
sample_idx
),
pc
=
pc_upright_depth_subsampled
)
np
.
save
(
os
.
path
.
join
(
self
.
root_dir
,
'lidar'
,
'%06d.np
y
'
%
sample_idx
),
pc_upright_depth_subsampled
)
info
=
dict
()
pc_info
=
{
'num_features'
:
6
,
'lidar_idx'
:
sample_idx
}
...
...
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