IA-SSD icon indicating copy to clipboard operation
IA-SSD copied to clipboard

How to visualize the sampling point cloud

Open andy690 opened this issue 3 years ago • 1 comments

I find that in the end of IA-SSD backbone.py, there are following codes if self.model_cfg.SA_CONFIG.get('SAVE_SAMPLE_LIST',False) and not self.training:
import numpy as np

        result_dir = np.load('/home/qian/tmp.npy', allow_pickle=True)
        for i in range(batch_size)  :
            # i=0      
            # point_saved_path = '/home/yifan/tmp'
            point_saved_path = result_dir / 'sample_list_save'
            os.makedirs(point_saved_path, exist_ok=True)
            idx = batch_dict['frame_id'][i]
            xyz_list = []
            for sa_xyz in encoder_xyz:
                xyz_list.append(sa_xyz[i].cpu().numpy()) 
            if '/' in idx: # Kitti_tracking
                sample_xyz = point_saved_path / idx.split('/')[0] / ('sample_list_' + ('%s' % idx.split('/')[1]))

                os.makedirs(point_saved_path / idx.split('/')[0], exist_ok=True)

            else:
                sample_xyz = point_saved_path / ('sample_list_' + ('%s' % idx))

            np.save(str(sample_xyz), xyz_list)
            # np.save(str(new_file), point_new.detach().cpu().numpy())

I think it is something about sampling points, so the tmp.npy is a np file? Should I build an empty tmp.npy ? How can i use this for the sampling points for visualization? Looking forward to your reply.

andy690 avatar Apr 25 '22 15:04 andy690

Yes, the code segment here is used to verify the sampling effect, and the tmp.npy is just a record file for output path info.

You can just give it a valid address in your own style,or if you want to make it effective, please add code segment follows in def eval_one_epoch(cfg, model, dataloader, epoch_id, logger, dist_test=False, save_to_file=False, result_dir=None):

np.save('/home/yifan/tmp', result_dir)

Best wishes!

yifanzhang713 avatar Apr 30 '22 18:04 yifanzhang713