From: Bjørn Rustad Date: Fri, 9 May 2014 12:04:12 +0000 (+0200) Subject: Fist draft of push-relabel section X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=a01cf2bc3965e3fdcd6f4f47b5f7bf65ea8b3a26;p=prosjektoppgave Fist draft of push-relabel section --- diff --git a/cut.tex b/cut.tex index 7496831..4c98e81 100644 --- a/cut.tex +++ b/cut.tex @@ -241,10 +241,6 @@ energy function. \label{tab:neigh_energy} \end{table} -\begin{figure} - \input{fig/norm_evolution} -\end{figure} - \begin{figure} \centering \begin{tikzpicture}[scale=1.3] diff --git a/flow.tex b/flow.tex index ea2c1d1..c64fcbb 100644 --- a/flow.tex +++ b/flow.tex @@ -403,6 +403,10 @@ phase of the algorithm is finished. equal to the flow from $s$ to $t$. \end{proof} +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 : d(u) \geq N \}$. + \fixme{Sketch of proof, could be nicer, shorter (split up?) and more rigorous maybe.} @@ -426,7 +430,6 @@ The highest level selection rule always discharges the vertex with the largest distance label. \fixme{Running time and reference.} - \subsubsection{Heuristics} Different heuristics exists that can speed up the algorithm considerably. Being heuristics, they are not guaranteed to work, and @@ -496,6 +499,20 @@ procedure will not change the validity of these two things. Hence, both the preflow $f$ and distance labeling $d$ are valid. \end{proof} +When running the push-relabel algorithm with the gap heuristic, we can +be sure that there will never be a node $u$ with label $d(u) = N-1$ at +the end of the algorithm, i.e.\ we know that there will always be a gap +at label $N-1$. Using the same reasoning as in Theorem \fixme{ref}, if +there was a vertex with label $N-1$, there would only be $N-3$ possibly +having labels in $[1, N-2]$, so a gap must exist somewhere in that +interval. When using the gap relabeling heuristic, such a gap can no +exist, so we can conclude that there is no vertex with label $N-1$. + +Using Theorem \fixme{ref} we can then conclude that the sets $S = \{ u +\in V : d(u) \geq N\}$ and $T = V - S$ form a minimum cut of the network. + +\fixme{Ugh, what a mess. Lemma maybe?} + \subsection{Parametric push-relabel algorithm} Now we have an algorithm for finding a minimum $s$-$t$-cut in a network, so let's return to the network constructed in Section \fixme{ref}. For @@ -503,19 +520,26 @@ every level $\lambda \in ??$ we want to find a minimum $s$-$t$-cut which gives us the thresholded image $u^\lambda$. These can then hopefully be stacked together to form the final image $u$. +\subsubsection{Network reuse} Solving \fixme{??} separate minimum cut problems seems like a lot of work, but when using the push-relabel algorithm we will, if we do things in the right order, be able to reuse the network when going from one label to the next. -Going back to Equation \fixme{??} and the sub-network representations in -Figure \fixme{??} and Figure \fixme{??} we know that only edges from -sub-networks representing the fidelity term depend on our level -parameter $\lambda$. From Figure \fixme{move closer??} 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 -\fixme{??} now are the only ones depending on $\lambda$, the following -is true for \emph{decreasing} values of $\lambda$ +\begin{figure} + \input{fig/norm_evolution} +\end{figure} + +Going back to the network representations in Figure +\ref{fig:norm_subgraph} and Figure \ref{fig:neigh_subgraph} we know that +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 +\emph{decreasing} values of $\lambda$ \begin{description} \item[Edges from $s$ to $u$] As seen in Figure \fixme{ref} the capacity of these edges will @@ -528,7 +552,73 @@ is true for \emph{decreasing} values of $\lambda$ decrease monotonically with decreasing $\lambda$ parameter. \end{description} -\subsubsection{Bleep bloop} +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 +\begin{description} + \item[Edges from $s$ to $u$] + The capacity $c(s, u)$ is increased, and the flow is set to be + equal to the capacity $f(s, u) = c(s, u)$. The vertex $u$ might + have an increased excess $e(u)$, which might in turn make it + active. + \item[Edges from $v$ to $t$] + The capacity $c(v, t)$ is decreased. If it is decreased to a + value below the current flow value, we set $f(v, t) = c(v, t)$ + which will decrease the excess of the sink $t$, and increase the + excess of $v$. +\end{description} +The preflow and capacity constraints are trivially satisfied. + +None of these actions will create new edges in the residual network, and +we do not change the labeling $d$, so the labeling constraints are also +satisfied in the new network. + +Through this procedure we have easily created the network for $\lambda = +k-1$, and the distance labels remain the same. As these labels always +increase monotonically, we have a head start compared to if we had reset +the flow and labels. + +\subsubsection{Output image construction} +\fixme{Mention earlier that with gap relabeling, we gap at N.} + +We mentioned already in section \ref{sec:total_energy} that in order to +be able to construct our output image $u$, the thresholded images +$u^\lambda$ would have to stack one on top of the other \fixme{as shown +in Figure ??}. We will now show that through reuse of the distance +labels from the last iteration of the push-relabel algorithm, we can +guarantee that it is possible to stack the thresholded images. + +Consider two subsequent runs of the push-relabel algorithm, for labels +$\lambda = k$ and $\lambda = k-1$ ending with distance labelings $d^k$ +and $d^{k-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 inclusion +\begin{equation} + \{ u \in V : d^k(u) \geq N \} \subseteq \{ u \in V : d^{k-1}(u) \geq + N \} +\end{equation} + +We then construct our output image $u$ by giving each pixel the value +\begin{equation} + u_x = \min \{ \lambda \in [0, 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. + +\subsubsection{Divide and conquer} +\fixme{Write something here.} + +\subsection{Implementation} +\cite{opencv_library} + +\subsection{Bleep bloop} + +Maybe we should delete the $u$-$t$ edge when the vertex reaches a level +> 1? The nodes are allowed to have a positive excess but we still follow the capacity constraints. The nodes also have a labeling, which has to be