Parallel and Distributed Vision Algorithms Using Dual Decomposition

Similar documents
MULTI-REGION SEGMENTATION

The Encoding Complexity of Network Coding

Lecture 2 September 3

Combinatorial optimization and its applications in image Processing. Filip Malmberg

Discrete Optimization. Lecture Notes 2

Lagrangian Relaxation: An overview

B553 Lecture 12: Global Optimization

Integer Programming Theory

3 No-Wait Job Shops with Variable Processing Times

A MRF Shape Prior for Facade Parsing with Occlusions Supplementary Material

Mathematical and Algorithmic Foundations Linear Programming and Matchings

4 Integer Linear Programming (ILP)

Supplementary Material: Adaptive and Move Making Auxiliary Cuts for Binary Pairwise Energies

PRIMAL-DUAL INTERIOR POINT METHOD FOR LINEAR PROGRAMMING. 1. Introduction

s-t Graph Cuts for Binary Energy Minimization

Primal Dual Schema Approach to the Labeling Problem with Applications to TSP

Graphs and Network Flows IE411. Lecture 21. Dr. Ted Ralphs

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation

Inter and Intra-Modal Deformable Registration:

Applied Lagrange Duality for Constrained Optimization

Some Advanced Topics in Linear Programming

On Covering a Graph Optimally with Induced Subgraphs

Mathematical Programming and Research Methods (Part II)

Simple Silhouettes for Complex Surfaces

Optimizing Data Locality for Iterative Matrix Solvers on CUDA

Convex Optimization and Machine Learning

Advanced Operations Research Techniques IE316. Quiz 1 Review. Dr. Ted Ralphs

Algorithms for Integer Programming

Programming, numerics and optimization

GEOMETRIC SEGMENTATION USING GAUSSIAN WAVE PACKETS

School of Computer and Information Science

MOST attention in the literature of network codes has

Solving for dynamic user equilibrium

TELCOM2125: Network Science and Analysis

Lecture 2 - Introduction to Polytopes

Parallel Auction Algorithm for Linear Assignment Problem

The Alternating Direction Method of Multipliers

12.1 Formulation of General Perfect Matching

CS 534: Computer Vision Segmentation and Perceptual Grouping

1 Linear programming relaxation

AM 221: Advanced Optimization Spring 2016

EE 701 ROBOT VISION. Segmentation

2386 IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 52, NO. 6, JUNE 2006

CSE 417 Network Flows (pt 3) Modeling with Min Cuts

Performance impact of dynamic parallelism on different clustering algorithms

15.082J and 6.855J. Lagrangian Relaxation 2 Algorithms Application to LPs

MVE165/MMG630, Applied Optimization Lecture 8 Integer linear programming algorithms. Ann-Brith Strömberg

16.410/413 Principles of Autonomy and Decision Making

Outline of this Talk

CS 5540 Spring 2013 Assignment 3, v1.0 Due: Apr. 24th 11:59PM

A Linear Programming Approach to Concave Approximation and Value Function Iteration

Interactive segmentation, Combinatorial optimization. Filip Malmberg

CSE 417 Network Flows (pt 4) Min Cost Flows

1. Lecture notes on bipartite matching

Fast Approximate Energy Minimization via Graph Cuts

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Introduction to Mathematical Programming IE406. Lecture 20. Dr. Ted Ralphs

Linear and Integer Programming :Algorithms in the Real World. Related Optimization Problems. How important is optimization?

Lecture notes on the simplex method September We will present an algorithm to solve linear programs of the form. maximize.

Surrogate Gradient Algorithm for Lagrangian Relaxation 1,2

Convex Optimization MLSS 2015

On the Comparative Performance of Parallel Algorithms on Small GPU/CUDA Clusters

3 Interior Point Method

The Simplex Algorithm

Outline. Column Generation: Cutting Stock A very applied method. Introduction to Column Generation. Given an LP problem

Column Generation: Cutting Stock

Graph Coloring via Constraint Programming-based Column Generation

Selected Topics in Column Generation

Morphological Image Processing

Faster parameterized algorithms for Minimum Fill-In

Approximation Algorithms: The Primal-Dual Method. My T. Thai

On the Max Coloring Problem

Probabilistic Graphical Models

Vertical decomposition of a lattice using clique separators

Linear Programming Duality and Algorithms

Computational Methods. Constrained Optimization

CS 664 Segmentation. Daniel Huttenlocher

A Singular Example for the Averaged Mean Curvature Flow

6. Lecture notes on matroid intersection

A Comparison of Mixed-Integer Programming Models for Non-Convex Piecewise Linear Cost Minimization Problems

Approximation Algorithms

Math 5593 Linear Programming Lecture Notes

1. Lecture notes on bipartite matching February 4th,

COT 6936: Topics in Algorithms! Giri Narasimhan. ECS 254A / EC 2443; Phone: x3748

Segmentation and Grouping

Machine Learning for Signal Processing Lecture 4: Optimization

3 INTEGER LINEAR PROGRAMMING

Revisiting Frank-Wolfe: Projection-Free Sparse Convex Optimization. Author: Martin Jaggi Presenter: Zhongxing Peng

Edge and local feature detection - 2. Importance of edge detection in computer vision

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

arxiv: v1 [math.co] 25 Sep 2015

Notes for Lecture 20

Clustering Using Graph Connectivity

CHAPTER 6 MODIFIED FUZZY TECHNIQUES BASED IMAGE SEGMENTATION

PLANAR GRAPH BIPARTIZATION IN LINEAR TIME

Convex Optimization. Stephen Boyd

6.854 Advanced Algorithms. Scribes: Jay Kumar Sundararajan. Duality

Monotone Paths in Geometric Triangulations

A Randomized Algorithm for Minimizing User Disturbance Due to Changes in Cellular Technology

Exact Algorithms Lecture 7: FPT Hardness and the ETH

Transcription:

Parallel and Distributed Vision Algorithms Using Dual Decomposition Petter Strandmark, Fredrik Kahl, Thomas Schoenemann Centre for Mathematical Sciences Lund University, Sweden Abstract We investigate dual decomposition approaches for optimization problems arising in low-level vision. Dual decomposition can be used to parallelize existing algorithms, reduce memory requirements and to obtain approximate solutions of hard problems. An extensive set of experiments are performed for a variety of application problems including graph cut segmentation, curvature regularization and more generally the optimization of MRFs. We demonstrate that the technique can be useful for desktop computers, graphical processing units and supercomputer clusters. To facilitate further research, an implementation of the decomposition methods is made publicly available. Keywords: graph cuts, dual decomposition, parallel, MRF, MPI, GPU 1. Introduction Many problems in low-level computer vision can be formulated as labeling problems using Markov Random Fields (MRFs). Among the examples are image segmentation, image restoration, dense stereo estimation and shape estimation [1 5]. When the number of labels is equal to 2, the problem can sometimes be formulated as a maximum flow or a minimum cut problem [6]. For problems with three or more labels α-expansion [7] and other approximation methods [8 10] are available. Email addresses: petter@maths.lth.se (Petter Strandmark), fredrik@maths.lth.se (Fredrik Kahl), tosch@maths.lth.se (Thomas Schoenemann) URL: http://maths.lth.se/matematiklth/personal/petter (Petter Strandmark) Preprint submitted to CVIU April 14, 2010, revised May 20, 2011 and accepted June 3, 2011.

In this paper we will study how the technique of dual decomposition [11] applies to these and related optimization methods. We will see that it is a valuable tool to parallelize existing algorithms to make them run faster on modern multi-core processors. We will also see that prohibitively large memory requirements can be made tractable on both desktop computers and supercomputer clusters. Examples of optimization problems with huge memory requirements are segmentation problems in three or more dimensions and curvature regularization problems. Finally, we will see that dual decomposition also provides an interesting way of implementing algorithms on parallel hardware, such as graphical processing units (GPUs). 1.1. Outline of the paper In the next section, a discussion of related work is given, followed by a short introduction to dual decomposition. The subsequent three sections apply the decomposition technique to three different problem domains. An overview of these three main sections is given below. Decomposition of graph cuts. The first contribution of this paper is a parallel implementation of the graph cuts method by Boykov and Kolmogorov (BK) introduced in [2]. The approach has a number of advantages compared to other parallelization methods: 1. The BK-method has been shown to have superior performance compared to competing methods for a number of applications [2], most notably sparse 2D graphs and moderately sized 3D graphs. 2. It is possible to reuse the search trees in the BK-method [12] which makes the dual decomposition approach attractive. Further, we show that the dual function can be optimized using integer arithmetic. This makes the dual optimization problem easier to solve. 3. Perhaps most importantly, we demonstrate good empirical performance with significant speed-ups compared to single-threaded computations, both on multi-core platforms and multi-computer networks. Naturally, there are also some disadvantages: 1. There is no theoretical guarantee that the parallelization will be faster for every problem instance. Already for the BK-method no polynomial time guarantee is known, and we cannot give one for the number of iterations, either. In practice this matters little. 2

2. Our current implementation is only effective for graphs for which the BK-method is effective. The underlying dual decomposition principle can however be applied in combination with any graph cut algorithm. The material in this section is based on our earlier work [13]. Decomposition of general MRFs. In Section 5 we broaden the perspective from submodular two-label problems to general optimization problems with unary and binary terms. That is, we now also address multi-label problems and allow arbitrary binary potentials. The computed solutions are now suboptimal and in fact the addressed optimization problems are typically NP-hard. The proposed dual decomposition scheme is based on subproblems that can be solved via dynamic programming. This allows massive parallelism, in particular GPU-implementations. In contrast to previous approaches to solve graph labeling problems on a GPU, cf. Section 2.1, our method works for non-trivial amounts of regularization. Decomposition of curvature linear programs. In the final part of the paper we discuss the problem of optimizing curvature regularity in region-based image segmentation. The recent work [14] has shown that this problem can be formulated as an integer linear program, and that its linear programming relaxation is very tight and sometimes even finds the global optimum. In this paper we show how the run-times and memory requirements of this method can be significantly reduced by applying a dual decomposition scheme. 2. Related work 2.1. Graph cuts Our work builds on the following two trends: the ubiquity of maximum flow computations in computer vision and the tendency of modern microprocessor manufacturers to increase the number of cores in mass-market processors. This implies that an efficient way of parallelizing maximum flow algorithms would be of great use to the community. Due to a result from Goldschlager et al. [15], there is little hope in finding a general algorithm for parallel maximum flow with guaranteed performance gains. However, the graphs encountered in computer vision problems are often sparse with much fewer edges than the maximum n 2 n in a graph with n vertices. The susceptibility to parallelization depends on the structure and costs of the graph. There are essentially three types of approaches used in computer vision for solving the maximum flow/minimum cut problem: 3

Augmenting paths. The most popular method due to its computational efficiency for 2D problems and moderately sized 3D problems with low connectivity (i.e., sparse graphs) is the BK-method using augmenting paths [2]. However, as augmenting path algorithms use nonlocal operations, they have not been considered as a viable candidate for parallelization. One way of making multiple threads cooperate is to divide the graph into disjoint parts. This is the approach taken by Liu et al. [16], in which the graph is split, solved and then split differently in an iterative fashion until no augmenting paths can be found. The key observation is that the search trees of the subgraphs can be merged relatively fast. The more recent work [17] splits the graph into many pieces which, in turn, multiple threads solve and merge until only one remains and all augmenting paths have been found. In this paper the graph is also split into multiple pieces, but our approach differs in that we do not require a shared-memory model, which makes distributed computation possible. Push-relabel. The push-relabel algorithm [18] is an algorithm suitable for parallelization. The implementation by Delong and Boykov [19] has been tested for up to 8 processors with good results. There have been attempts to implement this method on a GPU, the latest being CUDA cuts [20, 21], but our tests of the (freely available) implementation only gave the correct result for graphs with low regularization. Another attempt is [22], which performs all experiments on generated images with a very low amount of regularization. Solving such graphs essentially reduces to trivial thresholding of the data term. The earliest reference we found was [23] which does not report any speed-up compared to sequential push-relabel. Convex optimization. Another approach to parallel graph cuts is to formulate the problem as a linear program. Under the assumption that all edges are bidirectional, the problem can then be reformulated as an l 1 minimization problem. The work in [24] attempts to solve this problem with Newton iterations using the conjugate gradient method with a suitable preconditioner. Matrix-vector multiplications can be highly parallelized, but this approach has not proven to be significantly faster than the single-threaded algorithm in [2] for any type of graph, even though [24] used a GPU in their implementation. Convex optimization based on a GPU has also been used to solve continuous versions of graph cuts, e.g. [25]. However, the primary advantage of continuous cuts has been to reduce metrication errors due to discretization. 4

