<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joey Hong on Medium]]></title>
        <description><![CDATA[Stories by Joey Hong on Medium]]></description>
        <link>https://medium.com/@jxihong?source=rss-76f9e7e0fa01------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*-qEdOA_aM6ha3qNYPDBMWw.jpeg</url>
            <title>Stories by Joey Hong on Medium</title>
            <link>https://medium.com/@jxihong?source=rss-76f9e7e0fa01------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 20:29:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jxihong/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Super Car-io Odyssey: My Favorite Papers from CVPR 2019]]></title>
            <link>https://medium.com/analytics-vidhya/super-car-io-odyssey-my-favorite-papers-from-cvpr-2019-ccdca524e25c?source=rss-76f9e7e0fa01------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccdca524e25c</guid>
            <category><![CDATA[self-driving-cars]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Joey Hong]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 03:09:04 GMT</pubDate>
            <atom:updated>2019-06-26T07:08:13.819Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDmUIExPCF90_tm3vNn1yQ.jpeg" /></figure><p>Well, the 2019 Conference on Computer Vision and Pattern Recognition (CVPR) took place in cloudy Long Beach, CA last week. The Long Beach Convention Center was filled to the brim with ~10,000 people, including some top computer vision researchers in the world, and some aggressively medium ones (i.e. me).</p><p>I was fortunate enough to be able to present a <a href="http://openaccess.thecvf.com/content_CVPR_2019/html/Hong_Rules_of_the_Road_Predicting_Driving_Behavior_With_a_Convolutional_CVPR_2019_paper.html">paper from a past internship </a>there, as well as be in the front-row (but technically third-from-last row because the conference was packed) of some really cool and innovative work in computer vision. Now that it’s over, I wanted to share a couple papers that I found particularly cool.</p><p><em>Disclaimer</em>:<em> </em>I’m not a vision-person; I’m actually not an anything-person yet, as I just finished my undergrad. So, the papers I’m highlighting aren’t traditional computer vision ones. Apologies to you readers who really wanted to hear about panoptic segmentation or monocular depth estimation, but we’ll instead be delving into motion-planning and loss functions!</p><p><a href="http://openaccess.thecvf.com/content_CVPR_2019/html/Zeng_End-To-End_Interpretable_Neural_Motion_Planner_CVPR_2019_paper.html"><strong>End-to-end Interpretable Neural Motion Planner</strong></a></p><p>This is the latest and greatest work to come out of <a href="http://www.cs.toronto.edu/~urtasun/">Raquel Urtasun’s group</a> at UToronto/Uber ATG, and Urtasun even claims this one is “the best paper [she] has ever written.” Urtasun’s research in self-driving cars (SDCs) is very practically grounded, and, based on my limited experience in the industry, extremely influential. I’m a huge fan of her work, so I went to every workshop talk she gave at CVPR; in hindsight, it probably wasn’t the best idea because I ended up hearing the same talk four different times.</p><p><strong>End-to-end Driving</strong></p><p>The “holy grail” of Urtasun’s research is an end-to-end approach to SDCs. That means a method that takes sensor data as input, and outputs commands to control the vehicle. This was <a href="https://arxiv.org/pdf/1604.07316.pdf">done in the past</a>, but suffered from some shortcomings:</p><ol><li>Lack of interpretability.</li><li>Cannot compose different sub-tasks to solve main task. This makes the approach very sample-inefficient.</li><li>Difficult to get working in the real world, where some prior of driving rules was necessary.</li></ol><p>This is why the SDC industry shifted towards an engineering-stack approach, where different modules as perception, prediction, and planner would solve different sub-tasks of the problem (detecting and tracking objects, estimating where they go, and generating a safe trajectory to execute, respectively); the modules would be composed together to make the AI for the vehicle. Sadly, this approach also isn’t perfect:</p><ol><li>Computation is not shared between modules.</li><li>Difficult to gauge error propagation between modules; estimating where a car will go naturally suffers if you’re incorrect about where the car is. Recovery from such errors is also difficult.</li></ol><p>Urtasun’s group captured the best of both worlds, by building an end-to-end approach that is both interpretable (due to intermediate-level predictions) and works well in the real world. This paper is the conclusion of <a href="http://openaccess.thecvf.com/content_cvpr_2018/html/Luo_Fast_and_Furious_CVPR_2018_paper.html">previous</a> <a href="http://www.cs.toronto.edu/~wenjie/papers/intentnet_corl18.pdf">work</a> by her group; however, unlike many other series (i.e. Game of Thrones), this ending is strong and satisfying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIyGip1O9wMIFyWMdz-G6Q.png" /><figcaption>Engineering-stack vs. End-to-end (Creds: me and powerpoint)</figcaption></figure><p><strong>An Interpretable Planner</strong></p><p>The proposed neural motion planner (NMP) takes as input LiDAR point clouds and a HD map of the road network, and outputs space-time “cost volumes.” Cost volume is very elegant-sounding, but it is actually just, for each timestep, a 2D heat-map where low value/cost regions are good locations to be at.</p><p>If <em>cᵗ</em> is the cost volume at timestep t, and <strong><em>s</em></strong> is a trajectory, then the planned trajectory is just the solution to the optimization:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Woi9F7ySYc1di13BhcNWMQ.png" /></figure><p>A nice figure summarizing the approach is given in the paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RulL3QaPVRu0yBGfz9U4sQ.png" /><figcaption>Overview of neural motion planner: Input is fed through a backbone network, and predicts perception results, as well as a cost volume. The cost volume evaluates trajectories and picks the best one.</figcaption></figure><ol><li>The input, which is a 3D tensor concatenation of LiDAR point cloud and HD road map, is fed through a backbone convolutional network.</li><li>The intermediate representation is fed through two heads. The first, the perception head, is a <a href="https://arxiv.org/pdf/1512.02325.pdf">SSD network </a>that regresses and classifies bounding boxes for entities in the scene, as well as forecasts the future motion of those boxes <em>T</em> - 1 steps into the future.</li><li>The second, the cost volume head, is a deconvolution network that generates cost volumes up to <em>T</em> steps into the future.</li><li>Trajectory samples are generated (in another fancy method I’ll discuss later), and the minimal-cost sample through the cost volumes is chosen as the planned trajectory.</li></ol><p>Now, there are just two questions to answer and billions of dollars to obtain before we can implement our own NMP and start yet another self-driving company: (1) how are trajectories sampled? and (2) what losses are the network trained on? I unfortunately don’t quite have the money, but I can provide the answers.</p><p><strong>(1) Sampling Trajectories</strong></p><p>Well, the last time I remember doing geometry was computing the area of hexagons in middle school, so this part was a little involved for me. Trajectories are in essence, a combination of shape and a velocity profile. The high-level process is pretty straightforward:</p><ol><li>Sample parameters for a Clothoid curve (more on that later), and use resulting curve as the trajectory shape.</li><li>Determine a velocity profile (assume constant acceleration).</li><li>Move along the curve according to velocity profile to get a trajectory.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*MBTTUobHdTr6VGrBT-o4Ig.png" /><figcaption>Getting spacetime trajectories.</figcaption></figure><p>Unfortunately, the Clothoid curve isn’t a hexagon, so my middle school geometry isn’t useful here. But the curve is mildly famous, and is given by the parametric equations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*Dj9OGwrUmaO6ERnW64Yqww.png" /></figure><p>So,<strong> s</strong>(ξ) essentially defines a 2D curve, parameterized by distance ξ to starting point <strong>s₀</strong><em>, </em><strong>T₀ </strong>and<strong> N₀ </strong>are the tangent and normal vectors to <strong>s₀</strong>, and <em>a</em> is a scaling factor. The actual shape of the curve is fixed by <em>a</em>, so Step 1 consists of uniformly sampling such <em>a</em>. To visualize its effect, I made a few plots in Mathematica of Clothoid curves varying <em>a:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*1WXCvSoPhqmTnV-83gjWFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*Iv6FQgHg3WS8maKc_Ir1bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*UUrT1_2o7qIogyYdxchAbw.png" /><figcaption>Clothoid curves for a=10, 30, 50, with ξ in range [0, 50]</figcaption></figure><p>As baseline shapes, a straight line and circular arc were also sampled with constant probability. Once the shape of the curve is determined, the starting point on the curve is determined by the initial steering wheel angle. Then, the velocity profile ξ’(t) from Step 2 determines ξ(t). Finally, in Step 3, ξ(t) yields points on the curve, which form the waypoints of the sampled trajectory.</p><p><strong>(2) Multi-task Loss</strong></p><p>The network is trained with a combined loss for both the perception and planning heads:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*9bnAInVGnAQk2hQtuDT3aQ.png" /></figure><p>The perception loss is a pretty straightforward supervised loss. Using the ground truth detection results, the perception head is trained to predict the existence of vehicles at predefined anchor boxes (classification loss), as well as regress the position, shape, and heading angle of each box at each present and future timestep (regression loss).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*0gIv6Mh-m5Ku3JlIvLFEIA.png" /></figure><p>The planning loss is a little trickier, as the only ground truth we have are the executed trajectories, which don’t map nicely to predicted cost volumes. A naive researcher (i.e. me, again) would discretize the ground truth trajectories into grid locations, and train the cost volumes using cross-entropy loss on the locations. In fact, I did exactly that in <a href="http://openaccess.thecvf.com/content_CVPR_2019/html/Hong_Rules_of_the_Road_Predicting_Driving_Behavior_With_a_Convolutional_CVPR_2019_paper.html">my own work</a> (shameless plug, again).</p><p>Urtasun instead uses a max-margin loss, treating the ground truth as positive examples, and randomly sampled trajectories as negative ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*NbZ2UnbxIaCOZ3Nmh4w_OA.png" /></figure><p>The loss is quite a bit more sophisticated than cross-entropy. Here, the c^ are the ground truth waypoints, cᵢ the sampled ones, dᵢ the distance between ground truth and sampled (encouraging far away ones to have high cost), and γᵢ a penalty for disobeying traffic rules; the <em>max </em>ensures<em> </em>only the worst sample is optimized, so that the cost volume is trained to discriminate the good, ground truth trajectories from really bad ones.</p><p>The paper goes through quite a few experiments, including metrics for measuring the quality of intermediate predictions (perception and prediction tasks). TLDR: they’re good. What is interesting to me are the visualized cost volumes and planned trajectories:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*HV6dYPMCpq0McttyzWPosA.gif" /><figcaption>The colored regions indicate low-cost, and the planned trajectory is in red and the ground truth in blue.</figcaption></figure><p>The cost volumes seem to handle multi-modal scenarios pretty well, including lane changes and turning at junctions. Though I’m pretty easy to impress (especially if there’s a dog involved), I think the sophistication of the planned trajectories is undoubtedly really cool.</p><p><strong>Discussion</strong></p><p>I hope I’m not spoiling any SDC industry secrets by saying that there is still a lot more room for machine learning in SDC stacks. Up until even today, (very complex) heuristics have appeared to work better than learned methods, so it’s very promising to see an end-to-end deep learning method achieve state-of-the-art-looking results. However, an active area of improvement is in handling unseen domains/recovering from mistakes (i.e. “<a href="https://www.ri.cmu.edu/pub_files/2011/4/Ross-AISTATS11-NoRegret.pdf">DAgger problem</a>”), which seems to be an area where reinforcement learning (RL) could step in. But that may just be because I’m an RL bandwagon-er.</p><p><a href="http://openaccess.thecvf.com/content_CVPR_2019/html/Barron_A_General_and_Adaptive_Robust_Loss_Function_CVPR_2019_paper.html"><strong>A General and Adaptive Robust Loss Function</strong></a></p><p>So this was probably my favorite paper from the entire conference; it just has the perfect blend of fundamental machine learning theory and why-didn’t-I-think-of-that originality. I was not familiar with <a href="https://jonbarron.info/">Jon Barron</a>’s (who wrote the paper by himself!) work before this, but I will definitely be following it from now on. There was also a huge crowd by his poster, so he’s well on his way to achieving that A-list ML researcher fame, the kind that gets you street-recognition (if that street happened to be populated by ML researchers).</p><p><strong>Too Many Loss Functions</strong></p><p>There is an <a href="https://www.youtube.com/watch?v=BmNKbnF69eY&amp;feature=youtu.be">accompanying video</a> that sets up the problem very nicely. We are dealing with the classic regression problem, where we try to predict <em>y</em> given features <em>x</em>. Most people turn to L₂ loss in this case, but we all know that it’s very sensitive to outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XwI2sPoPq_qlx_TPB7VAGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pm2WQLzAruJWIczei65KUA.png" /></figure><p>If you really like loss functions, you might begin trying a bunch of other ones that you know of, and some will work better than others:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*N0TGgEqgO-ed7bH90RMIfA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*X3Jz4Xfr61ylC7Q2TcSPdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*QlMLpFbNUtys7NEiBp_AOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*9QUFrWht0BfZGHNyBrmE5A.png" /></figure><p>What changed between the different losses was how heavily it weighed outliers over inliers — also known as <em>robustness</em>. Now, if you did not know what German-McClure loss was before this (which I’m guessing is everyone except German and McClure), you would have been pretty stuck. And even if you did know, it was still pretty tedious trying out all these different loss functions to finally arrive at a good one.</p><p>Barron introduces a new loss function, which, when given different parameters, actually reproduces all the losses shown above; perhaps more importantly, he gives a way to adaptively tune those parameters during training to automatically determine the optimal robustness of this loss function for a specific task.</p><p><strong>Loss Function</strong></p><p>If I were Barron, I would have called it Barron Loss, as having a loss function named after me is pretty high up on my bucket list; but Barron is less narcissistic than I, and left it unnamed. Anyway, here’s his loss function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*eZwEoUB8uG__mzQp1Gsuyg.png" /></figure><p>In the formula, α is a shape parameter that determines the robustness of the function, and <em>c</em> &gt; 0 is a scale parameter that determines the size of the quadratic bowl (the U-shape) around <em>x </em>= 0.</p><p>You may notice singularities at α = 0, 2. However, in the limit, we get the loss actually approximates L₂ loss near α = 2 , and Cauchy loss near α = 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*qGCXz0XWCsFXB4V2VZXNTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*svvBnkHqUG6GfulW7MTnQQ.png" /></figure><p>In fact, a really nice property of this loss function is that it actually reproduces several existing loss functions for specific α: L2 loss (α = 2), Charbonnier loss (α = 1), Cauchy loss (α = 0), Geman-McClure loss (α = −2), and Welsch loss (α = −∞). This is evident in his final version of the loss (which removes singularities):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*Rw8ZBLNYH_-MhtWWSQvNBA.png" /></figure><p>There’s also a nice figure from the paper to show how its shape changes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*rgt6XDfD9qkfuMy8tWq5vg.png" /><figcaption>Loss function (left) and its gradient (right) for various α. Note how gradients descent to 0 for outliers as α decreases, increasing robustness.</figcaption></figure><p>There are actually a lot of nice properties about this loss function:</p><ol><li>Smooth w.r.t |<em>x</em>| and α. So, we can do gradient-based optimization, which, if I’m being honest, is all I know how to do nowadays.</li><li>Increases monotonically w.r.t. |<em>x</em>| and α. You may have also noticed that robustness increases as α decreases (outliers are weighted less/have small gradient for small α). This means you can do some graduated non-convexity optimization: set α large so the loss is convex, then anneal α so convexity decreases but robustness increases, and (hopefully) not get stuck in local minima that way.</li><li>Bounded first and second derivatives. This means we can avoid those unpleasant surprises of exploding gradients during optimization.</li></ol><p><strong>Adaptive Algorithm</strong></p><p>All of this is pretty useless if the climax of the paper were that we needed to do hyperparameter search for α and <em>c. </em>The really cool thing is that those parameters can actually be free and solved for along with the rest of the model weights. Now, naively minimizing <em>ρ </em>(·,<em> α</em>,<em> c</em>) won’t work, because we can just choose <em>α</em>,<em> c</em> as small as possible and make the loss trivially small (recall that <em>ρ </em>increases monotonically with<em> α</em>).</p><p>Some tradeoff needs to be introduced, so <em>α </em>cannot be made arbitrarily small. That tradeoff is elegantly packaged into the negative log-likelihood (NLL) of the probability distribution that corresponds to the loss function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*fL1ldi3LxP3uXGcyM8bdiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*lqorj88GC7ZQ5Zq8TZUcyg.png" /></figure><p>Now, I have seen enough work using probabilistic graphical models to be slightly scared of the <a href="https://www.deeplearningbook.org/contents/partition.html">partition function</a> <em>Z</em>(<em>α</em>).<em> </em>But maybe it’s nice and tractable this time…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XEh5-21gEsJgbix66Gl9cA.png" /><figcaption>:(</figcaption></figure><p>Luckily, Barrons finds a way around it by approximating <em>log</em> <em>Z</em>(<em>α</em>) with a <a href="https://en.wikipedia.org/wiki/Cubic_Hermite_spline">cubic hermite spline</a> interpolation. In practice, he does another trick to make the spline continuously differentiable, by working in a transformed space for <em>α </em>(see his <a href="http://openaccess.thecvf.com/content_CVPR_2019/supplemental/Barron_A_General_and_CVPR_2019_supplemental.pdf">supplementary material</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*Ug7wwhjvcb5FpgTx0C5IGw.png" /></figure><p>What does the addition of <em>log</em> <em>Z</em>(<em>α</em>) do to the new objective? Well, it effectively shifts the original loss function so that for small <em>α, </em>which give low cost to outliers, the cost of inliers increases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*JrIJKSEuPAQT54iU0eZd5w.png" /><figcaption>NLLs (left) and PDF(right). Notice that higher cost is given to inliers for lower α, preventing one from arbitrarily decreasing α.</figcaption></figure><p>This creates a tradeoff where assigning low cost to large residuals incurs a penalty on the smaller ones, preventing an optimization from trivially decreasing loss as before. Now, <em>α</em>,<em> c </em>can be optimized as free parameters along with the rest of the model weights!</p><p><strong>Experiments</strong></p><p>Barron shows that in a variety of tasks, just replacing the original model’s loss function with the new, adaptive one enables noticeable performance improvements. Since this is CVPR (and there hasn’t been any mention of image generation or depth estimation yet), two such tasks are (1) image generation using <a href="https://arxiv.org/pdf/1312.6114.pdf">variational auto-encoders</a> (VAEs), and (2) monocular depth estimation.</p><p>With VAEs, Barrons compared generating a normal distribution for each RGB pixel in the output image, to generating the new distribution with <em>α</em>,<em> c </em>as trainable parameters. Quantitatively, the validation set ELBOs also improve, from 31,505 to 36,373 (with wavelets instead of pixels). In addition, samples using VAEs are <a href="https://arxiv.org/pdf/1606.04934.pdf">notoriously</a> <a href="https://arxiv.org/pdf/1702.08658.pdf">blurry</a>, but using the new output distribution results in sharper, clearer images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WiM9IMyglj8oBiYb2QQieg.png" /><figcaption>Using the new distribution results in sharper samples.</figcaption></figure><p><a href="https://people.eecs.berkeley.edu/~tinghuiz/projects/SfMLearner/cvpr17_sfm_final.pdf">Unsupervised monocular depth estimation</a> estimates both depth and camera pose using pairs of related, unlabeled images as training data. In this task, the original objective of maximizing likelihood of pixels using a fixed Laplacian distribution is replaced with the using the new distribution. Doing so reduces the validation error from 0.407 to 0.332 (also using wavelets; I admittedly didn’t know they were that useful), and makes significantly better-looking depth estimates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*aUPS7KCnK7zk0XXufYnUhg.png" /></figure><p>I skimmed over the experiments pretty aggressively, but I wanted to concentrate on the theoretically interesting parts over the computer vision applications (I hope I don’t get blacklisted from future CVPRs for that comment).</p><p><strong>Discussion</strong></p><p>I thought that Barron’s work was reminiscent of Alex Kendall’s (who(m?) I’m also a fan of!) with <a href="https://arxiv.org/pdf/1705.07115.pdf">homoscedastic losse</a>s. That work deals with adaptively scaling losses for individual tasks in a multi-task loss setting, whereas this work loosely does a scaling of losses for individual data, conditioned on their residuals. They both fit under this overarching theme of handling <em>aleatoric uncertainty — </em>statistical uncertainty due to hidden explanatory variables in the training data.</p><p>One limitation of this work is that it’s only applicable to regression tasks (if that even counts as a limitation, as <em>a lot</em> of tasks involve regression). Maybe there exists a corresponding “generalized” cross-entropy or hinge loss for classification tasks, but getting such loss to be smooth may be a challenge.</p><p>Nevertheless, I was super excited by Barron’s work; it was definitely one of the more impressive things I have seen lately, and I’ve seen this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*4sIf82vynFm6Stft9n2z0w.gif" /></figure><p>Anyway, there was a lot of other great work at this year’s CVPR, including a “<a href="http://openaccess.thecvf.com/content_CVPR_2019/html/Xin_A_Theory_of_Fermat_Paths_for_Non-Line-Of-Sight_Shape_Reconstruction_CVPR_2019_paper.html">best paper” that I’m still trying to work through</a>. It’s a very exciting time for me to finally replace school exams with my own research endeavors!</p><p><strong>References</strong></p><ol><li>Wenyuan Zeng, Wenjie Luo, Simon Suo, Abbas Sadat, Bin Yang, Sergio Casas, Raquel Urtasun. <em>End-To-End Interpretable Neural Motion Planner. </em>The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 8660–8669.</li><li>Jonathan T. Barron.<strong><em> </em></strong><em>A General and Adaptive Robust Loss Function. </em>The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 4331–4339.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccdca524e25c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/super-car-io-odyssey-my-favorite-papers-from-cvpr-2019-ccdca524e25c">Super Car-io Odyssey: My Favorite Papers from CVPR 2019</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Game of Modes: Diverse Trajectory Forecasting with Pushforward Distributions]]></title>
            <link>https://medium.com/analytics-vidhya/game-of-modes-diverse-trajectory-forecasting-with-pushforward-distributions-315b1b30d5e6?source=rss-76f9e7e0fa01------2</link>
            <guid isPermaLink="false">https://medium.com/p/315b1b30d5e6</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[self-driving-cars]]></category>
            <dc:creator><![CDATA[Joey Hong]]></dc:creator>
            <pubDate>Mon, 24 Dec 2018 17:33:33 GMT</pubDate>
            <atom:updated>2019-06-23T23:50:57.555Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*dSFeUEvpORDBgJaxoXu3lw.png" /><figcaption>I just took the first photo from the paper’s supplementary <a href="http://www.cs.cmu.edu/~nrhineha/papers/r2p2-supp-camera-ready.pdf">materials</a>.</figcaption></figure><p>Hi! A while back, I interned at a <a href="https://zoox.com/">self-driving car company</a>, where I specifically did research on trajectory forecasting. As of now, it’s probably the biggest hurdle to realizing the technology, but the literature on it is relatively scarce. The research thus far has used either <a href="http://cvgl.stanford.edu/papers/CVPR16_Social_LSTM.pdf">sequence prediction with RNNs</a>, or <a href="http://www.cs.cmu.edu/~kkitani/pdf/KZBH-ECCV12.pdf">maximum-entropy IRL</a>, or if it’s really fancy, a <a href="https://arxiv.org/abs/1704.04394">combination of both</a>.</p><p>While I was still an intern, I came across this <a href="http://openaccess.thecvf.com/content_ECCV_2018/html/Nicholas_Rhinehart_R2P2_A_ReparameteRized_ECCV_2018_paper.html">R2P2 paper</a>; aside from a <a href="https://www.youtube.com/watch?v=JbNeLiNnvII">workshop talk at CVPR 2018</a>, the paper seems to have relatively flown under the radar, so I wanted to share its novel contributions here. In this article, I will try to accurately explain the novel concepts in the paper with my still nascent knowledge of imitation learning.</p><p><strong>Why is trajectory forecasting so hard anyway?</strong></p><p>That’s a good question. The goal of trajectory/motion forecasting is to take some representation of the environment and produce, for each relevant entity, a context-conditioned distribution of spatiotemporal trajectories of the entity’s future. Though that sounds easy enough for ML (I mean, it can even <a href="https://arxiv.org/pdf/1808.07371.pdf">make random people dance</a> now), there are elements that make it a prediction problem on steroids (or at least one on protein powder with a rigorous exercise regimen).</p><ol><li><em>Reasoning from scene context</em>: Unlike other sequence prediction problems, trajectory forecasting requires much more than the past motion profile. There is a lot of static context in the road map, and dynamic context in other agents interacting with the entity of interest. A lot of recent papers (like <a href="http://www.cs.toronto.edu/~wenjie/papers/intentnet_corl18.pdf">here</a> and <a href="https://arxiv.org/pdf/1812.03079.pdf">here</a>) focus on this problem, experimenting with mid to high-level representations of sensor data in some spatial parameterization, and feeding it into different recurrent and convolutional architectures.</li><li><em>Multi-modality: </em>Perhaps the more theoretically interesting problem is that there is often multiple plausible trajectories (an intersection comes to mind), and a model should be diverse enough to cover all such modes. Conversely, the model must also be precise enough to avoid generating bad trajectories.</li></ol><p>Of the two problems, R2P2 primarily focuses on the latter. Historically, sequence learning is done via maximum likelihood estimation, or equivalently, minimizing the cross entropy loss,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*meD5kLH0VUXJbz1kwVMEOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/1*wPgYv70cJj5RW1cn31TUQA.png" /></figure><p>A quick look at the edge-cases of this loss shows that it gives high penalty to failing to cover some of the modes of the training distribution, but low penalty to missing the underlying distribution entirely. And if we flipped the direction of the two distributions in the cross entropy, we get the reversed behavior. This is best summarized in a figure in the paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*pRa0wPw7xbf3uP-bGtfgLQ.png" /></figure><p>So, the two cross-entropies serve complementary purposes, and the writers of the paper decided to combine them into one, symmetric loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*vL3FbYBnoDBdej1-T8ruyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*lsgTeOLjOLxo47_VcMJT2g.png" /></figure><p>Now, even for someone whose creative highs consist of adding an extra tree when following Bob Ross painting tutorials, I feel like arriving at a symmetric loss wasn’t a huge leap (<a href="https://arxiv.org/pdf/1804.03782.pdf">similar stuff</a> has been done with KL divergence). However, optimizing the expression via gradient descent doesn’t work because the second term isn’t differentiable (and there’s also the problem of finding a prior approximation). An uninspired way, and how I would have done it, is to use the <a href="http://www0.cs.ucl.ac.uk/staff/d.silver/web/Teaching_files/pg.pdf">REINFORCE</a> method from RL, which is usable as long as the learned distribution is differentiable in its parameters, but the paper uses a cooler, less stupidly high-variance, way around it.</p><p><strong>Pushforward distribution modeling</strong></p><p>What the paper instead proposes is a simulator that maps noise from a simple distribution to forecasted trajectories. That way, the loss can be rewritten via change-of-variables. Specifically, they introduce a simulator,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*IP1urkkhrlzARkelEzKLhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*5aV46xU-Ur9CZUg1-k0Cjw.png" /></figure><p>Now, the distribution of trajectories is determined by a simple noise distribution and the simulator (hence a <em>pushforward </em>of the noise). Here is another figure from the paper to illustrate this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*kQ6J4ilUFTQUoE7QDHCPew.png" /><figcaption>Pushing forward a base distribution to a trajectory distribution.</figcaption></figure><p>If the simulator is differentiable and invertible, then we can use the change-of-variables formula to derive,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*I2ZUQaFeLErMBSUPimVzGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*_TNuq6vMCH_etCMCBPsy_g.png" /></figure><p>With some kind-of simple substitution we can rewrite the symmetric loss from earlier as,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*T8gzaus40ZP5jVjMAaEiwA.png" /></figure><p>The next step is choosing an invertible and differentiable simulator; luckily, the trajectory forecasting task lends itself to some pretty glaring ones from stochastic dynamical systems. The writers chose a stochastic one-step policy,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*AH-QijGiReax3lLH-tBj-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*gbPiIku7Rvc0J6QSAjzShA.png" /></figure><p>This gives us an iterative way of generating the next point along a trajectory using the past motion profile and context. As long as the stochastic term is invertible, and both terms are differentiable, a simulator using this policy will also be invertible and differentiable.</p><p>For example, if the noise distribution is the standard normal, then the trajectory distribution is also a normal,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*u2IdNURoB3kjnPemjYxYBQ.png" /></figure><p>Now, using a one-step policy like the one proposed makes computing values in our symmetric loss easy. Namely,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*F4ujll-7rPRx5Hl-j6DukQ.png" /></figure><p>Trivial as a Steph Curry 3-pointer right? (I was told to include a sports reference to make myself appear cool.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*ASes5Vn962z8cOrrBHIYlQ.png" /></figure><p>Well, for those of you who disagree (myself included because I slept through a lot of my linear algebra classes), I’ll show some of the worked-out math. It hinges on the observation that trajectory points don’t depend on points for later timesteps, which makes the Jacobian lower triangular,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*_X2oTe2o_B4FBdgJoHqzfw.png" /></figure><p>A special property of such matrices, which you can easily verify by <a href="http://mathworld.wolfram.com/DeterminantExpansionbyMinors.html">row/column-expansion</a>, is that their determinants are just the product of the diagonal entries. This gives the result,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*40XMu-xdt4RJB-wZz6YCdQ.png" /></figure><p>Finally, we have to revisit this problem I promised I’d go over about 5 minutes ago — approximating the underlying data distribution since we cannot evaluate the underlying’s PDF directly. It’s important that this fixed approximation is decent, because it could add unnecessarily high penalty if it severely underestimates the training distribution in some region.</p><p>One such method is assuming that the trajectory distribution factors over timesteps, i.e. parameterizing,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*GBTXTW_DjVSSu9E09EcLOA.png" /></figure><p>Then, for each timestep, we discretize the region of possible points into L possible locations. We essentially model the probability distribution for each timestep as some discrete grid map, which can be trained via logistic regression with L classes,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*oxRm70kDz1PXbFHBY69gpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*o6LX_AToZfq0DFuVmnGEYA.png" /></figure><p>The paper shows some examples of learned spatial cost functions. As you can see, it typically gives low-ish cost to all drivable surfaces, and high penalty to obstacles. There’s definitely some questionable parts of the learned distributions, but at least its support (of low-cost regions) covers all the plausible trajectories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*wd1uF2zoVSuXK5JL8g95rw.png" /><figcaption>Learned prior (white: high cost, black: low cost). The blue shows the expert demonstrated trajectory.</figcaption></figure><p>Congrats! This basically covers the novel components of the paper. All that’s left are implementation architecture details and experiments, which I will gloss over super briefly.</p><p><strong>Results</strong></p><p>We have mentioned the context repeatedly without explicitly saying what it was; well, as you may expect, it’s just a concatenation of the past motion profile and a spatial grid representing a map of the scene (which looks like a top-down 2D projection of LIDAR data).</p><p>In the R2P2 RNN model (which is the best-performing model in the paper), the map is fed into a CNN to produce a feature encoding of the static context; the past history is then encoded in a GRU-RNN, which also uses the featurized map to iteratively forecast points of the trajectory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*3eDfucZ01YiUenjyhoBzUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*q-9-8RRsZMVHwjzCr5CucA.png" /></figure><p>The architectural details were relatively basic and intuitive, which I liked; I’m also basic and intuitive (vanilla is my favorite ice cream flavor, blue my favorite color, and black bear my favorite bear).</p><p>Another contribution of this paper is the compilation of a new dataset, which they call the CaliForecasting dataset. It’s larger, and supposed to contain more multi-modal examples than the <a href="http://www.cvlibs.net/datasets/kitti/">KITTI dataset</a>. They compare their R2P2 approach to some baseline generative models, one of which is a <a href="https://pdfs.semanticscholar.org/3f25/e17eb717e5894e0404ea634451332f85d287.pdf">CVAE</a> (which is a pretty cool application of variational inference).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*6JuWZJ1IzA08Uu9jBFtaRw.png" /><figcaption>Comparison of R2P2 and CVAE (a pretty popular generative model).</figcaption></figure><p>CVAE get its diversity from a stochastic latent encoding, which is sampled from a standard normal, but it’s fairly straightforward to see that R2P2 covers more plausible modes when multiple exist. This <a href="https://youtu.be/JbNeLiNnvII?t=9091">video</a> also shows R2P2 working continuously, just to confirm that there isn’t a lot of flickering in generated trajectories over time.</p><p>There are other contributions in the paper that I skipped, such as applying their differentiable simulator to create a low-cost variant of <a href="https://arxiv.org/pdf/1606.03476.pdf">GAIL</a> (creatively called R2P2 GAIL). I just didn’t include it because I thought it was secondary to the main, proposed method, and honestly, don’t feel confident enough to explain GAIL without rife mathematical inaccuracies.</p><p><strong>Final thoughts</strong></p><p>Although this paper specifically focuses on trajectory forecasting, the novel approaches of using symmetric losses, and push-forward modeling instead of high-variance, bad-convergence methods from RL, should be applicable to many other types of data. My opinion, which holds no weight in the ML community, is that such methods could potentially be used for language generation models in NLP. Anyway, the mind kind-of races thinking about other potential avenues of application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sz3YTrNb51lE3UEr.jpg" /></figure><p>Don’t worry, mine was too.</p><p><strong>References</strong></p><ol><li>Nicholas Rhinehart, Kris M. Kitani, Paul Vernaza.<strong><em> </em></strong><em>R2P2: A Reparameterized Pushforward Policy for Diverse, Precise Generative Path Forecasting.</em> The European Conference on Computer Vision (ECCV), 2018, pp. 772–788</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=315b1b30d5e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/game-of-modes-diverse-trajectory-forecasting-with-pushforward-distributions-315b1b30d5e6">Game of Modes: Diverse Trajectory Forecasting with Pushforward Distributions</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>