bulkobubulko commited on
Commit
61a1f0e
·
1 Parent(s): 3479a24
README.md CHANGED
@@ -1,4 +1,6 @@
1
  # Handcrafted Submission 2025-1
2
 
3
- This repo contains a submission to the [S23DR Challenge](https://huggingface.co/spaces/usm3d/S23DR) (part of the [USM3D](https://usm3d.github.io/) workshop at CVPR2025). It was prepared by [bulkobubulko](https://huggingface.co/bulkobubulko).
 
 
4
 
 
1
  # Handcrafted Submission 2025-1
2
 
3
+ This repo contains a submission to the [S23DR Challenge](https://huggingface.co/spaces/usm3d/S23DR2025) (part of the [USM3D](https://usm3d.github.io/) workshop at CVPR2025). It was prepared by [bulkobubulko](https://huggingface.co/bulkobubulko).
4
+
5
+
6
 
submission.parquet ADDED
Binary file (18.6 kB). View file
 
tools2025/hoho2025/example_solutions.py CHANGED
@@ -27,6 +27,7 @@ def read_colmap_rec(colmap_data):
27
  rec = pycolmap.Reconstruction(tmpdir)
28
  return rec
29
 
 
30
  def convert_entry_to_human_readable(entry):
31
  out = {}
32
  for k, v in entry.items():
@@ -76,7 +77,6 @@ def point_to_segment_dist(pt, seg_p1, seg_p2):
76
  return np.linalg.norm(pt - proj)
77
 
78
 
79
-
80
  def get_vertices_and_edges_from_segmentation(gest_seg_np, edge_th=25.0):
81
  """
82
  Identify apex and eave-end vertices, then detect lines for eave/ridge/rake/valley.
@@ -118,7 +118,6 @@ def get_vertices_and_edges_from_segmentation(gest_seg_np, edge_th=25.0):
118
  vert = {"xy": centroids[i], "type": "eave_end_point"}
119
  vertices.append(vert)
120
 
121
- # imrpoves
122
  flashing_end_color = np.array(gestalt_color_mapping['flashing_end_point'])
123
  flashing_end_mask = cv2.inRange(gest_seg_np, flashing_end_color - 0.5, flashing_end_color + 0.5)
124
  if flashing_end_mask.sum() > 0:
@@ -145,12 +144,11 @@ def get_vertices_and_edges_from_segmentation(gest_seg_np, edge_th=25.0):
145
  'ridge',
146
  'rake',
147
  'valley',
148
- ### improves
149
  'flashing',
150
  'hip',
151
  'step_flashing',
152
  'transition_line',
153
- ###
154
  # 'cornice_return' # breaks
155
  # 'cornice_strip' # breaks
156
  ]
@@ -307,7 +305,6 @@ def get_uv_depth(vertices: List[dict],
307
  return uv, vertex_depth
308
 
309
 
310
-
311
  def project_vertices_to_3d(uv: np.ndarray, depth_vert: np.ndarray, col_img: pycolmap.Image) -> np.ndarray:
312
  """
313
  Projects 2D vertex coordinates with associated depths to 3D world coordinates.
@@ -564,6 +561,7 @@ def prune_not_connected(all_3d_vertices, connections_3d, keep_largest=True):
564
  new_conns = list(set([tuple(sorted(c)) for c in new_conns]))
565
  return new_vertices, new_conns
566
 
 
567
  def get_sparse_depth(colmap_rec, img_id_substring, depth):
568
  """
569
  Return a sparse depth map for the COLMAP image whose name contains
@@ -788,7 +786,7 @@ def predict_wireframe(entry) -> Tuple[np.ndarray, List[int]]:
788
  "p2d_uv_search_radius": 15,
789
  # 3D Merging & Pruning
790
  "p3d_merge_th": 0.4, # default=0.5, 0.4*, tighten the 3D merge radius
791
- "p3d_prune_far_th": 1.0, # default=4.0, 3.0*
792
  "p3d_keep_largest_component": False,
793
  # Edge Validation
794
  "edge_val_p1_num_samples": 3,
@@ -810,7 +808,7 @@ def predict_wireframe(entry) -> Tuple[np.ndarray, List[int]]:
810
 
811
  for gest, depth, K, R, t, img_id, ade_seg in zip(
812
  good_entry['gestalt'], good_entry['depth'], good_entry['K'], good_entry['R'],
813
- good_entry['t'], good_entry['image_ids'], good_entry['ade']
814
  ):
815
  depth_size = (np.array(depth).shape[1], np.array(depth).shape[0])
816
  gest_seg = gest.resize(depth_size)
 
27
  rec = pycolmap.Reconstruction(tmpdir)
28
  return rec
29
 
30
+
31
  def convert_entry_to_human_readable(entry):
32
  out = {}
33
  for k, v in entry.items():
 
77
  return np.linalg.norm(pt - proj)
78
 
79
 
 
80
  def get_vertices_and_edges_from_segmentation(gest_seg_np, edge_th=25.0):
81
  """
82
  Identify apex and eave-end vertices, then detect lines for eave/ridge/rake/valley.
 
118
  vert = {"xy": centroids[i], "type": "eave_end_point"}
119
  vertices.append(vert)
120
 
 
121
  flashing_end_color = np.array(gestalt_color_mapping['flashing_end_point'])
122
  flashing_end_mask = cv2.inRange(gest_seg_np, flashing_end_color - 0.5, flashing_end_color + 0.5)
123
  if flashing_end_mask.sum() > 0:
 
144
  'ridge',
145
  'rake',
146
  'valley',
147
+ ###
148
  'flashing',
149
  'hip',
150
  'step_flashing',
151
  'transition_line',
 
152
  # 'cornice_return' # breaks
153
  # 'cornice_strip' # breaks
154
  ]
 
305
  return uv, vertex_depth
306
 
307
 
 
308
  def project_vertices_to_3d(uv: np.ndarray, depth_vert: np.ndarray, col_img: pycolmap.Image) -> np.ndarray:
309
  """
310
  Projects 2D vertex coordinates with associated depths to 3D world coordinates.
 
561
  new_conns = list(set([tuple(sorted(c)) for c in new_conns]))
562
  return new_vertices, new_conns
563
 
564
+
565
  def get_sparse_depth(colmap_rec, img_id_substring, depth):
566
  """
567
  Return a sparse depth map for the COLMAP image whose name contains
 
786
  "p2d_uv_search_radius": 15,
787
  # 3D Merging & Pruning
788
  "p3d_merge_th": 0.4, # default=0.5, 0.4*, tighten the 3D merge radius
789
+ "p3d_prune_far_th": 3.0, # default=4.0, 3.0*
790
  "p3d_keep_largest_component": False,
791
  # Edge Validation
792
  "edge_val_p1_num_samples": 3,
 
808
 
809
  for gest, depth, K, R, t, img_id, ade_seg in zip(
810
  good_entry['gestalt'], good_entry['depth'], good_entry['K'], good_entry['R'],
811
+ good_entry['t'], good_entry['image_ids'], good_entry['ad e']
812
  ):
813
  depth_size = (np.array(depth).shape[1], np.array(depth).shape[0])
814
  gest_seg = gest.resize(depth_size)
write-up.pdf ADDED
Binary file (90.9 kB). View file