Graph cuts is also a popular method for multi-label problems using, e.g., iterated α-expansion moves. Such local optimization methods can naturally be parallelized by performing two different moves in parallel and then trying to fuse the solutions, as done in [26]. 2.2. GPU optimization Graphical processing units (GPUs) have been used extensively to facilitate the often very computationally expensive tasks in low-level vision. Segmentation with total variation models has successively been implemented and can be performed in real time [27, 28]. Computing the optical flow between two images [29] and stereo estimation have also benefited greatly from the parallelization offered by a multi-processor GPU. Solving discrete labeling problems such as minimum cuts and its generalizations on a GPU has proven to be harder. Often the speed-up is not great compared to algorithms that run on a CPU or the method might work well for only a restricted amount of regularization. This work is a step in the direction of fast discrete energy minimization algorithms on a GPU. 3. Dual decomposition We achieve parallelism by dual decomposition [11], a general technique in optimization to split a large problem into two or more smaller, better manageable ones. The technique of decomposing problems with dual variables was introduced by Everett [30] and it has been used in many different contexts, e.g. in control [31]. The application within computer vision that bears the most resemblance to this paper is the work of Komodakis et al. [8] where dual decomposition is used for computing approximate solutions to general MRF problems. Consider the following optimization problem: inf E(x), x X (P) where X and E are arbitrary. This problem might be hard to solve. Sometimes the function E can be split up into two parts: E(x) = E 1 (x) + E 2 (x), where the functions E 1 and E 2 are much easier to minimize. We will see later that this is the case with many energy functions associated with MRFs. Now we consider the equivalent optimization problem inf E 1(x) + E 2 (y) x,y X subject to x = y. (1) 5

