Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
one
spconv
Commits
023510cf
"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "d648613ba6b9fa434e4524a0bbb75c3201d27cae"
Commit
023510cf
authored
Oct 26, 2021
by
yan.yan
Browse files
update voxel generator example
parent
324235d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
example/voxel_gen.py
example/voxel_gen.py
+11
-0
No files found.
example/voxel_gen.py
View file @
023510cf
...
@@ -19,6 +19,7 @@ from spconv.utils import Point2VoxelCPU3d
...
@@ -19,6 +19,7 @@ from spconv.utils import Point2VoxelCPU3d
def
main
():
def
main
():
# voxel gen source code: spconv/csrc/sparse/pointops.py
gen
=
Point2VoxelCPU3d
(
gen
=
Point2VoxelCPU3d
(
vsize_xyz
=
[
0.1
,
0.1
,
0.1
],
vsize_xyz
=
[
0.1
,
0.1
,
0.1
],
coors_range_xyz
=
[
-
80
,
-
80
,
-
2
,
80
,
80
,
6
],
coors_range_xyz
=
[
-
80
,
-
80
,
-
2
,
80
,
80
,
6
],
...
@@ -31,8 +32,18 @@ def main():
...
@@ -31,8 +32,18 @@ def main():
# generate voxels, note that voxels_tv reference to a persistent buffer in generator,
# generate voxels, note that voxels_tv reference to a persistent buffer in generator,
# so we can't run it in multi-thread.
# so we can't run it in multi-thread.
voxels_tv
,
indices_tv
,
num_p_in_vx_tv
=
gen
.
point_to_voxel
(
pc_tv
)
voxels_tv
,
indices_tv
,
num_p_in_vx_tv
=
gen
.
point_to_voxel
(
pc_tv
)
voxels_np
=
voxels_tv
.
numpy_view
()
indices_np
=
indices_tv
.
numpy_view
()
num_p_in_vx_np
=
num_p_in_vx_tv
.
numpy_view
()
print
(
"------Raw Voxels-------"
)
print
(
voxels_np
[
0
])
# run voxel gen and FILL MEAN VALUE to voxel remain
# run voxel gen and FILL MEAN VALUE to voxel remain
voxels_tv
,
indices_tv
,
num_p_in_vx_tv
=
gen
.
point_to_voxel_empty_mean
(
pc_tv
)
voxels_tv
,
indices_tv
,
num_p_in_vx_tv
=
gen
.
point_to_voxel_empty_mean
(
pc_tv
)
voxels_np
=
voxels_tv
.
numpy_view
()
indices_np
=
indices_tv
.
numpy_view
()
num_p_in_vx_np
=
num_p_in_vx_tv
.
numpy_view
()
print
(
"------Voxels with mean filled-------"
)
print
(
voxels_np
[
0
])
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
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