Commit aeb342b7 authored by liyinhao's avatar liyinhao
Browse files

change to fstring

parent 4fc020f6
...@@ -47,10 +47,9 @@ class IndoorLoadPointsFromFile(object): ...@@ -47,10 +47,9 @@ class IndoorLoadPointsFromFile(object):
def __init__(self, use_height, load_dim=6, use_dim=[0, 1, 2]): def __init__(self, use_height, load_dim=6, use_dim=[0, 1, 2]):
self.use_height = use_height self.use_height = use_height
assert max( assert max(use_dim) < load_dim, \
use_dim f'Expect all used dimensions < {load_dim}, got {use_dim}'
) < load_dim, f'Expect all used dimensions < {load_dim}, ' \
f'got {use_dim}'
self.load_dim = load_dim self.load_dim = load_dim
self.use_dim = use_dim self.use_dim = use_dim
......
...@@ -15,7 +15,7 @@ def test_indoor_load_points_from_file(): ...@@ -15,7 +15,7 @@ def test_indoor_load_points_from_file():
sunrgbd_info = sunrgbd_info[0] sunrgbd_info = sunrgbd_info[0]
scan_name = sunrgbd_info['point_cloud']['lidar_idx'] scan_name = sunrgbd_info['point_cloud']['lidar_idx']
sunrgbd_results['pts_filename'] = osp.join(data_path, 'lidar', sunrgbd_results['pts_filename'] = osp.join(data_path, 'lidar',
'%06d.npy' % scan_name) f'{scan_name:06d}.npy')
sunrgbd_results = sunrgbd_load_points_from_file(sunrgbd_results) sunrgbd_results = sunrgbd_load_points_from_file(sunrgbd_results)
sunrgbd_point_cloud = sunrgbd_results['points'] sunrgbd_point_cloud = sunrgbd_results['points']
assert sunrgbd_point_cloud.shape == (100, 4) assert sunrgbd_point_cloud.shape == (100, 4)
...@@ -29,7 +29,7 @@ def test_indoor_load_points_from_file(): ...@@ -29,7 +29,7 @@ def test_indoor_load_points_from_file():
scan_name = scannet_info['point_cloud']['lidar_idx'] scan_name = scannet_info['point_cloud']['lidar_idx']
scannet_results['pts_filename'] = osp.join(data_path, scannet_results['pts_filename'] = osp.join(data_path,
scan_name + '_vert.npy') f'{scan_name}_vert.npy')
scannet_results = scannet_load_data(scannet_results) scannet_results = scannet_load_data(scannet_results)
scannet_point_cloud = scannet_results['points'] scannet_point_cloud = scannet_results['points']
assert scannet_point_cloud.shape == (100, 4) assert scannet_point_cloud.shape == (100, 4)
...@@ -63,7 +63,7 @@ def test_load_annotations3D(): ...@@ -63,7 +63,7 @@ def test_load_annotations3D():
scannet_gt_bboxes_3d_mask = np.zeros((1, 1)) scannet_gt_bboxes_3d_mask = np.zeros((1, 1))
scan_name = scannet_info['point_cloud']['lidar_idx'] scan_name = scannet_info['point_cloud']['lidar_idx']
scannet_results['pts_instance_mask_path'] = osp.join( scannet_results['pts_instance_mask_path'] = osp.join(
data_path, scan_name + '_ins_label.npy') data_path, f'{scan_name}_ins_label.npy')
scannet_results['pts_semantic_mask_path'] = osp.join( scannet_results['pts_semantic_mask_path'] = osp.join(
data_path, scan_name + '_sem_label.npy') data_path, scan_name + '_sem_label.npy')
scannet_results['info'] = scannet_info scannet_results['info'] = scannet_info
......
...@@ -147,7 +147,7 @@ class SUNRGBDData(object): ...@@ -147,7 +147,7 @@ class SUNRGBDData(object):
pc_upright_depth_subsampled = random_sampling( pc_upright_depth_subsampled = random_sampling(
pc_upright_depth, SAMPLE_NUM) pc_upright_depth, SAMPLE_NUM)
np.save( np.save(
os.path.join(self.root_dir, 'lidar', '%06d.npy' % sample_idx), os.path.join(self.root_dir, 'lidar', f'{sample_idx:06d}.npy'),
pc_upright_depth_subsampled) pc_upright_depth_subsampled)
info = dict() info = dict()
......
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