Unverified Commit 50870e4c authored by HyeongSeok Kim's avatar HyeongSeok Kim Committed by GitHub
Browse files

[Fix] fix local_visualizer.py: only visualize when there is at least one instance (#2231)



* fix local_visualizer.py: modify add_datasample

 - fix "AttributeError: ‘InstanceData’ object has no attribute ‘bboxes_3d’" error

* Update mmdet3d/visualization/local_visualizer.py
Co-authored-by: default avatarXiang Xu <xuxiang0103@gmail.com>

* fix local_visualizer.py: modify add_datasample

 - add exception handling when there is no instance inside pred_instances_3d

* modify local_visualizer.py: Apply changes from pre-commit

* modify local_visualizer.py: Change exception handling location for empty instance

 - Add exception handling when instances are empty
 - Delete the exception handling previously added to add_datasample

* modify local_visualizer.py: apply pre-commit

---------
Co-authored-by: default avatarXiang Xu <xuxiang0103@gmail.com>
parent 1587d48f
......@@ -557,6 +557,10 @@ class Det3DLocalVisualizer(DetLocalVisualizer):
dict: the drawn point cloud and image which channel is RGB.
"""
# Only visualize when there is at least one instance
if not len(instances) > 0:
return None
bboxes_3d = instances.bboxes_3d # BaseInstance3DBoxes
data_3d = dict()
......@@ -786,6 +790,8 @@ class Det3DLocalVisualizer(DetLocalVisualizer):
drawn_img_3d = gt_data_3d['img']
elif pred_data_3d is not None:
drawn_img_3d = pred_data_3d['img']
else: # both instances of gt and pred are empty
drawn_img_3d = None
else:
drawn_img_3d = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment