]> git.rustad.me Git - prosjektoppgave/commitdiff
Almost done
authorBjørn Rustad <bjorn@rustad.me>
Tue, 10 Jun 2014 14:24:24 +0000 (16:24 +0200)
committerBjørn Rustad <bjorn@rustad.me>
Tue, 10 Jun 2014 14:24:24 +0000 (16:24 +0200)
cut.tex
pushrelabel.tex
results.tex
total.tex

diff --git a/cut.tex b/cut.tex
index 6f76169a01d133217abee9f10f9ce7ade9350de1..9fece7bdeaf9e903c99ad1d359fa59245974504e 100644 (file)
--- a/cut.tex
+++ b/cut.tex
@@ -124,7 +124,7 @@ them together to create a final network representing the total energy.
 
 Note that when we apply this theorem later, we will assume that all the
 summands of \eqref{eq:total_energy} have the whole picture as their
-domain. It is unproblematic to extend $E^x(u^\lambda_x)$ and
+domain. It is unproblematic to extend $E_\lambda^x(u^\lambda_x)$ and
 $E^{x,y}(u^\lambda_x, u^\lambda_y)$ such that they take all the pixels
 their argument and then ignore all pixels except the ones they actually
 depend on.
index 1f89abf91054d512abec5c3e9aac1ecadc706414..19d4535a1511e5f7e989d21ef04ee67fd4e5222f 100644 (file)
@@ -217,6 +217,10 @@ We will see later that with the gap relabeling heuristic, there will
 always be a gap at label $k = N - 1$ such that we can construct our cut
 by taking $S = \{ u \in V : d(u) \geq N \}$.
 
+Note that the vertices in $S$ are vertices earlier described as being on
+the source side of the cut, as no additional flow can go from these
+vertices to the sink.
+
 \subsection{Complexity}
 
 In their original article \cite{goldberg1988new}, Goldberg and Tarjan
@@ -295,7 +299,7 @@ reduce the total number of relabeling steps.
 The gap relabeling heuristic aims to find a label $k$ as in Theorem
 \ref{thm:cut_identification} such that no vertex has that label.
 From vertices $u$ with $d(u) > k$, there are no unsaturated edges going
-to vertices with smaller distance labels so no more flow can ever find
+to vertices with smaller distance labels, so no more flow can ever find
 its way from these vertices to the sink.  These vertices are therefore
 given the label $N$ and never considered again as they will never become
 active. Algorithm \ref{alg:gap} shows a pseudocode representation of
@@ -313,9 +317,13 @@ what is done once a gap $k$ is found.
 \label{alg:gap}
 \end{algorithm}
 
-But why does this work? The only thing we need to verify is that given a
-network with a valid preflow and a valid labeling, the gap relabeling
-procedure will not change the validity of these two things.
+Before integrating the gap relabeling procedure into our algorithm we
+need to verify that it does not invalidate our preflow $f$ or distance
+labeling $d$.
+
+%But why does this work? The only thing we need to verify is that given a
+%network with a valid preflow and a valid labeling, the gap relabeling
+%procedure will not change the validity of these two things.
 
 \begin{lemma}[Gap relabeling validity]
     Given a network $G = (V, E, c)$, a distance labeling $d$ and a
@@ -329,29 +337,27 @@ procedure will not change the validity of these two things.
     unchanged, so the preflow and capacity constraint remain satisfied
     after the gap relabeling.
 
-    Define the vertex sets $S = \{ u \in V : d(u) > k\}$ and $T = V -
-    S$. Initially, we have $d(u) \leq d(v) + 1$ for every edge $(u,v)
-    \in E_f$. These inequalities have to hold after the gap procedure is
-    finished, when all vertices $u \in S$ have label $d(u) = N$.
+    Define $S = \{ u \in V : d(u) > k\}$ and $T = V - S$. Initially
+    $d(u) \leq d(v) + 1$ for every edge $(u,v) \in E_f$. These
+    inequalities have to hold after the gap procedure is finished, when
+    $d(u) = N$ for all $u \in S$.
 
     For $(u, v) \in E_f$ we have four possibilities
     \begin{description}
-        \item[$u, v \in T$]
+        \item[$u, v \in T$\textmd{:}]
             The labels $d(u)$ and $d(v)$ remain unchanged and the
             inequality still holds.
-        \item[$u, v \in S$]
+        \item[$u, v \in S$\textmd{:}]
             After the gap procedure we have $d(u) = d(v)$ so the
             inequality still holds.
-        \item[$u \in S, v \in T$]
+        \item[$u \in S, v \in T$\textmd{:}]
             This is not possible as it would imply $d(u) \geq d(v) + 2$
             and we have assumed an initial valid labeling.
-        \item[$u \in T, v \in S$]
+        \item[$u \in T, v \in S$\textmd{:}]
             After relabeling we have $d(u) < k < N < d(v) + 1$.
     \end{description}
 
     Hence, both the preflow $f$ and distance labeling $d$ are valid.
-
-    \fixme{A bit too long compared to its interestingness/importance.}
 \end{proof}
 
 When running the push-relabel algorithm with the gap heuristic, we can
@@ -391,10 +397,10 @@ Going back to the network representations in Figure
 only the capacity of edges from sub-networks representing the fidelity
 term depend on our level parameter $\lambda$. From the expression in
 \eqref{eq:fidelity_energy0}, visualized in Figure
-\ref{fig:norm_evolution}, we see that the energy term $E^x(0)$ increases
-monotonically with increasing $\lambda$ parameter. Let $u, v \in V -
-\{s, t\}$. Since the edges in Figure \ref{fig:norm_subgraph} now are the
-only ones depending on $\lambda$, the following is true for
+\ref{fig:norm_evolution}, we see that the energy term $E_\lambda^x(0)$
+increases monotonically with increasing $\lambda$ parameter. Let $u, v
+\in V - \{s, t\}$. Since the edges in Figure \ref{fig:norm_subgraph} now
+are the only ones depending on $\lambda$, the following is true for
 \emph{decreasing} values of $\lambda$
 \begin{description}
     \item[Edges from $s$ to $u$]
@@ -414,7 +420,7 @@ After running the push-relabel algorithm for $\lambda = k$, we are left
 with a network $G = (V, E, c)$, a preflow $f$ and a labeling $d$. To
 obtain the network for $\lambda = k-1$ we have to change the capacity of
 two different kinds of edges, and this is done in the following way to
-keep the capacity and preflow constraints satisfied.
+keep the capacity, preflow and labeling constraints satisfied.
 \begin{description}
     \item[Edges from $s$ to $u$]
         The capacity $c(s, u)$ is increased, and the flow is set to be
@@ -446,27 +452,32 @@ Figure \ref{fig:img_decomp}. Because of the reuse of the distance labels
 between the iterations of the push-relabel algorithm, we can guarantee
 that this is possible.
 
-\fixme{More precise statement than ``stack on top of each other''}
-
 Consider two subsequent runs of the push-relabel algorithm, for labels
 $\lambda$ and $\lambda - 1$ ending with distance labels $d^\lambda$ and
 $d^{\lambda-1}$ respectively. We already know that the distance labels
-$d$ are monotonically increasing. This means that the set $\{ u \in V :
-d(u) \geq N \}$ is increasing in size, more precisely, we have the
+$d$ are monotonically increasing. This means that the set $S = \{ u \in
+V : d(u) \geq N \}$ is increasing in size, more precisely, we have the
 inclusion
 \begin{equation}
     \{ u \in V : d^\lambda(u) \geq N \} \subseteq \{ u \in V :
-    d^{\lambda-1}(u) \geq N \}
+    d^{\lambda-1}(u) \geq N \}.
+\end{equation}
+For a pixel $x \in S$ we will set $u^\lambda_x = 0$, which together with
+the previous inclusion property implies
+\begin{equation}
+    u^\lambda_x \geq u^{\lambda-1}_x
 \end{equation}
+for all $x \in \mathcal{G}$. Being equivalent with the inequality in
+\eqref{eq:stackable}, this means our algorithm produces stackable
+thresholded images $u^\lambda$.
 
 We then construct our output image $u$ by giving each pixel the value
 \begin{equation}
     u_x = \min \{ \lambda \in \{0, \ldots, L-1\} : u^\lambda_x = 1 \}.
 \end{equation}
 This marks the end of the description of the implemented algorithm, but
-we will further discuss some possible improvements, and also look at
-results when using the method on different kinds of pictures, with
-different kinds of noise.
+we will further discuss some possible improvements, and also look at the
+results when using the method on different kinds of noisy images.
 
 \subsection{Divide and conquer}
 The possibility of re-using the network between separate level
@@ -517,11 +528,11 @@ See \cite{gallo1989fast}, \cite{hochbaum2001efficient} and
 \cite{goldfarb2009parametric} for more information.
 
 \subsection{Implementation}
-A \cpp\ implementation can be found in appendix
+A \cpp\ implementation can be found in Appendix
 \ref{app:c++implementation}. It uses the open computer vision library
 OpenCV \cite{opencv_library} to load and save image files.
 
-Note that when implementing maximum flow algorithms, it is not a good
+Note that when implementing maximum flow algorithms it is not a good
 idea, memory- and performance-wise, to actually construct the residual
 network $G_f$. Instead, every time we update the flow $f(u,v)$ we set
 the flow in the opposite direction to its negative value $f(v,u) =
index 27db990b36fc75d4e7c032bf72dc64ebd8d51c1e..4d327df1305c8f7b24354d212d70c9f94f02d888 100644 (file)
@@ -47,9 +47,9 @@ The most obvious approach is to just look at the two images and see how
 much alike they are, something that makes sense especially if the output
 is made for the eye to see. One can also consider the \emph{method
 noise} which is the difference between the noisy image and the de-noised
-version. If noise is independent of the original image, one would also
-hope that the method noise would not contain too many features from the
-original image, since it is only the noise we want to remove.
+version. If noise is independent of the original image, the method noise
+would optimally not contain too many features from the original image,
+since it is only the noise we want to remove.
 
 Since our digitized representation of the images we are restricted to
 pixel values in $\{0, \ldots, 255\}$, we show the method noise as an
index acda826c2226c250739e8150ef8f29178a4ea3ed..9a6253797e9cedec55bb5d519ea18fc683da3a68 100644 (file)
--- a/total.tex
+++ b/total.tex
@@ -139,10 +139,11 @@ images are given on rectangles in $\mathbb{R}^2$, this is not a
 problem.
 
 The term $\TV(u)$ in \eqref{eq:energy_function} is the total variation
-of the image, introduced earlier as $\int_\Omega \abs{\nabla u}$. Since
-it can be problematic to calculate the traditional gradient, the
-following definition is introduced, using Green's identity to transfer
-the derivative to a smooth test function.
+of the image, introduced earlier as $\int_\Omega \abs{\nabla u}$, and
+often called the regularization term. Since it can be problematic to
+calculate the traditional gradient, the following definition is
+introduced, using Green's identity to transfer the derivative to a
+smooth test function.
 \begin{definition}[Total variation]
     Given a function $u \in L^1(\Omega)$, the total variation of $u$,
     often written $\int_\Omega \abs{Du}$, where the $D$ is the gradient
@@ -387,12 +388,16 @@ The number $\Delta \phi_{xy}$ is the difference between the angle of
 this edge and the next edge, if the edges are sorted by increasing
 angles. These parameters are also shown in Figure
 \ref{fig:common_neighborhoods}. Boykov and Kolmogorov prove we have
-convergence when all of $h$, $\Delta \phi_{xy}$, and $d_{xy}$ go to
-zero. \fixme{BLOOP}
+convergence when all of $h$, $\sup_{xy} \Delta \phi_{xy}$, and
+$\sup_{xy} d_{xy}$ go to zero.
 
 \subsubsection{Fidelity term}
-Now that the total variation is discretized, we need to take care of the
-fidelity term.  We define the following function for some pixel value
+The first integral of \eqref{eq:energy_function} is often called the
+fidelity term as it controls the similarity of the output and input
+image. As for the regularization term, we want to discretize it and
+write it as a sum over the level values $\lambda$.
+
+We define the following function for some pixel value
 $k$ and some pixel position $x$ in the original image $v$, which is the
 value of the energy if we were to color pixel $x$ with label $k$
 \begin{equation}
@@ -414,11 +419,12 @@ function $N(k)$ taking values $k \in \mathcal{L}$:
     \big) + N(0) \\
          &= \sum_{\lambda=0}^{L-2} \big(
         N(\lambda + 1) - N(\lambda)
-    \big) \mathbbm{1}_{\lambda < k} + N(0).
+    \big) I(\lambda < k) + N(0).
 \end{aligned}
 \end{equation}
-Since $\mathbbm{1}_{\lambda < u_x} = (1 - u^\lambda_x)$ we rewrite
-\eqref{eq:norm_discrete_int} and obtain
+Here $I(x)$ is an indicator function that takes the value $1$ if $x$ is
+true, and $0$ if $x$ is false.  Since $I(\lambda < u_x) = (1 -
+u^\lambda_x)$ we rewrite \eqref{eq:norm_discrete_int} and obtain
 \begin{equation}
     \sum_x N_x(u_x) = 
     \sum_{\lambda=0}^{L-2} \sum_x
@@ -428,7 +434,6 @@ Since $\mathbbm{1}_{\lambda < u_x} = (1 - u^\lambda_x)$ we rewrite
     \big)
     (1 - u^\lambda_x) + N_x(0).
 \end{equation}
-\fixme{BLOOP}
 
 \subsubsection{Total energy}
 \label{sec:total_energy}
@@ -469,11 +474,10 @@ level values, i.e.\,
 \begin{equation}
     u^\lambda_x \leq u^\mu_x \quad \forall \lambda \leq \mu,
     \quad \forall x \in S.
+    \label{eq:stackable}
 \end{equation}
 
 In the following sections we will present a graph cut algorithm that
 finds thresholded images minimizing each level, \emph{while guaranteeing
 that they meet this requirement.}
 
-\fixme{Consistently call them the fidelity and regularization terms.}
-