{"id":1008,"date":"2024-08-09T18:15:10","date_gmt":"2024-08-09T18:15:10","guid":{"rendered":"https:\/\/summergeometry.org\/sgi2024\/?p=1008"},"modified":"2024-08-09T18:15:11","modified_gmt":"2024-08-09T18:15:11","slug":"a-study-on-surface-reconstruction-from-signed-distance-data-part-2-error-methods","status":"publish","type":"post","link":"https:\/\/summergeometry.org\/sgi2024\/a-study-on-surface-reconstruction-from-signed-distance-data-part-2-error-methods\/","title":{"rendered":"A Study on Surface Reconstruction from Signed Distance Data Part 2: Error Methods"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Primary mentors<\/strong>:\u00a0 Silvia Sell\u00e1n, University of Toronto and Oded Stein, University of Southern California<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Volunteer assistant<\/strong>:\u00a0 Andrew Rodriguez<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fellows<\/strong>: Johan Azambou, Megan Grosse, Eleanor Wiesler, Anthony Hong, Artur RB Boyago, Sara\u00a0Samy<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"706\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-12.30.40\u202fAM-1.png\" alt=\"\" class=\"wp-image-1165\" style=\"width:439px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-12.30.40\u202fAM-1.png 700w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-12.30.40\u202fAM-1-297x300.png 297w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-07-at-12.30.40\u202fAM-1-150x150.png 150w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">After talking about what are some of the ways to reconstruct sdfs (see <a href=\"https:\/\/summergeometry.org\/sgi2024\/a-study-on-surface-reconstruction-from-signed-distance-data-part-1\/\" data-type=\"link\" data-id=\"https:\/\/summergeometry.org\/sgi2024\/a-study-on-surface-reconstruction-from-signed-distance-data-part-1\/\">part one<\/a>), we now study the question of how to evaluate their performance. Two classes of error function are considered, the first more inherent to our sdf context, and the second more general in all situations. We will first show results by our old friends, Chamfer distance, Hausdorff distance, and area method (see <a href=\"https:\/\/summergeometry.org\/sgi2024\/how-to-match-the-wiggliness-of-two-shapes\/\" data-type=\"link\" data-id=\"https:\/\/summergeometry.org\/sgi2024\/how-to-match-the-wiggliness-of-two-shapes\/\">here<\/a> for example), and then introduce the inherent one.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hausdorff and Chamfer Distance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>Chamfer distance<\/strong> provides an average-case measure of the dissimilarity between two shapes. It calculates the sum of the distances from each point in one set to the nearest point in the other set. This measure is particularly useful when the goal is to capture the overall discrepancy between two shapes while being less sensitive to outliers. The Chamfer distance is defined as:<br>$$<br>d_{\\mathrm{Chamfer }}(X, Y):=\\sum_{x \\in X} d(x, Y)=\\sum_{x \\in X} \\inf _{y \\in Y} d(x, y)<br>$$<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"855\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.11.23\u202fAM.png\" alt=\"\" class=\"wp-image-1177\" style=\"width:628px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.11.23\u202fAM.png 850w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.11.23\u202fAM-298x300.png 298w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.11.23\u202fAM-150x150.png 150w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.11.23\u202fAM-768x773.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The <strong>Bi-Chamfer distance<\/strong> is an extension that considers the average of the Chamfer distance computed in both directions (from \\(X\\) to \\(Y\\) and from \\(Y\\) to \\(X\\) ). This bidirectional measure provides a more balanced assessment of the dissimilarity between the shapes:<br>$$<br>d_{\\mathrm{B} \\mathrm{-Chamfer }}(X, Y):=\\frac{1}{2}\\left(\\sum_{x \\in X} \\inf {y \\in Y} d(x, y)+\\sum{y \\in Y} \\inf _{x \\in X} d(x, y)\\right)<br>$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>Hausdorff distance<\/strong>, on the other hand, measures the worst-case scenario between two shapes. It is defined as the maximum distance from a point in one set to the closest point in the other set. This distance is particularly stringent because it reflects the largest deviation between the shapes, making it highly sensitive to outliers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The formula for Hausdorff distance is:<br>$$<br>d_{\\mathrm{H}}^Z(X, Y):=\\max \\left(\\sup {x \\in X} d_Z(x, Y), \\sup {y \\in Y} d_Z(y, X)\\right)<br>$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We analyze the Hausdorff distance for the uneven capsule (the shape on the right; exact sdf taken from <a href=\"https:\/\/www.shadertoy.com\/view\/4lcBWn\" data-type=\"link\" data-id=\"https:\/\/www.shadertoy.com\/view\/4lcBWn\">there<\/a>) in particular.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"534\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM-1024x534.png\" alt=\"\" class=\"wp-image-1174\" style=\"width:723px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM-1024x534.png 1024w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM-300x156.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM-768x400.png 768w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM-1200x626.png 1200w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.09.44\u202fAM.png 1421w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This plot visually compares the original zero level set (ground truth) with the reconstructed polyline generated by the marching squares algorithm at a specific resolution. The black dots represent the vertices of the polyline, showing how closely the reconstruction matches the ground truth, demonstrating the efficacy of the algorithm at capturing the shape&#8217;s essential features.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"599\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM-1024x599.png\" alt=\"\" class=\"wp-image-1176\" style=\"width:737px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM-1024x599.png 1024w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM-300x175.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM-768x449.png 768w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM-1200x702.png 1200w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.10.16\u202fAM.png 1421w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">This plot shows the relationship between the Hausdorff distance and the resolution of the reconstruction. As resolution increases, the Hausdorff distance decreases, illustrating that higher resolutions produce more accurate reconstructions. The log-log plot with a linear fit suggests a strong inverse relationship, with the slope indicating a nearly quadratic decrease in Hausdorff distance as resolution improves.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Area Method for Error<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Another error method we explored in this project is an area-based method. To start this process, we can overlay the original polyline and the generated polyline. Then, we can determine the area between the two, counting all regions as positive area. Essentially, this means that if we take values inside a polyline to be negative and outside a polyline to be positive, the area counted as error consists of the set of all regions where the sign of the original polyline\u2019s SDF is not equal to the sign of the generated polyline\u2019s SDF. The resultant area corresponds to the error of the reconstruction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a simple example of this area method using two quadrilaterals. The area between them is represented by their union (all blue area) with their intersection (the darker blue triangle) removed:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"810\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-12.56.35\u202fAM-1024x810.png\" alt=\"\" class=\"wp-image-1159\" style=\"width:431px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-12.56.35\u202fAM-1024x810.png 1024w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-12.56.35\u202fAM-300x237.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-12.56.35\u202fAM-768x607.png 768w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-12.56.35\u202fAM.png 1041w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Here is an example of the area method applied to a star, with the area quantity corresponding to error printed at the top:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"929\" height=\"702\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.03.47\u202fAM-1.png\" alt=\"\" class=\"wp-image-1170\" style=\"width:443px;height:auto\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.03.47\u202fAM-1.png 929w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.03.47\u202fAM-1-300x227.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Screenshot-2024-08-10-at-1.03.47\u202fAM-1-768x580.png 768w\" sizes=\"auto, (max-width: 929px) 100vw, 929px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Inherent Error Function<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We define the error function between the reconstructed polyline and the zero level set (ZLS) of a given signed distance function (SDF) as:<br>$$<br>\\mathrm{Error}=\\frac{1}{|S|} \\sum_{s \\in S} \\mathrm{sdf}(s)<br>$$<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, \\(S\\) represents a set of sample points from the reconstructed polyline generated by the marching squares algorithm, and \\(|\\mathrm{S}|\\) denotes the cardinality of this set. The sample points include not only the vertices but also the edges of the reconstructed polyline.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The key advantage of this error function lies in its simplicity and directness. Since the SDF inherently encodes the distance between any query point and the original polyline, there&#8217;s no need to compute distances separately as required in Hausdorff or Chamfer distance calculations. This makes the error function both efficient and well-suited to our specific context, providing a more streamlined and integrated approach to measuring the accuracy of the reconstruction.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note that one variant one can consider is to square the \\(\\mathrm{sdf}(s)\\) part to get rid of the signed nature, because the signs can cancel with each other for the reconstructed polyline is not always entirely inside the ground truth or entirely cotains the ground truth.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below are one experiment we did for computing using this inherent error function, the unsquared one. We let the circle sdf be fixed and let the square sdf &#8220;escape&#8221; from the circle in a constant speed of \\(0.2\\). That is, we used the union of a fixed circle and a square with changing position as a series of shapes to do analysis. We then draw with color map used in <a href=\"https:\/\/github.com\/zoemarschner\/csg_on_nsdf\" data-type=\"link\" data-id=\"https:\/\/github.com\/zoemarschner\/csg_on_nsdf\">this repo<\/a> for the ground truths and the marching square results using the common color map.<\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-1024x341.png\" alt=\"\" class=\"wp-image-1179\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-1024x341.png 1024w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-300x100.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-768x256.png 768w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-1536x512.png 1536w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-1200x400.png 1200w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8.png 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The inherent error of each union After several trials, one simple observation drawn from this escapaing motion is that when two shapes are more confounding with each other, as in the initial stage, the error is higher; and when the image starts to have two separated connected components, the error rises again. The first one can perhaps be explained by what <a href=\"https:\/\/zoemarschner.com\/papers\/csg_on_neural_sdfs.pdf\" data-type=\"link\" data-id=\"https:\/\/zoemarschner.com\/papers\/csg_on_neural_sdfs.pdf\">the paper<\/a> pointed out as pseudo-sdfs, and the second one is perhaps due to occurence of multipal components.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is another experiment. We want to know how well this method can simulate the physical characteristics of an object&#8217;s rugged level. We used a series of regular polygons. Although the result is theoretically unintheresting as the errors are all nearly zero, this is visually conformting. <\/p>\n\n\n\n<figure class=\"wp-block-image alignwide size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-1024x512.png\" alt=\"\" class=\"wp-image-1188\" srcset=\"https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-1024x512.png 1024w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-300x150.png 300w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-768x384.png 768w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-1536x768.png 1536w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2-1200x600.png 1200w, https:\/\/summergeometry.org\/sgi2024\/wp-content\/uploads\/2024\/08\/Figure_8-2.png 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Primary mentors:\u00a0 Silvia Sell\u00e1n, University of Toronto and Oded Stein, University of Southern California Volunteer assistant:\u00a0 Andrew Rodriguez Fellows: Johan Azambou, Megan Grosse, Eleanor Wiesler, Anthony Hong, Artur RB Boyago, Sara\u00a0Samy After talking about what are some of the ways to reconstruct sdfs (see part one), we now study the question of how to evaluate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"ppma_author":[15,24,31,16,12],"class_list":["post-1008","post","type-post","status-publish","format-standard","hentry","category-research"],"authors":[{"term_id":15,"user_id":0,"is_guest":1,"slug":"cap-hong-x","display_name":"hong.x","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","first_name":"","last_name":"","user_url":"","job_title":"","description":""},{"term_id":24,"user_id":0,"is_guest":1,"slug":"cap-ar-bb","display_name":"ar.bb","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","first_name":"","last_name":"","user_url":"","job_title":"","description":""},{"term_id":31,"user_id":0,"is_guest":1,"slug":"cap-megan-e-grosse","display_name":"megan.e.grosse","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","first_name":"","last_name":"","user_url":"","job_title":"","description":""},{"term_id":16,"user_id":0,"is_guest":1,"slug":"cap-jjohanar","display_name":"jjohanar","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","first_name":"","last_name":"","user_url":"","job_title":"","description":""},{"term_id":12,"user_id":0,"is_guest":1,"slug":"cap-ewiesler","display_name":"ewiesler","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","author_category":"","first_name":"","last_name":"","user_url":"","job_title":"","description":""}],"_links":{"self":[{"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/posts\/1008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/comments?post=1008"}],"version-history":[{"count":10,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/posts\/1008\/revisions"}],"predecessor-version":[{"id":1208,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/posts\/1008\/revisions\/1208"}],"wp:attachment":[{"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/media?parent=1008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/categories?post=1008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/tags?post=1008"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2024\/wp-json\/wp\/v2\/ppma_author?post=1008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}