Jekyll2020-09-12T18:33:46+00:00https://opensam.org/feed.xmlOpenSAMOpenSAM Foundation: advancing factor graphs through GTSAM and OpenSAM.Youtube channel2020-08-26T00:00:00+00:002020-08-26T00:00:00+00:00https://opensam.org/opensam.org/2020/08/26/youtube<p>We are starting a <a href="https://www.youtube.com/channel/UCurpOOuU0bbSEug90Y1AruQ">Youtube channel</a> that we will gradually fill with short explainers. For now there are only two videos by <a href="https://dellaert.github.io/">Frank Dellaert</a>, one from RSS and one from ECCV. However, <a href="https://www.ipb.uni-bonn.de/people/cyrill-stachniss/">Cyrill Stachniss</a> is working on a 5-minute intro to factor graphs, and Frank is preparing something about Bayes trees. Stay tuned, and subscribe to the channel if interested!</p>We are starting a Youtube channel that we will gradually fill with short explainers. For now there are only two videos by Frank Dellaert, one from RSS and one from ECCV. However, Cyrill Stachniss is working on a 5-minute intro to factor graphs, and Frank is preparing something about Bayes trees. Stay tuned, and subscribe to the channel if interested!What are Factor Graphs?2020-05-26T00:00:00+00:002020-05-26T00:00:00+00:00https://opensam.org/opensam.org/2020/05/26/factor-graphs<h3 id="by-frank-dellaert-fdellaert-on-twitter">By <a href="https://dellaert.github.io/">Frank Dellaert</a>, <a href="http://twitter.com/fdellaert">@fdellaert on Twitter</a></h3>
<p>Many computational problems in robotics have an optimization problem at their core. For example, in simultaneous localization and mapping (SLAM) and many other <strong>estimation problems</strong> we are after a maximum a posteriori estimate, i.e., we try to maximize posterior probability of the variables given a set of measurements. When attempting to <strong>act optimally</strong>, we try to maximize a performance index, or conversely minimize a penalty function. And even in classical planning, we are trying to find an assignment to a set of discrete variables that minimizes the plan length or optimizes for some other desirable property of the plan.</p>
<p>In most of these optimization problems, the objective to be maximized or minimized is composed of many different <strong>factors or terms that typically are local in nature</strong>, i.e., they only depend on a small subset of the entire set of variables. For example, in a tracking application, a particular video frame only provides information about the position of a target at a particular time. At the next time step, a different variable is associated with the target. Of course, this depends on the parametrization chosen: if a track is globally parametrized, for example as a polynomial, this locality is destroyed.</p>
<p>A particularly insightful way of modeling this locality structure is using the concept of <strong>factor graphs</strong>. Factor graphs are a class of graphical models in which there are variables and factors. The variables represent unknown quantities in the problem, and the factors represent functions on subsets of the variables. Edges in the factor graph are always between factors and variables, and indicate that a particular factor depends on a particular variable.</p>
<p>There are three main <strong>advantages</strong> to using factor graphs when designing algorithms for robotics applications:</p>
<ul>
<li>They can represent a wide variety of problems across robotics.</li>
<li>By laying bare the compositional structure of the problem, they expose opportunities to improve computational performance.</li>
<li>They are beneficial in designing and thinking about modelling your problem, even aside from performance considerations.</li>
</ul>
<p>Because many optimization problems in robotics have the locality property, factor graphs can model a wide variety of problems across AI and robotics. Some of these are illustrated below:</p>
<h2 id="boolean-satisfiability">Boolean Satisfiability:</h2>
<p>In <em>Boolean Satisfiability</em>, we are looking for an assignment to Boolean variables that make a set of Boolean formulas true. In the example below, the rather boring looking Boolean equations is represented by the Boolean factor graph below:</p>
<p><img src="/assets/fg-images/image6.png" alt="Factor graph with Boolean variables and hard constraints" title="Factor graph with Boolean variables and hard constraints" /></p>
<h2 id="constraint-satisfaction">Constraint Satisfaction:</h2>
<p>When we generalize from Boolean to <em>discrete</em> variables, we obtain the class of <em>Constraint Satisfaction Problems</em> or CSPs. For example, the image below shows a graph coloring problem where the goal is to assign a color (chosen from a finite set of colors) to the Swiss cantons such that no neighboring canton has the same color. In the graph below, these pairiwse <em>constraints</em> are indicated by the square factors.</p>
<p><img src="/assets/fg-images/image3.png" alt="Factor graph with Discrete variables and hard constraints" title="Factor graph with Discrete variables and hard constraints" /></p>
<h2 id="bayes-networks">Bayes Networks:</h2>
<p>If we relax the hard constraints to real-valued <em>preferences</em>, we switch to a <em>Constraint Optimization Problem</em>. This can be used to express that a particular color is preferred over another one. It can be shown that <em>COPs</em> are also the main optimization problem to solve in the venerable AI technique of <em>Bayes networks</em>. Below an example where a Bayes network with given evidence (the square nodes) is converted to a COP factor graph, which can then give the maximum probable explanation for the remaining (non-evidence) variables.</p>
<p><img src="/assets/fg-images/image5.png" alt="Bayes net with evidence and corresponding COP factor graph" title="Bayes net with evidence and corresponding COP factor graph" /></p>
<h2 id="polynomial-equations">Polynomial Equations:</h2>
<p>The constraints can also be other functions of the variables. For example, we can represent a system of polynomial equations by a factor graph. The example below, adapted from Gim Hee Lee’s Ph.D. thesis, encodes a minimal geometry problem from computer vision, useful for autonomous driving:</p>
<p><img src="/assets/fg-images/image2.png" alt="Factor graph with continuous variables and polynomial equality constraints" title="Factor graph with continuous variables and polynomial equality constraints" /></p>
<h2 id="simultaneous-localization-and-mapping">Simultaneous Localization and Mapping:</h2>
<p>Speaking of autonomous driving, perhaps the most famous application of factor graphs is in SLAM, or <em>Simultaneous Localization and Mapping</em>. This is illustrated in the example below, where the location of a vehicle over time (the cyan variables) as well as the location of a set of landmarks (the dark blue nodes) are solved for. In this case we have a plethora of factors associated with vehicle odometry, landmark sightings, and GPS priors. The example in question is a small excerpt from a real robot experiment in Sydney’s Victoria Park.</p>
<p><img src="/assets/fg-images/image1.png" alt="Factor graph with pose and landmark variables, and measurement-derived factors" title="Factor graph with pose and landmark variables, and measurement-derived factors" /></p>
<h2 id="structure-from-motion">Structure from Motion:</h2>
<p>Finally, we can also represent <em>3D mapping</em> or <em>3D reconstruction</em> problems with factor graphs. Below we show just the edges in the factor graph connecting one camera (yellow) with all points visible from that camera (black) in a large-scale 3D reconstruction of downtown Chicago.</p>
<p><img src="/assets/fg-images/image4.png" alt="Factor graph with cameras and 3D point variables, and re-projection factors for one camera" title="Factor graph with cameras and 3D point variables, and re-projection factors for one camera" /></p>
<h2 id="conclusion">Conclusion</h2>
<p>For more information about how factor graphs are typically used to solve perception problems in robotics, see the following booklet: <a href="https://dellaert.github.io//pubs/Dellaert17fnt.pdf">Factor graphs for robot perception</a>, by <a href="https://dellaert.github.io/">Frank Dellaert</a> and <a href="https://frc.ri.cmu.edu/~kaess/">Michael Kaess</a>, which appeared in 2017 in Foundations and Trends in Robotics.</p>
<p>However, this is just the tip of the iceberg. Factor graphs can be used to model a much wider variety of problems across robotics domains, such as Tracking, Inertial Navigation, Mapping with LIDARs, Classical Planning, Reinforcement Learning and Optimal Control, Motion Planning etc…</p>By Frank Dellaert, @fdellaert on Twitter Many computational problems in robotics have an optimization problem at their core. For example, in simultaneous localization and mapping (SLAM) and many other estimation problems we are after a maximum a posteriori estimate, i.e., we try to maximize posterior probability of the variables given a set of measurements. When attempting to act optimally, we try to maximize a performance index, or conversely minimize a penalty function. And even in classical planning, we are trying to find an assignment to a set of discrete variables that minimizes the plan length or optimizes for some other desirable property of the plan.Launching opensam.org2020-04-08T00:00:00+00:002020-04-08T00:00:00+00:00https://opensam.org/opensam.org/2020/04/08/opensam-org<p>Today we launched OpenSAM’s new web presence, <a href="http://opensam.org">opensam.org</a>. The site is hosted by Github Pages, and is generated via <a href="https://jekyllrb.com">Jekyll</a>, a simple static website generator.</p>
<p>At the moment, the page still looks rather spartan, but we’ll add a little more design features as time goes on.</p>Today we launched OpenSAM’s new web presence, opensam.org. The site is hosted by Github Pages, and is generated via Jekyll, a simple static website generator.