kcml commited on
Commit
e5c2be2
·
1 Parent(s): 6fe8053

retire prune_tall_short; investigating the long process time of clelan_pcd

Browse files
Files changed (1) hide show
  1. handcrafted_solution.py +7 -6
handcrafted_solution.py CHANGED
@@ -252,7 +252,7 @@ def get_smooth_uv_depth(vertices, depth, gest_seg_np, sfm_depth_np, r=5):
252
  vertex_depth = np.array(vertex_depth)
253
  return uv, vertex_depth
254
 
255
- '''
256
  from numba import njit, prange
257
  @njit(parallel=True)
258
  def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
@@ -266,7 +266,7 @@ def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
266
  if DUMP_IMG:
267
  sfm_color_np[j, i] = c
268
  return sfm_depth_np, sfm_color_np
269
- '''
270
 
271
  def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
272
  '''Project 3D sfm pointcloud to the image plane '''
@@ -295,7 +295,7 @@ def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
295
  #checked = 0
296
  #print('dim of us uv zs rgb:', len(us), len(vs), len(zs), len(rgb))
297
  for u,v,z,c in zip(us,vs,zs, rgb):
298
- '''
299
  sfm_depth_np, sfm_color_np = fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W)
300
  '''
301
  i_range = range(max(0, u - dilate_r), min(W, u + dilate_r))
@@ -309,7 +309,7 @@ def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
309
  sfm_depth_np[j, i] = z
310
  if DUMP_IMG:
311
  sfm_color_np[j, i] = c
312
-
313
 
314
 
315
  #print(f'checked {checked} pts')
@@ -784,7 +784,8 @@ def clean_PCD(XYZ, rgb):
784
  largest_blob_size = 0
785
  largest_blob = 0
786
  lowest_z = 0
787
- if len(unique_labels) > 100:
 
788
  return XYZ, rgb, lowest_z
789
 
790
  for k in unique_labels:
@@ -885,7 +886,7 @@ def predict(entry, visualize=False, prune_dist_thr=600, depth_scale=2.5, ) -> Tu
885
  #print(f'after merge, {len(all_3d_vertices)} 3d vertices and {len(connections_3d)} 3d connections')
886
  #print(f'after merge, 3d vertices: {all_3d_vertices} and 3d connections: {connections_3d}')
887
  #all_3d_vertices_clean, connections_3d_clean = prune_not_connected(all_3d_vertices, connections_3d)
888
- all_3d_vertices, connections_3d = prune_tall_short(all_3d_vertices, connections_3d, lowest_z, 1000, 0)
889
 
890
 
891
  if len(all_3d_vertices)>35:
 
252
  vertex_depth = np.array(vertex_depth)
253
  return uv, vertex_depth
254
 
255
+
256
  from numba import njit, prange
257
  @njit(parallel=True)
258
  def fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W):
 
266
  if DUMP_IMG:
267
  sfm_color_np[j, i] = c
268
  return sfm_depth_np, sfm_color_np
269
+ ''''''
270
 
271
  def get_SfM_depth(XYZ, rgb, depth_np, gest_seg_np, K, R, t, dilate_r = 5):
272
  '''Project 3D sfm pointcloud to the image plane '''
 
295
  #checked = 0
296
  #print('dim of us uv zs rgb:', len(us), len(vs), len(zs), len(rgb))
297
  for u,v,z,c in zip(us,vs,zs, rgb):
298
+
299
  sfm_depth_np, sfm_color_np = fill_range(u, v, z, dilate_r, c, sfm_depth_np, sfm_color_np, H, W)
300
  '''
301
  i_range = range(max(0, u - dilate_r), min(W, u + dilate_r))
 
309
  sfm_depth_np[j, i] = z
310
  if DUMP_IMG:
311
  sfm_color_np[j, i] = c
312
+ '''
313
 
314
 
315
  #print(f'checked {checked} pts')
 
784
  largest_blob_size = 0
785
  largest_blob = 0
786
  lowest_z = 0
787
+ print('uni label:', len(unique_labels))
788
+ if len(unique_labels) > 30:
789
  return XYZ, rgb, lowest_z
790
 
791
  for k in unique_labels:
 
886
  #print(f'after merge, {len(all_3d_vertices)} 3d vertices and {len(connections_3d)} 3d connections')
887
  #print(f'after merge, 3d vertices: {all_3d_vertices} and 3d connections: {connections_3d}')
888
  #all_3d_vertices_clean, connections_3d_clean = prune_not_connected(all_3d_vertices, connections_3d)
889
+ #all_3d_vertices, connections_3d = prune_tall_short(all_3d_vertices, connections_3d, lowest_z, 1000, 0)
890
 
891
 
892
  if len(all_3d_vertices)>35: