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
733df015
"vscode:/vscode.git/clone" did not exist on "c8059b4dcfad84ef85876d941a4e3d95bf5eb595"
Unverified
Commit
733df015
authored
Oct 07, 2020
by
twang
Committed by
GitHub
Oct 07, 2020
Browse files
Fix init in cam_box3d (wrong default box origin) (#148)
parent
edebb3e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
mmdet3d/core/bbox/structures/cam_box3d.py
mmdet3d/core/bbox/structures/cam_box3d.py
+35
-0
No files found.
mmdet3d/core/bbox/structures/cam_box3d.py
View file @
733df015
...
@@ -34,6 +34,41 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
...
@@ -34,6 +34,41 @@ class CameraInstance3DBoxes(BaseInstance3DBoxes):
boxes.
boxes.
"""
"""
def
__init__
(
self
,
tensor
,
box_dim
=
7
,
with_yaw
=
True
,
origin
=
(
0.5
,
1.0
,
0.5
)):
if
isinstance
(
tensor
,
torch
.
Tensor
):
device
=
tensor
.
device
else
:
device
=
torch
.
device
(
'cpu'
)
tensor
=
torch
.
as_tensor
(
tensor
,
dtype
=
torch
.
float32
,
device
=
device
)
if
tensor
.
numel
()
==
0
:
# Use reshape, so we don't end up creating a new tensor that
# does not depend on the inputs (and consequently confuses jit)
tensor
=
tensor
.
reshape
((
0
,
box_dim
)).
to
(
dtype
=
torch
.
float32
,
device
=
device
)
assert
tensor
.
dim
()
==
2
and
tensor
.
size
(
-
1
)
==
box_dim
,
tensor
.
size
()
if
tensor
.
shape
[
-
1
]
==
6
:
# If the dimension of boxes is 6, we expand box_dim by padding
# 0 as a fake yaw and set with_yaw to False.
assert
box_dim
==
6
fake_rot
=
tensor
.
new_zeros
(
tensor
.
shape
[
0
],
1
)
tensor
=
torch
.
cat
((
tensor
,
fake_rot
),
dim
=-
1
)
self
.
box_dim
=
box_dim
+
1
self
.
with_yaw
=
False
else
:
self
.
box_dim
=
box_dim
self
.
with_yaw
=
with_yaw
self
.
tensor
=
tensor
if
origin
!=
(
0.5
,
1.0
,
0.5
):
dst
=
self
.
tensor
.
new_tensor
((
0.5
,
1.0
,
0.5
))
src
=
self
.
tensor
.
new_tensor
(
origin
)
self
.
tensor
[:,
:
3
]
+=
self
.
tensor
[:,
3
:
6
]
*
(
dst
-
src
)
@
property
@
property
def
height
(
self
):
def
height
(
self
):
"""torch.Tensor: A vector with height of each box."""
"""torch.Tensor: A vector with height of each box."""
...
...
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