SpatialLM icon indicating copy to clipboard operation
SpatialLM copied to clipboard

Eval failed

Open whu-pzhang opened this issue 1 year ago • 2 comments

following the evaluation step: https://github.com/manycore-research/SpatialLM?tab=readme-ov-file#evaluation

python eval.py --metadata SpatialLM-Testset/test.csv --gt_dir SpatialLM-Testset/layout --pred_dir SpatialLM-Testset/pred --label_mapping SpatialLM-Testset/benchmark_categories.tsv

After inference done, the eval.py failed with following info:

Traceback (most recent call last):
  File "/home/pzhang/repos/llm/SpatialLM/eval.py", line 433, in <module>
    calc_layout_tp(
  File "/home/pzhang/repos/llm/SpatialLM/eval.py", line 339, in calc_layout_tp
    [
  File "/home/pzhang/repos/llm/SpatialLM/eval.py", line 340, in <listcomp>
    calc_thin_bbox_iou_2d(
  File "/home/pzhang/repos/llm/SpatialLM/eval.py", line 292, in calc_thin_bbox_iou_2d
    if are_planes_parallel_and_close(
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pzhang/repos/llm/SpatialLM/eval.py", line 277, in are_planes_parallel_and_close
    n1_length * n2_length > ZERO_TOLERANCE
AssertionError: Invalid plane corners, corners_1: [[-0.01468042 -0.7744153  -0.02371482]
 [-0.01468042 -0.7744153  -0.02371482]
 [-0.01468042 -0.7744153   2.27628518]
 [-0.01468042 -0.7744153   2.27628518]], corners_2: [[ 8.11968068e-03 -7.43863114e-01 -4.73248960e-08]
 [ 7.37224130e-01 -7.43863114e-01 -4.73248960e-08]
 [ 7.37224130e-01 -7.43863114e-01  2.30000005e+00]
 [ 8.11968068e-03 -7.43863114e-01  2.30000005e+00]]

whu-pzhang avatar Jul 18 '25 07:07 whu-pzhang

Most likely happening because your p1, p2 are the same in the are_planes_parallel_and_close function. In my case, its happening only for 1 example, so I just removed the assert statement https://github.com/manycore-research/SpatialLM/blob/13230c957525316d4488ac7000409c05f8d9971c/eval.py#L276 and replaced it with the following --

if not (n1_length * n2_length > ZERO_TOLERANCE):
   print("Invalid plane corners, corners_1: ", corners_1, "corners_2: ", corners_2)
   return False

chinmay0301ucsd avatar Jul 19 '25 00:07 chinmay0301ucsd

Most likely happening because your p1, p2 are the same in the are_planes_parallel_and_close function. In my case, its happening only for 1 example, so I just removed the assert statement

SpatialLM/eval.py

Line 276 in 13230c9

assert ( and replaced it with the following --

if not (n1_length * n2_length > ZERO_TOLERANCE):
   print("Invalid plane corners, corners_1: ", corners_1, "corners_2: ", corners_2)
   return False

Thanks for your reply! After rerunning the inference code, the assertion error disappeared.😊

whu-pzhang avatar Jul 20 '25 23:07 whu-pzhang