The dual function [11, 32] of this optimization problem is ( ) d(λ) = inf E 1 (x) + E 2 (y) + λ T (x y) x,y X ( ) = inf E 1 (x) + λ T x x X ( ) + inf E 2 (y) λ T y. y X (2) From the last two rows we see that evaluating the dual function is equivalent to solving two independent minimization problems. If minimizing E 1 and E 2 is much easier than minimizing E, the dual function can be evaluated quite efficiently. Since the value of the dual function d(λ) is a lower bound on the solution to (P) for every λ, it is of great interest to compute the optimal such bound, i.e. solve the dual problem: sup d(λ). λ (D) The dual function is concave, since it is the infimum over a set of concave (affine) functions of λ. Furthermore, it is also easy to find a supergradient to d, as stated by the following lemma [11]: Lemma 1. Given a λ 0, let x be the optimal solution to d(λ 0 ) = min x (f(x)+ ) λ T 0 g(x). Then g(x ) is a supergradient to d at λ 0. Proof. For any λ, we have d(λ) f(x ) + λ T g(x ) = f(x ) + λ T 0 g(x ) + (λ λ 0 ) T g(x ) ) = min f(x) + λ T 0 g(x) + (λ λ 0 ) T g(x ) x ( = d(λ 0 ) + (λ λ 0 ) T g(x ), (3) which is the definition of a supergradient. Maximizing the dual function d can then be done with subgradient methods as described in [11]. Given a λ, one takes a step in the direction of a supergradient d(λ) = x y. 6

Start with λ = 0 repeat Update x and y by evaluating g(λ) λ λ + τ(x y). for some τ until x = y Here, in each iteration k, a step size τ needs to be chosen. The simplest way of doing this and still ensuring convergence is to pick τ = T/k, with T a constant [11]. During the maximization of the dual function, we have access to a lower bound d(λ) of the optimal energy, and also to two feasible solutions x and y of the original problem. An upper bound on the optimal energy is then given by min(e(x), E(y)). We can compute the relative duality gap which gives an indication of how close we are to the optimal energy: r = min(e(x), E(y)) d(λ). (4) min(e(x), E(y)) If X is a convex set and E a convex function, the optimal duality gap is zero. However, in this paper we consider non-convex sets consisting of a finite set of points with integral coordinates. In our first application we are nonetheless guaranteed an optimal gap of zero as it corresponds to solving an integer linear program whose linear programming relaxation represents the convex hull of the feasible integral solutions. 3.1. Decomposition into multiple parts Naturally, dual decomposition can be used to decompose E into more than two parts: E(x) = E 1 (x (1) ) +... + E m (x (m) ). (5) The decomposed problem analogous to (1) then becomes a minimization of the sum of the m functions, subject to constraints x (i) = x (j) for all i, j. These constraints are each associated with a dual variable. 4. Decomposition of graph cuts Our first application of dual decomposition is a parallel algorithm for computing the minimum cut in a grid graph. We start this section by describing how the graph is split and how the dual variables enter the two subgraphs. This is followed by extensive experiments for graphs in 2, 3 and 4 7

dimensions, both multi-threaded and distributed across many computational nodes in a supercomputer. 4.1. Graph cuts as a linear program Finding the maximum flow, or, by duality, the minimum cut in a graph can be formulated as a linear program. Let G = (V, c) be a graph where V = {s, t} {1, 2,..., n} are the source, sink and vertices, respectively, and c the non-negative edge costs. A cut is a partition S, T of V such that s S and t T. The minimum cut problem is finding the partition where the sum of all costs of edges between the two sets is minimal. It can be formulated as minimize x c i,j x i,j i,j V subject to x i,j + x i x j 0, i, j V x s = 0, x t = 1, x 0. The variable x i indicates whether vertex i is part of S or T (x i = 0 or 1, respectively) and x i,j indicates whether the edge (i, j) is cut or not. The variables are not constrained to be 0 or 1, but there always exists one such solution, according to the duality between maximum flow and minimum cut. We write D V for the convex set defined by the constraints in (6). 4.2. Splitting the graph Now pick two sets M and N such that M N = V and {s, t} M N. We assume that when i M \ N and j N \ M, c i,j = c j,i = 0. That is, every edge is either within M or N, or within both. See Fig. 1. We now observe that the objective function in (6) can be rewritten as: c i,j x i,j = c i,j x i,j + c i,j x i,j c i,j x i,j. (7) i,j V i,j M i,j N i,j M N (6) Define E M (x) = i,j M E N (y) = i,j N c i,j x i,j 1 2 c i,j y i,j 1 2 c i,j x i,j i,j M N i,j M N c i,j y i,j. (8) 8

5 1 2 s 5 2 1 2 1 1 1 1 1 0 1 2 t (a) Convention for this figure. Numbers inside the nodes indicate s/t connections, positive for s, negative for t. 1 1 1 1 2 1 3 1 1 1 2 1 2 1 1 2 1 1 1 1 1 1 1 0 2 1 1 1 2 1 2 1 1 1 3 2 0 1 2 1 1 1 1 0 1 1 3 0 2 1 3 (b) Original graph. 1 1 1 1 1 1 1+λ 1 2 2 1 1 1 1 2 +λ 2 2 1 1 1 2 2 1 1 1 3 1 1 1 1 2 +λ 3 3 2 1 1 0 1 1 2 +λ 4 1 λ 1 1 3 1 1 1 1 1 1 1 2 λ 1 2 1 1 0 1 2 3 2 λ 2 3 0 1 2 3 2 1 2 λ 3 4 0 2 1 2 1 1 1 (c) Subproblems with vertices in M and N, respectively. Figure 1: The graph decomposition into sets M and N. The pairwise energies in M N are part of both E M and E N and has to be weighted by 1 2. Four dual variables λ 1... λ 4 are introduced as s/t connections. 9

This leads to the following equivalent linear program: minimize x D M E M (x) + E N (y) y D N subject to x i = y i, i M N. (9) Here x is the variable belonging to the set M (left in Fig. 1c) and y belongs to N. The two variables x and y are constrained to be equal in the overlap. The Lagrange dual function of this optimization problem is: d(λ) = min x D M y D N ( = min x D M ( + min y D N ( E M (x) + E N (y) + E M (x) + E N (y) i M N i M N i M N λ i x i ) λ i y i ). λ i (x i y i ) ) (10) We now see that evaluating the dual function d amounts to solving two independent minimum cut problems. The extra unary terms λ i x i are shown in Fig. 1c. Let x, y be the solution to (9) and let λ maximize d. Because strong duality holds, we have d(λ ) = E M (x ) + E N (y ) [11]. Each subproblem may in general have multiple solutions, so to obtain a unique solution we always set our optimal x i and y i equal to 1, wherever possible. Splitting a graph into more than two components can be achieved with the same approach. The energy functions analogous to (8) might then contain terms weighted by 1/4 and 1/8, depending on the geometry of the split. See Fig. 2. 4.3. Implementation Solving the original problem (9) amounts to finding the maximum value of the dual function. It follows from Lemma 1 that x i y i, for i M N, is a supergradient to g. In order to maximize d, the iterative scheme described in Section 3 can be used. This scheme requires the dual function to be evaluated many times. To make this efficient we reuse the search trees as described in [12]. Only a small part of the cost coefficients is changed between iterations 10

(a) 2 2 (b) 2 2 2 Figure 2: Splitting a graph into several components. The blue, green and red parts are weighted by 1/2, 1/4 and 1/8, respectively. and our experiments show that the subsequent max-flow computations can be completed within microseconds, see Table 1. The step size τ needs to be chosen in each iteration. One possible choice is τ = 1/k, where k is the current iteration number. For this particular application, we have found that this scheme and others appearing in the literature [8, 11] are a bit too conservative for our purposes. Instead of using a single step length τ, we associate each vertex in the overlap with its own step length τ i. This is because different parts of the graph behave in different ways. In each iteration, we ideally want to choose λ i so that x i = y i ; therefore, if x i y i changed sign, then the step length was too large and we should move in the opposite direction with a reduced step length. foreach i M N do if x i y i 0 then λ i λ i + τ i (x i y i ) if x i y i previous difference then τ i τ i /2 end end end To handle cases like the one shown in Fig. 8, we also increase the step length if nothing happens between iterations. Empirical tests show that keeping an individual step length improves convergence speed for all graphs 11

s 1 1 1 1 1 (a) Original graph 1 t s 1 1 1 λ t (b) Left part s λ 1 1 1 t (c) Right part Figure 3: Convergence problem. The original graph (a) has multiple solutions, i.e., multiple minimum cuts. If λ 1, the solutions for the two graphs (b) and (c) will not agree. we tried. The extra memory requirements are insignificant. Convergence. Some graphs may have problems reaching the optimal solution. This can occur for graphs admitting multiple solutions. Fig. 3 shows an illustrative example. While the proposed scheme will converge toward λ = 1 for this graph, it will not reach it in a finite number of iterations. If λ 1, the two partial solutions will not agree for the vertex marked black. In practice, we observed this phenomenon for a few pixels when processing large graphs with integer costs. One possible solution is to add small, positive, random numbers to the edge costs of the graph. If the graph only has integer costs, this is not a problem. Increasing edge costs only increases the maximum flow, so the global maximum flow in the original graph is the integer part of the flow in the modified graph provided the sum of all values added is less than 1. However, there is an alternative way of handling graphs with integer costs. Theorem 2. If all the edge costs c i,j are even integers, then there is an integer vector λ maximizing the dual function (10). Proof. The constraint sets D M and D N in (9) can be described by Az b, where A is an (integer) matrix, z = [ x T y T ] T and b is an (integer) vector. 12

Therefore, the optimization problem (9) can be written as: minimize z subject to a T z Az b x i y i = 0, i M N. z 0. (11) Here, a is an integral vector describing the objective function in (9). We also write Bz = 0 for the equality constraints. Forming the dual function, we get: d(w, λ) = min z { a T z + w T (b Az) + λ T Bz }. The dual is also a linear program, maximize w,λ subject to b T w A T w + B T λ a w 0. (12) Since A is totally unimodular (TUM) (c.f. [33, Section 13.2]), so is A T. Also B is TUM and a is integral, and thus the dual function d has an integer optimum (w, λ ). Since we have d(λ) = max w 0 d(w, λ), we are done. Remark. The theorem does not necessarily hold if the costs are integers. The graph s 1 1 t, split at the second node, provides a counterexample. The subproblems are s 1 but d(1/2) = 1. 1/2+λ t and s λ 1/2 t. We have d(0) = d(1) = 1/2, For a general graph with integer costs split into two pieces, we multiply each edge by 2 and obtain an equivalent problem with an integer maximizer λ. It is then guaranteed that the problem is solvable in integer arithmetic. The graph may be split in more than two pieces in such a way that smaller costs than 1/2 are used, as in Fig. 2. When setting up these problems we multiply every cost by 4 and 8, respectively, to ensure integer maximizers. 4.4. Experiments on a single machine In this section we describe experiments performed in parallel on a single machine executed across multiple threads. We used the BK-method (v3.0 13

available for download) both for the single-threaded experiments and for solving the subproblems. All timings of the multi-threaded algorithm include any overhead associated with starting and stopping threads, allocation of extra memory etc. In all experiments we have only considered the time for actual maximum flow calculations, which means that the time required to construct the graphs is not taken into account. We note, however, that graph construction trivially benefits from parallel processing. Image segmentation. We applied our parallel method for the 301 images in the Berkeley segmentation database [34], see Fig. 6 for examples. The segmentation model used was a piecewise constant model (the pixel values were normalized to [0, 1]) with the boundary length as a regulating term: E(x) = µ w ij x i x j + ( x i (I i c 1 ) 2 (I i c 0 ) ). 2 (13) i j N (i) i The boundary length is here approximated using a neighborhood N (i) of edges around each pixel, usually of sizes 4, 8 or 16 in the two-dimensional case. See [35, 36] for details on how to choose w ij. The overall influence of the boundary length is specified with the parameter µ, where larger values usually correspond to harder optimization problems (longer s/t paths). The two constants c 1 and c 0 specify the intensity of the foreground and background. They were estimated in an alternating EM fashion (by sequentially estimating the optimal constants and the optimal segmentation until convergence) for each image separately before the experiments. The relative times (t multi-thread /t single ) using two computational threads are shown in Figs. 4 and 5. Since the images in the database are quite small, the total processing time for a single image is around 10 milliseconds. Even with the overhead of creating threads and iterating to find the global minimum, we were able to get a significant speed improvement for almost all images. Table 1 shows how the processing time varies with each iteration. In the last steps, very few vertices change and solving the maximum flow problems can therefore be done very quickly within microseconds. It is very important to note that the problem complexity depends heavily on the amount of regularization used. That is, segmentation problems with low penalties on boundary length are easy to solve and parallelize. In the extreme case where no regularization is used, the problem reduces to simple thresholding, which of course is trivial to parallelize. Therefore, it is relevant 14

Iteration 1 2 3 4 5 6 7 8 9 10 11 Differences 108 105 30 33 16 16 16 16 9 9 0 Time (ms) 245 1.5 1.2 0.1 0.08 0.09 0.07 0.15 0.06 0.07 0.47 Table 1: The processing time for each iteration for a 1152 1536 example image (shown in Fig. 7). The number of overlapping pixels (M N) was 1536 (one column). Deallocating memory and terminating threads is the cause of the processing time increase in the last iteration. Note the short processing times after the first iteration due to the reuse of search trees. Figure 4: Relative times with 2 (red) and 4 (dotted blue) computational threads for the 301 images in the Berkeley segmentation database, using 4-connectivity. The medians are 0.596 and 0.455. to investigate how the algorithm performs with different amounts of regularization. We have done this and can conclude that our graph decomposition scheme performs well for a wide range of different settings, see Fig. 7. We see that the relative improvement in speed remains roughly constant over a large interval of different regularizations, whereas the absolute processing times vary by an order of magnitude. When the number of computational threads increase, the computation times decrease as shown in Fig. 4. Stereo problems. The Tsukuba dataset (which we obtained from [37]) consists of a sequence of max-flow instances corresponding to the first iteration of α-expansions [3]. First, we solved the 16 problems without any parallelization and then, with two computational threads. The relative times ranged from 0.51 to 0.72, with the average being 0.61. 15

Frequency 60 40 20 0.25 0.5 0.75 1 1.25 Relative time Figure 5: Relative times using 8-connectivity and 2 computational threads. The median is 0.628. Relative speed Figure 6: Examples from the Berkeley database [34]. µ Figure 7: Relative improvement in speed for a single image with two computational threads when the regularization parameter changes. Although the processing time ranged from 230 ms to 4 seconds, the relative improvement was not affected. 16

Figure 8: Worst-case test. The left and right side of the image is connected to the source and sink, respectively. The edge costs are determined by the image gradient. All flow must be communicated between the two computational threads when splitting the graph vertically. Three-dimensional graphs. We used the graph construction described in [5] with data downloaded from [37] to evaluate the algorithm in three dimensions. For the bunny dataset from [37] the relative time was 0.67 with two computational threads. Limitations. We have tried to explore the limitations of the method by examining cases with (i) poor splits and (ii) poor speed-ups. To see how our algorithm performs when the choice of split is very poor, we took a familiar image and split it in half from top to bottom as depicted in Fig. 8. We attached the leftmost pixel column to the source and the rightmost to the sink. Splitting horizontally would have been much more preferable, since splitting vertically severs every possible s-t path and all flow has to be communicated between the threads. Still, the parallel approach finished processing the graph 30% faster than the single-threaded approach. This is a good indication that the choice of the split is not crucial. Figs. 4 and 5 contain a few examples (< 1%) where the multi-threaded algorithm actually performs slower or almost the same as the single-threaded algorithm. The single example in Fig. 4 is interesting, because solving one of the subgraphs once takes significantly longer than solving the entire original graph. This can happen for the BK algorithm, but is very uncommon in practice. We have noted that slightly perturbing any of the problem parameters (regularization, image model, split position etc.) makes the multi-threaded algorithm faster also for this example. The other slow examples have a simpler explanation: there is simply nothing interesting going on in one of the two halves of the graph, see e.g. the first image in Fig. 6. Therefore, the overhead of creating and deallocating 17

Figure 9: Splitting a graph across many computers. Colors indicate nodes that should be equal. the threads and extra memory gives the multi-threaded algorithm a slight disadvantage. The approach in [17] (using smaller pieces) is better suitable for these graphs. 4.5. Splitting across different machines We now turn to another application of graph decomposition. Instead of assigning each part of the graph to a computational thread, one may assign each subgraph to a different machine and let the machines communicate the flow over a network. Fig. 9 shows a diagram of the setup. Memory is often a limiting factor for maximum flow calculations. Using splitting we were able to segment 4-dimensional (space+time) MRI heart data with 95 98 30 19 = 5.3M voxels. The connectivity used was 80, requiring 12.3 GB memory for the graph representation. By dividing this graph among 4 (2-by-2) different machines and using MPI [38] for communication, we were able to solve this graph in 1980 seconds. Since only a small amount of data (54 kb in this case) needs to be transmitted between machines each iteration, 18

this is an efficient way of processing large graphs. On the system we used 1, the communication time was about 7-10 ms per iteration, for a total of 68 iterations until convergence. We also evaluated the algorithms for some of the big problems available at [37]. The largest version of the bunny dataset is 401 396 312 = 50M with 300M edges was solved in 7 seconds across 4 machines. As a reference, a slightly larger version of the same dataset (not publicly available) was solved in over a minute with an (iterative) touch-and-expand approach in [5]. The largest data set we used was a 512 512 2317 = 607M voxel CT scan with 6-connectivity. Storing this graph required 131 GB of memory divided among 36 (3 3 4) machines. We are not aware of any previous methods designed to handle graphs of this magnitude. The regularization used was low, which ensured convergence in 38 seconds with fairly even load distribution. Even with low regularization, the computation required 327 iterations. Splitting graphs across multiple machines also saves computation time, even though the MPI introduces some overhead. For the small version of the bunny dataset, a single machine solved the problem in 268 milliseconds, while two machines used 152 ms. Four machines (2-by-2) required 105 ms. For the medium sized version the elapsed times were 2.3, 1.34 and 0.84 seconds, respectively. It should be noted that in many cases the BK algorithm is not the fastest possible choice, especially for graphs with higher dimensionality than 2 and connectivity greater than the minimum [2]. However, the method described in this paper could just as easily be combined with a push-relabel algorithm better suited for graphs with 3 or 4 dimensions. Using a method optimized for grid graphs with fixed connectivity instead of the general BK would also reduce memory requirements significantly. 5. Decomposition of general MRFs We now turn to multi-label segmentation problems. The goal is to use dual decomposition for a highly parallel algorithm which can be run on hardware such as a field-programmable gate array (FPGA) or a graphics processing 1 LUNARC Iris, http://www.lunarc.lu.se/systems/irisdetails 19

unit (GPU). The energy function we want to minimize is E(x) = n T i (x i ) + i=1 n i=1 j N i E ij (x i, x j ), (14) where x L = {1... L} n and the functions T i and E ij are arbitrary. T i (y) denotes the cost of assigning label y to node i and E ij (y, z) is the cost of jointly assigning labels y and z to nodes i and j. The set N i is the neighborhood of i, that is, all nodes that are directly dependent on i. This paper focuses on the 4-connectivity, but our ideas readily carry over to higher connectivities. While this section does not offer any new deep theoretical insights, we offer a practical way to parallelize previous approaches with good performance. Our method uses dual decomposition and dynamic programming similar to [8], but our subproblems are simpler and therefore easily implemented on massively parallel architectures. The potential for parallelization was not explored in [8] and we show that these methods are useful to greatly increase the speed to algorithms for which other fast methods already are available, such as submodular minimum cut problems [2]. 5.1. Splitting the graph We now describe a way of actually splitting our energy function E in (14). The approach is simple: instead of considering a single graph, we consider two graphs, one of which contains all vertical connections and one contains all horizontal connections. The two new energy functions are E 1 (x) = 1 2 E 2 (x) = 1 2 n n T i (x i ) + E ij (x i, x j ), i=1 j H i n n T i (x i ) + E ij (x i, x j ), i=1 j V i i=1 i=1 (15) where H i and V i denotes the horizontal and vertical neighbors of i, respectively. The factor 1/2 is needed to have E(x) = E 1 (x) + E 2 (x). Figure 10 illustrates this splitting of the energy function. Not only are the two subproblems in (2) independent, but each also consists of many one-dimensional subproblems, completely independent of each other. Such (acyclic) one-dimensional problems can always be solved exactly in polynomial time using dynamic programming. 20

= Figure 10: The graph decomposition. An edge between two nodes i and j indicate that j N i so that the two nodes are directly dependent upon each other. Note that the two subproblems each consists of many independent one-dimensional problems. 5.2. Dynamic programming It is well-known that one-dimensional energy functions of the type (14) can be minimized exactly. We want to minimize E(x) = n n 1 T i (x i ) + E i (x i, x i+1 ), (16) i=1 where x L = {1... L} n and the functions T i and E i are arbitrary. T i (y) denotes the cost of assigning label y to node i and E i (y, z) is the cost of jointly assigning labels y and z to nodes i and i + 1. To solve this problem, we define C k (x) to mean be the lowest energy we are able to get if we assign x k = x and only count all nodes up to k, i.e. ( k ) k 1 C k (y) min T i (x i ) + E i (x i, x i+1 ). (17) x 1...x k =y i=1 The following lemmas describe how to compute C k (y) recursively over k. The technique is well-known, see e.g. [39]. Lemma 3. { T1 (y) k = 1 C k (y) = ) T k (y) + min z L (C k 1 (z) + E k 1 (z, y) k > 1. Lemma 3 gives an algorithm to efficiently compute C k (y) for all nodes k and labels y. An optimal labeling x can be extracted from this information. Assigning the optimal label to x k can be done given x k+1 : 21 i=1 i=1

Lemma 4. arg min x y L k = arg min y L C n (y) C k (y) + E k (y, x k+1 ). k = n k < n 5.3. Binary formulation and updating of weights The problem formulation of minimizing (14) such that x L imposes an ordering on the labels. This is because a subgradient to d is (x (1) x (2) ) and this difference depends on the numerical values of the labels. To avoid this, we reformulate the optimization problem as a boolean problem: Ē( x) = n x l,i T i (l) + i=1 l L n x l1,i x l2,j E ij (l 1, l 2 ), (18) i=1 j N i l 1 L l 2 L where now x l,i {0, 1} and x l,i = 1 x i = l. Minimizing Ē is clearly seen to be equivalent to minimizing E. The constraint x (1) = x (2) is reformulated as x (1) l = x (2) l, l L and each of these is associated with a dual variable λ l. The subgradient is according to Lemma 1 ( d( λ 1,..., λ l )) l,i = x (1) l,i x(2) l,i. (19) If the two solutions disagree for node i, the dual variables will then have to be updated accordingly: 1 x (1) λ l,i λ l,i = 1 l,i + τ 1 x (2) l,i = 1 (20) 0 otherwise, where τ is the step length for the current iteration. If the two solutions agree for node i, no update is performed for i. Since the dual variables enter as multiplicative constants in front of {0, 1}-variables, adding a number c to λ l,i is equivalent to adding c to T i (l). Therefore, the dual variables need not be stored explicitly and the data terms are instead modified directly. 5.4. Step lengths The step length rule we found to work best in practice was τ 1/k, where k is the iteration number. To allow for data terms of different magnitudes, we 22

normalized the step lengths to τ = m/(3k), where m is the maximum value of the data terms. If the data terms contain hard constraints with infinite cost weights, these will have to be excluded. A number of more sophisticated step size rules are described in [11]. We tested the primal-dual based rule used in [8], but in our context it was inferior to the previously described rule. 5.5. Experiments All experiments on the CPU were performed with an Intel Core2 Quad 2.5GHz processor (using a single core only) and for the GPU experiments we used an nvidia Tesla 2050. We stopped iteration when the computed duality gap was smaller than 0.001. The primal energy was computed every 5 iterations. Results are given for the standard Potts model for which the regularizer is simply { ρ l 1 l 2 E ij (l 1, l 2 ) =. (21) 0 l 1 = l 2 If the number of labels is L = 2, the exact solution can be computed as the minimum cut in an appropriate graph. If L 3, we compare our method to two approximate methods: α-expansion [2, 6, 7] and FastPD [9]. The results are given in Tables 2 4 as well as Figures 11 13. We tried comparing to CUDAcuts [20], but the publicly available algorithm did not give the correct solution for any of the problems in Fig. 11. For ρ = 10 5 and 10 6 the algorithm produced a constant image. The are other methods available, e.g. TRW-S which we have not included. Instead, we refer to other publications [40, 41]. For the three-class experiments (Table 4 and Fig. 13) we created the data terms by estimating a Gaussian mixture model using the standard expectation maximization algorithm. However, since the figures in Tables 3 and 4 do not exploit the possibility of massive parallelization, making dual decomposition a very attractive alternative, provided that the architecture can support the execution of many dynamic programming threads. We also note that unlike the previous section (Fig. 7), we only observe a speed-up mainly for problems where the amount of regularization is high. When the number of labels increases, the time until convergence increases drastically. This is illustrated in Fig. 12. Furthermore, for general energies, the processing time required for a single iteration increases quadratically with 23

ρ Min-cut time (s) CPU time (s) rel. duality gap iterations GPU time (s) 10 4 0.0108 0.0691 0.00024 71 0.042 10 5 0.0204 0.0166 0.00017 16 0.01 10 6 0.4973 0.0330 0.00046 26 0.017 Table 2: Binary segmentation results for the cameraman image, Figure 11. We compared the minimum cut algorithm [2] (v.3.01) to a CPU and GPU implementation of the algorithm described in this paper. The duality gap is computed from the best of the row and column solution. We note that the dual decomposition algorithm seems to perform best using high regularizations. µ Number of images CPU Relative speed CPU Absolute time (s) Min. Median Max. Median 0.15 300 0.45 3.99 9.13 0.0120 0.77 293 0.43 2.50 8.69 0.0240 1.54 279 0.35 1.55 4.18 0.0373 7.69 163 0.07 0.31 1.77 0.1548 15.38 95 0.04 0.13 0.77 0.3483 Table 3: Binary segmentation results using (13) for the images in the Berkeley segmentation data set (CPU, single thread). If the result was a trivial (constant) segmentation, we excluded that image, hence the lower number of images for higher regularization. Two facts can be seen from these figures: (i) that higher regularization results in far more difficult problems and that (ii) the row/column decomposition performs much better for those problems and those problems only. the number of labels. These two facts make the method unattractive for a large number of labels and inferior to e.g. α-expansion. 6. Decomposition of curvature linear programs Whereas graph cuts can approximate the length of the segmentation boundary with great accuracy, in many applications it is desired to use the curvature as a regulating term. This problem was recently formulated as an integer linear program by Schoenemann et al. [14] and it was shown that the linear programming relaxation often gives very good solutions which sometimes even correspond to the global optimum. Solving the linear programs requires 24

Figure 11: Binary segmentation with different regularizations ρ {10 4, 10 5, 10 6 }. See Table 2. Figure 12: Result using the Potts model with 64 labels. To the left the solution obtained by α-expansion is shown, followed by the row and column solutions of Fig. 10 after 500 iterations. Running 10000 iterations did not improve the solutions significantly. µ Decomposition (s) FastPD (s) α-expansion (s) Min. Med. Max. Min. Med. Max. Min. Med. Max. 2 0.02 0.27 3.06 0.13 0.15 0.33 0.22 0.34 0.76 10 0.04 0.27 2.93 0.13 0.16 0.39 0.22 0.38 1.08 100 0.02 0.23 4.15 0.14 0.32 1.46 0.16 0.64 2.67 Table 4: Multi-label segmentation with the Potts model for the 300 images in the Berkeley data set. All three methods produced virtually indistinguishable results. The decomposition method was run single-threadedly, i.e. the possibility of massive parallelization was not used. 25

Figure 13: Three-class example. Top row: Original image and segmentations with the Potts model for different regularizations µ {2, 10, 100}, respectively. Bottom row: data terms. See Table 4. Figure 14: Each pixel is subdivided into regions, separated by edges. a huge amount of memory however, and we show in this section how to use dual decomposition to reduce the memory requirements. We begin with a brief review of the algorithm from [14]. The problem we are interested in solving amounts to minimizing the following energy functional: E(R) = g(x) dx + µ Γ + ν κ Γ (x) 2 dh 1 (x), (22) R where R is the foreground with boundary Γ = R of length Γ and κ Γ is the curvature of Γ. The method is based on partitioning the image domain into a so-called cell complex, a collection of non-overlapping basic regions whose union gives 26 Γ

the original domain. As illustrated in Figure 14, each pixel is subdivided into several regions, where the number depends on the desired connectivity. When using a 4-connectivity each pixel is one region, and to mimic 8-connectivity, pixels are subdivided into four regions each. The boundaries of regions are called edges. For the approach it is necessary to consider both possible orientations of each edge. An oriented edge is called a line in the following. In the integer linear program, there are two sets of binary variables, one reflecting regions and the other related to boundaries. For each basic region, a binary variable indicates whether the region belongs to the foreground or the background. The region integral in (22) is now easily integrated into the linear objective function. The boundary costs are more intricate: here the approach follows the popular trend [42 44] to consider pairs of (consistently oriented) adjacent lines, with a binary variable for each of them. The boundary costs can then also be written as a linear function. It would actually suffice to consider region variables only one, as these uniquely determine the desired boundary variables. However, the arising cost function would no longer be linear. Instead, consistency of the binary sets is constrained in terms of a linear equation system, containing two kinds of constraints. We skip the precise mathematical formulation as it is given in [14]. Instead we give an intuitive explanation for each of the two sets of constraints. Surface continuation constraints. Assume we know that a basic region is part of the foreground. Then, for each of its edges we can have two valid configurations: either the associated basic region on the other side of the edge is also part of the foreground - or the foreground regions terminates here in an appropriately oriented boundary element (actually a pair of lines). These constraints, together with the cases where the considered basic region is background, can be phrased as a linear equation system, with one constraint for each edge. Boundary continuation constraints. The other set of constraints affects the pairs of boundary lines. If we allowed the program to place any pair of line segments at a certain place in the boundary of the foreground region, the program would put straight lines everywhere. What is really wanted, though, is that both lines in the pair belong to the actual boundary line. This can easily be put into the following constraint: if a pair of line segments (l 1, l 2 ) is part of the boundary line, there must be another pair of 27

Figure 15: Left and right part of the split domain. The thick, solid edge is weighted by 1 in the left part and 0 in the right part. The dashed edge is weighted by 1/2 in both part. The arrow is only present in the right part and is weighted by 0 and 1 in the left and right part, respectively. line segments (l 2, l 3 ) that is also part of the boundary line. Furthermore, there must be a pair (l 0, l 1 ) that likewise belongs to the boundary line. Again, these constraints can be phrased as a linear equation system. 6.1. Splitting the domain Just as in the previous section on graph cuts, we split the domain across a pixel column, which is duplicated. Each pixel consists of several regions and each one is constrained to be equal to its copy in the other subproblem with dual variables. The data term for each region is divided by two and each of the two subproblems gets one part. The boundary continuation constraints described above assume that the boundary of the segmented region does not have any endpoints (of course, it does not have to be connected). We would like our subproblems to behave in the same way in order to be able to use the same solver for the subproblems as for the original problem. A specialized solver for the original problem must be able to solve the subproblems as well. Therefore, some care has to be taken to make sure all edge pairs are counted the correct number of times in and around the overlap. Fig. 15 shows some cases where edges in the overlap are assigned different weights in different parts. It is easy to test if the split 28

has been made correctly. The sum of the minimal energies in the left and right part has to match the minimal energy of the original problem exactly. The solutions to the two problems are constrained to be equal for all overlapping regions. We use the exact same updating scheme as described in Section 4.3 for graph cuts. 6.2. Experiments For our curvature experiments we consider binary segmentation of the cameraman image. The image was normalized to the interval [0, 1] and the functional (22) was minimized with the data term g(x) = (I(x) max I) 2 (I(x) min I) 2. (23) The curvature regularization weight was always equal to 1, with the length weight varying between 0.1 and 1, as shown in Table 5 and Fig. 16. We used the dual simplex method in the Clp package [45], as suggested by [14] which clearly outperformed other free solvers available. The image size was 256 256 and we were not able to solve the resulting LP as the solver ran out of memory 2 and terminated. As shown in Table 5, the peak memory requirements when the problem was decomposed into two parts is still high, but well within the capabilities of our test system (< 1GB). To be able to compare the difference in peak memory usage, we also ran experiments for a reduced 128 128 image and the memory reduction with dual decomposition was reduced significantly, see Table 6. The achieved memory reduction was slightly less than 50% since the intermediate states of the solvers are stored between iterations to increase execution speed. 7. Conclusions We have shown that it is possible to split a graph and obtain the global maximum flow by iteratively solving subproblems in parallel. Two applications of this technique were demonstrated: ˆ Faster maximum flow computations when multiple CPU cores are available (Section 4.4). 2 The solver was compiled as a 32-bit binary. 29

(a) Thresholded data term (b) µ=1 (c) µ=0.5 (d) µ=0.1 Figure 16: Segmentation of the 256 256 cameraman image for various amounts of length regularization. The curvature regularization used was ν = 1. Iterations Left time (s) Right time (s) Peak memory usage (MB) µ = 1 23 321 398 963 µ = 0.5 100(*) 594 756 962 µ = 0.1 100(*) 1023 1245 963 Table 5: Number of iterations and running times for various amounts of length regularization. The curvature regularization used was ν = 1. (*) We only ran the algorithm to a maximum of 100 iterations. At this point there were only 1-3 disagreements on the overlap. This is not a problem since the LP-relaxation is an approximation in itself and the duality gap of our decomposition was very small. Peak memory usage (MB) Original problem 468 Dual decomposition (2 parts) 279 Table 6: Peak memory usage for a reduced version of the cameraman image (128 128). The reduction not as good as 50% because the solvers cache the solutions and system matrices between iterations. 30

ˆ The ability to handle graphs which are too big to fit in the computer s RAM, by splitting the graph across multiple machines (Section 4.5). This is in contrast to other approaches [16, 17] where shared memory is required. Good results were demonstrated even if the split severs many, or even all s-t paths of the graph (Fig. 8). Experiments with different amounts of regularization suggest that the speed-up is relatively insensitive to regularization (Fig. 7). The technique was applied to different graphs arising in computer vision. Our experiments included surface reconstruction, stereo estimation and image segmentation with two, three and four dimensional data. Methods based on push-relabel generally perform better than BK for large, high dimensional and highly connected graphs as discussed in [2]. Therefore, using our approach with push-relabel should be investigated in the future. The method of splitting the graph used in Section 4 is not suitable for massive parallelization. If a lot of parallelism is desired, the graph needs to be split in another way, preserving some of the long paths of the original graph. In Section 5 such a decomposition is proposed, with the additional benefit of being able to find approximate solutions for arbitrary energies of number of labels. While the idea of tree decompositions is not new, the possibilities for parallelism and GPU implementation have not been previously investigated. However, we conclude that in general, GPU parallelization of minimum cut algorithms for vision is still an unsolved problem. Implementing the dynamic programming schemes discussed on a massively parallel architecture is non-trivial. Yet another application of dual decomposition is to reduce the memory requirements of the linear programs arising in problems with curvature regularity, see Section 6. We have demonstrated significant memory reductions which make larger problems tractable. Acknowledgments This work has been funded by the Swedish Research Council (grant no. 2007-6476), by the Swedish Foundation for Strategic Research (SSF) through the programme Future Research Leaders, and by the European Research Council (GlobalVision grant no. 209480). We thank Einar Heiberg and Jane Sjögren for sharing the MRI and CT data sets. 31