SpatialLM
SpatialLM copied to clipboard
Bug in code that calculates layout F1 score
There seems to be a bug in the layout evaluation code. Specifically, the distance check in the method are_planes_parallel_and_close incorrectly classifies planes that are far apart as "close". It is missing an absolute value around the dot product:
return (
np.linalg.norm(np.cross(n1, n2)) / (n1_length * n2_length) < parallel_tolerance
- and np.dot(np.subtract(q1, p1), n1) / n1_length < dist_tolerance
+ and np.abs(np.dot(np.subtract(q1, p1), n1)) / n1_length < dist_tolerance
)
This causes predicted layout elements to be wrongly matched against the ground truth and results in overly optimistic F1 scores.
Thank you for spotting the bug, and sorry for the careless mistake. If you have the time to submit a small PR, we'd be very happy to review and merge it.