solution to the optimization problem:
minimize f(Dx − b) + r(x),
(1)
where
f
is an error metric, and
r
is a penalty function that expresses
prior knowledge about the image x.
There are many reasonable choices for
f
and
r
. For instance, we
might define
f
as a sum-of-squares error, a Huber loss, or a Poisson
penalty. The penalty function
r
could be a constraint on the range of
the values of
x
, a sparsity-inducing penalty such as total-variation, a
non-local patch prior as in the BM3D-based reconstruction shown
in [Danielyan et al. 2012], or a combination of all these penalties.
Once we have chosen f and r, we must choose an algorithm to use
for solving the optimization problem. Dozens of different optimiza-
tion algorithms have been applied to image optimization problems,
such as the alternating direction method of multipliers (ADMM)
[Boyd et al
.
2011], the primal-dual algorithm by Chambolle and
Pock [2011], and half-quadratic splitting [Geman and Yang 1995].
Moreover, for each algorithm there may be many ways to translate
Problem
(1)
into that algorithm’s standard form. The only way to
know which algorithm and translation into standard form works best
for a problem is to try all of them.
Finding an effective image optimization method thus requires ex-
ploring a large space of problem formulations, algorithms, and trans-
lations between standard forms. Currently, researchers must develop
a new solver implementation for each point they explore in the space,
which is a time-consuming and error-prone process. Developing
implementations is particularly challenging for image optimization
problems since these problems typically involve millions of variables
and can only be solved efficiently by exploiting problem structure.
In this paper, we address these challenges by introducing ProxImaL,
a domain-specific language (DSL) for image optimization. The
ProxImaL language allows users to describe image optimization
problems in a few lines of code using an intuitive syntax that follows
the math. Users write their problem using a fixed set of mathematical
functions, whose structure can be exploited to generate an efficient
solver. Most functions that occur in image optimization problems
are included in the language, and it is easy to add support for more.
Compositions of functions are limited by a set of simple rules that
ensure the problems constructed by the user match our standard
mathematical representation.
The ProxImaL compiler takes the user’s problem description and
choice of algorithm and automatically generates a solver imple-
mentation. The compiler considers a wide range of possible solver
implementations and selects one based on expert knowledge about
how to best formulate problems for the chosen solver algorithm. The
user can also easily override the compiler’s default choice to try out
more implementations. The solver implementations generated by
the compiler are highly efficient because we created optimized code
for the core mathematical operations using Halide [Ragan-Kelley
et al. 2013].
We demonstrate the utility of ProxImaL through applications to
the image processing pipeline, burst photography and denoising,
deconvolution, and phase retrieval. In many cases a few lines of
ProxImaL code and the default solver implementation generated by
the ProxImaL compiler achieves state-of-the-art results, often with a
runtime under ten seconds.
We make the following contributions in this paper:
•
We developed a simple language and mathematical representa-
tion for image optimization problems that captures the problem
structure needed to generate an efficient solver.
•
We built a compiler that takes the user’s problem description
and choice of solver algorithm and automatically generates an
efficient solver, intelligently choosing from the many transla-
tions possible.
•
We show that our framework can achieve state-of-the-art res-
ults on a variety of image optimization problems while also
producing highly efficient solver implementations.
2 Related Work
Languages for Graphics and Image Processing
Domain-
specific languages for graphics and rendering have successfully
made the transition from research to industry standard [Foley and
Hanrahan 2011]. Today, general-purpose languages for GPU pro-
gramming, such as CUDA, are popular for many applications beyond
graphics. OpenCL extended this concept to heterogeneous comput-
ing platforms. Domain-specificity can be exploited to accelerate
the execution of common tasks in a particular domain, for example
in image processing [Ragan-Kelley et al
.
2013], physical simula-
tion [Bernstein et al
.
2015], or multi-material 3D printing [Vidimice
et al
.
2013]. Most of these languages and systems focus on finding a
domain-specific tradeoff between intuitive use and high-performance
execution. ProxImaL follows this strategy but we build on formal
optimization methods to develop a language and compiler for image
optimization.
Optimization for Image Processing
Over the past years, numer-
ical optimization has become a standard tool for solving a number
of classical restoration and reconstruction problems in computa-
tional photography. Examples include blind [Fergus et al
.
2006]
and non-blind [Krishnan and Fergus 2009; Joshi et al
.
2009] de-
convolution, image denoising [Zoran and Weiss 2011], and inpaint-
ing [Bertalmio et al
.
2000]. Optimization has been successfully
applied to image editing problems such as tonemapping [Fattal et al
.
2002], Poisson-blending [Levin et al
.
2004b] and colorization [Levin
et al
.
2004a]. Very efficient solvers have been developed for most
of these problems [Krishnan and Szeliski 2011; Schmidt and Roth
2014]. Optimization techniques are also becoming increasingly
popular solutions for scientific imaging problems such as x-ray
tomography [Sidky and Pan 2008] and phase retrieval [Tian and
Waller 2015]. Recently, it was shown that a large subset of low-level
image processing problems can be solved through a single proximal
algorithm framework [Heide et al. 2014].
Optimization and Optimization Languages
The literature on
algorithms for solving image optimization problems is extensive.
A particularly fruitful line of research has focused on solving con-
vex optimization problems using operator splitting methods and
proximal algorithms [Parikh and Boyd 2013]. Prominent examples
of such methods include the proximal point algorithm [Rockafel-
lar 1976], forward-backward splitting [Bruck 1975], the Pock-
Chambolle algorithm [Chambolle and Pock 2011; Pock et al
.
2009],
the split Bregman method [Goldstein and Osher 2009], ISTA and
FISTA [Beck and Teboulle 2009], the alternating direction method
of multipliers [Boyd et al
.
2011], PDHG [Esser et al
.
2010], and
half-quadratic splitting [Geman and Yang 1995]. Recent work has
applied these methods to nonconvex optimization problems and
found conditions that guarantee convergence (though not necessarily
to the global optimum); see, e.g., [Attouch et al
.
2011; M
¨
ollenhoff
et al. 2015; Li and Pong 2015].
DSLs for optimization have a long history, going back to GAMS
[Brooke et al
.
1988] in the 1970s, and including DSLs specialized for
convex optimization, such as CVX [Grant and Boyd 2014], YALMIP
[Lofberg 2004], CVXPY [Diamond and Boyd 2016b], and Convex.jl