@@ -556,12 +556,18 @@ def after_test_iter(self, runner: Runner, batch_idx: int, data_batch: dict,
556
556
for data_sample in outputs :
557
557
self ._test_index += 1
558
558
data_sample = data_sample .cpu ()
559
-
559
+ print ( "data_sample:" , data_sample )
560
560
rgb_path = str (data_sample .img_path ).strip ()
561
- depth_path = str (data_sample .metainfo .get ('depth_path' , '' )).strip ()
562
- lidar_path = str (data_sample .metainfo .get ('lidar_path' , '' )).strip ()
563
- thermal_path = str (data_sample .metainfo .get ('thermal_path' , '' )).strip ()
561
+ depth_path = str (data_sample .metainfo .get ('depth_path' ) or
562
+ data_sample .metainfo .get ('modality_paths' , {}).get ('depth' , '' )).strip ()
563
+
564
+ lidar_path = str (data_sample .metainfo .get ('lidar_path' ) or
565
+ data_sample .metainfo .get ('modality_paths' , {}).get ('lidar' , '' )).strip ()
566
+
567
+ thermal_path = str (data_sample .metainfo .get ('thermal_path' ) or
568
+ data_sample .metainfo .get ('modality_paths' , {}).get ('event' , '' )).strip ()
564
569
570
+ print (rgb_path , depth_path , lidar_path , thermal_path )
565
571
img_rgb = self ._load_image (rgb_path )
566
572
h , w , _ = img_rgb .shape
567
573
@@ -627,7 +633,10 @@ def draw_split(img, modality_shape):
627
633
pred_scaled = scale_bboxes (pred_bboxes , modality_shape , (h , w ))
628
634
if pred_scaled is not None and pred_labels is not None :
629
635
self ._visualizer .draw_bboxes (pred_scaled , edge_colors = 'red' , alpha = 0.8 )
630
- label_texts = [classes [l ] for l in pred_labels ]
636
+ label_texts = [
637
+ f"{ classes [l ]} { round (s .item (), 2 )} "
638
+ for l , s in zip (pred_labels , pred_scores [keep ])
639
+ ]
631
640
self ._visualizer .draw_texts (
632
641
label_texts ,
633
642
pred_scaled [:, :2 ].int ().numpy (),
@@ -639,6 +648,7 @@ def draw_split(img, modality_shape):
639
648
'pad' : 0.7 ,
640
649
'edgecolor' : 'none'
641
650
}] * len (pred_scaled ))
651
+
642
652
img_pred = self ._visualizer .get_image ()
643
653
644
654
return np .concatenate ([img_gt , img_pred ], axis = 1 )
@@ -653,7 +663,13 @@ def draw_split(img, modality_shape):
653
663
654
664
out_file = None
655
665
if self .test_out_dir is not None :
656
- out_file = osp .join (self .test_out_dir , f"{ self ._test_index :06d} .jpg" )
666
+ basename = osp .basename (rgb_path )
667
+ basename = (basename
668
+ .replace ('_rgb_' , '_' )
669
+ .replace ('_depth_' , '_' )
670
+ .replace ('_event_' , '_' )
671
+ .replace ('_lidar_' , '_' ))
672
+ out_file = osp .join (self .test_out_dir , basename )
657
673
if self .show :
658
674
self ._visualizer .show (final_vis , win_name = 'multi_modal_split' , wait_time = self .wait_time )
659
675
if out_file is not None :
0 commit comments