Full text
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 1 Real-time Segmentation of Stereo Videos on a Portable System with a Mobile GPU Alexey Abramov, Karl Pauwels, Jeremie Papon, Florentin W¨ org¨ otter, and Babette Dellen Abstract—In mobile robotic applications, visual information needs to be processed fast despite resource limitations of the mobile system. Here a novel real-time framework for modelfree spatio-temporal segmentation of stereo videos is presented. It combines real-time optical flow and stereo with image segmentation and runs on a portable system with an integrated mobile GPU. The system performs on-line, automatic and dense segmentation of stereo videos and serves as a visual frontend for preprocessing in mobile robots, providing a condensed representation of the scene which can potentially be utilized in various applications, e.g., object manipulation, manipulation recognition, visual servoing. The method was tested on real-world sequences with arbitrary motions including videos acquired with a moving camera. Index Terms—stereo segmentation, mobile systems, visual front-end I. INTRODUCTION Real-time visual information is becoming more and more important in robotic applications for two main reasons: first, the research done during the last decades in computer vision and image processing allows transforming visual information into more descriptive but nevertheless quite precise representations of the visual scene for using them in a wide range of robotic applications, e.g., robot movement, object grasping, and object manipulation [1], [2]. Second, new hardware architectures and programming models for multi-core computing have been proposed in the last ten years, through which many algorithms could be upgraded to real-time processing [3]. Currently different hardware platforms are used as accelerators for complex computations in the domain of visual processing, such as multicore processors, Digital Signal Processors (DSP), Field Programmable Gate Arrays (FPGAs) and Graphics Processing Units (GPUs). In the area of visual processing, the evolution of Graphics Processing Units (GPUs) during the last four years has been of particular importance. GPUs are specialized microprocessors which have been initially invented for image processing and acceleration of 2D and 3D graphics rendering. GPUs are used in workstations, personal computers, mobile phones and embedded systems. At present GPUs are a part of every computer and can be used immediately without any additional hardware upgrades. During the last four years GPUs A. Abramov, J. Papon and F. W¨ org¨ otter are with Georg-August University, Bernstein Center for Computational Neuroscience, III Physikalisches Institut, G¨ ottingen, Germany, e-mail: abramov,jpapon,wor[email protected]. K. Pauwels is with the Computer Architecture and Technology Department, University of Granada, Spain, e-mail: [email protected].es. B. Dellen is with Institut de Rob` otica i Inform` atica Industrial (CSIC-UPC), Barcelona, Spain, e-mail: [email protected]. have evolved into highly parallel, multi-threaded, multi-core processors with tremendous computational power and very high memory bandwidth. For algorithms of high complexity, their parallel architecture makes them more efficient than general-purpose CPUs in many cases. Therefore GPUs can be used not only for graphics processing but also for generalpurpose parallel computing. Moreover the graphics capabilities of GPUs make the visual output of the processed data directly from the microprocessor much simpler compared to other parallel platforms. The parallel programming model of Compute Unified Device Architecture (CUDA) proposed by NVIDIA in 2007 makes parallelization of software applications on GPUs quite transparent [4]. However, processing power, memory bandwidth and number of cores are not the only important parameters in robotic systems. Since robots are dynamic, movable and very often wireless systems, huge processing platforms with high power consumption (mostly for cooling) are not practicable despite their high processing efficiency. Because of this, mobile parallel systems running on portable devices are of growing interest for computer-controlled robots. Nowadays mobile GPUs from the NVIDIA G8X series are supported by CUDA and can be used very easily for general-purpose parallel computing. In Fig. 1, the dynamics of development for desktop and mobile GPUs from the NVIDIA G8X series until today are shown, demonstrating that desktop GPUs are three times more powerful and have three times faster memory bandwidths than mobile ones. However, powerful desktop GPUs consume so much power that it is almost impossible to use them in small computer-controlled robots, while even the most powerful mobile GPUs integrated into mobile PCs do not need an extra power supply. Taking into account this fact we consider in the current study a mobile PC with an integrated mobile GPU from NVIDIA supported by CUDA as a portable system. Such a system can run for up to three hours in autonomous mode being supplied by the laptop battery. Mobile robots have to process and structure abundant dynamic visual information in real-time in order to interact with their environment in a meaningful way. For example, the understanding of the visual scene in terms of object and object-action relations [2] requires objects to be detected, segmented, tracked, and important descriptors, e.g. shape information, to be extracted [5]. This process corresponds to a dramatic compression of the initial visual data into symbollike descriptors, upon which abstract logic or learning schemes can be applied. This occurs for example if a robot performs object manipulations or needs to come closer to an object to execute a grasping action. Finding this reduced symbol-like
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 2 8X 9X 200 400 500 0 400 800 1200 1600 GFLOPs GeForce series (A) 8X 9X 200 400 500 0 40 80 120 160 200 GeForce series GB/s (B) 8X 9X 200 400 500 GeForce series 0 100 200 300 400 500 600 Number of cores (C) 8X 9X 200 400 500 0 50 100 150 200 250 Watts GeForce series (D) Fig. 1. Comparison of desktop (blue) and mobile (green) graphics cards for NVIDIA GeForce 8X, 9X, 100, 200, 400, 500-series GPUs with a minimum of 256 MB of local graphics memory. The following parameters are compared: (A) Processing power in floating point operations per second, (B) Maximum theoretical memory bandwidth, (C) Number of CUDA cores and (D) Graphics card power. representation without prior knowledge on the data (model free) thus represents a major challenge in cognitive-vision applications – this problem is also known as the signal-symbol gap [6]. The video segmentation problem is generally formulated as the grouping of pixels into spatio-temporal volumes where each found object is uniquely identified and satisfies temporal coherency, i.e., carries the same label along the whole video stream [7], [8]. Several approaches for the video segmentation problem have been proposed over the last two decades. They can be summarized as follows. On-line and off-line methods.On-line video segmentation techniques use only preceding information and do not need future data. Such methods can segment video sequences of arbitrarily length in a continuous, sequential manner [9], [10], [11], [12], [13], [14], [8]. Off-line methods on the contrary require the entire video sequence as input [15], [16], [17], [7]. Off-line techniques are more robust in terms of temporal coherence but they cannot be involved in perception-action loops, since future perception is unknown. Dense and sparse techniques. A video segmentation method is dense if it treats all objects visible in the scene trying to assign each pixel to a proper spatio-temporal volume [9], [10], [11], [12], [16], [17], [8], [7]. Techniques that perform segmentation of only pre-selected objects are sparse [13], [15], [14]. Note that if not all objects are selected, the consequent employment of segments, given by sparse techniques, is very constrained and excludes an estimation of object positions relative to the environment which as a consequence excludes robot movements aimed at objects. Automatic and nonautomatic approaches. The method is automatic or unsupervised if it runs without interaction with a user and does not need any prior knowledge about objects [9], [11], [12], [16], [8]. Nonautomatic or supervised techniques are very often driven by user input, use some prior knowledge about the visual scene and make assumptions about the number of objects present [10], [15], [17], [13], [14]. The hierarchical graph-based video segmentation, proposed by Grundmann et al. (2010) [7], can run in both automatic and nonautomatic modes. Since mobile robots are usually autonomous systems that interact with their environment, only on-line automatic video segmentation techniques can be employed in the perceptionaction loop. Moreover, a complete information about the visual scene can be derived only by the use of dense methods. The following methods are the most famous and up-to-date on-line dense automatic video segmentation techniques: The mean-shift video segmentation, proposed by Paris (2008) [11], is based on the popular image segmentation technique by Comaniciu and Meer [18]. The temporal coherence is achieved by estimating the density of feature points, associated with all pixels, with a Gaussian kernel using data from all preceding frames. The method has a real-time performance on gray-level videos of size 640 ×360 pixels. Multiple hypothesis video segmentation (MHVS) from superpixel flows by Vasquez-Reina et al. (2010) [8] generates multiple pre-segmentations per frame considering only a few preceding frames. For each pre-segmentation it finds sequences of time consistent superpixels, called superpixel flows or hypotheses. Each hypothesis is considered as a potential solution and a hypothesis leading to the best spatio-temporal coherence. In this approach the segmentation decision is postponed until evidence has been collected across several frames. Despite quite accurate segmentation results the MHVS needs seconds to process one frame which makes it impossible to use it in real-time robotic applications. Video segmentation based on propagation, validation and aggregation of a preceding graph by Liu et al. [9] exploits inter-frame correlations to propagate reliable groupings from the previous frame to the current. A preceding graph is build and labeled for the previous frame and temporally propagated to the current frame using a global motion estimation, followed by validation based on similarity measures. Pixels remained unlabeled after the propagation are grouped into subgraphs by a simple color clustering. Although the method gives results of a very high quality, it runs at frame rates inapplicable to real-time utilization. Matching images under unstable segmentations by Hedau et al. (2008) [12] is based on the fact that object regions obtained by existing segmentation methods do not always produce perceptually meaningful regions. In this approach the current frame is segmented independently of preceding frames and the temporal coherence is achieved by region matching between the current and previous frames using the Partial Match Cost which allows fragments belonging to the same region to have low match cost with the original region. However, the method cannot run in real-time due to slow region matching procedure. The three last approaches provide very accurate spatiotemporal volumes and can segment arbitrary long video sequences, but these methods do not run in real-time and
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 3 Monocular Segmentation Stereo segments left camera right camera Mobile CPU Mobile GPU 1 2 3 4 5 6 5` Stereo Segmentation Optical Flow Stereo and (A) (B) Fig. 2. (A) The architecture of the framework for segmentation of stereo videos on the portable system with a mobile GPU. (B) A prototype of the movable robot steered by a mobile system with stereo cameras and a laptop with an integrated mobile GPU. as a consequence cannot be employed in the perceptionaction loop. The mean-shift video segmentation approach on the contrary runs in real-time but works only on gray-scale videos and needs all past data to achieve satisfactory temporal coherence. Although stereo data has recently been employed for segmentation [19], [20], there is no method that performs spatiotemporal segmentation of stereo videos with establishing correspondences between left and right segments. As a consequence, there is no specific on-line, dense and automatic approach for the segmentation of stereo videos. Segmented stereo videos provide additional information about the scene and allow us to derive 3D relations between objects [2]. Moreover, segment correspondences can be used for depth computation [21] which is of high importance for object manipulation tasks. In this paper we present a novel visual front-end for real-time spatio-temporal segmentation of stereo videos on a mobile PC with an integrated mobile GPU. The proposed visual front-end is on-line, automatic, dense and solves the following problems: (i) Stereo images are segmented in a consistent model-free way. (ii) The temporal coherence in a stereo video stream is achieved using a label-transfer strategy based on estimated motion and disparity data, resulting in a consistent partitioning of neighboring frames together with a consistent labeling. Only the results obtained on the very last left and right frames are employed at a time in order to guarantee spatio-temporal coherence for the current left and right frames, respectively. (iii) All computations run in realtime or close to real-time which allows the framework to be used in the perception-action loop. Parts of this study have been previously published at a conference [5]. In the current study some significant improvements have been achieved as compared to the conference version: (i) the used segmentation kernel has been optimized in order to achieve real-time performance, (ii) the perceptual color space CIE (L∗a∗b∗) is used instead of the input RGB space which leads to the formation of more accurate spatiotemporal volumes, (iii) the method does not rely on motion estimated for the left video stream only; motion estimation for the right stream is included which makes right segments more stable and decreases processing time for segmentation of stereo videos, (iv) the algorithm can now run on mobile GPUs, and (v) the method was tested on more complex scenes including sequences with moving cameras and the performance of the method has been quantified in much more detail. The paper is organized as follows. In Section II we describe the architecture of the framework together with the proposed algorithms. In Section III we present the results of an extensive experimental evaluation and finally, in Section IV, we conclude our work. II. SEGMENTATION OF STEREO VIDEOS A. Overview The architecture of the framework for segmentation of stereo videos is shown in Fig. 2(A). It consists of a stereo camera, a mobile computer with an integrated mobile GPU and various processing components that are connected by channels in the framework. Each component in the framework can access the output data of all other components in the framework. The processing flow is as follows. Stereo images (synchronized left and right frames) are captured by a stereo camera. The acquired images are undistorted and rectified (in real-time with a fixed stereo-geometry [3]) before they enter the framework. Optical flow is computed for the current left and right frames together with the disparity map on a GPU using real-time algorithms and the results are accessible from channels 3 and 4, respectively (see Section II-C). For frames from the left video stream segment labels from the previous segmentation are warped to the current frame using the optical flow vector field (channel 3). This new label configuration is used as an initialization for the fast segmentation algorithm, which also runs on a GPU (see Section II-D). The adjustment of initial labels to the current frame will be referred to as relaxation process. This way the required time for segmentation of sequential frames can be reduced, and, even more importantly, a temporally coherent labeling of the frames can be achieved, i.e., segments describing the same object part are likely to carry the same label. The segmentation results of the left frame (monocular segmentation) can be accessed from channel 5. A label initialization of the current right frame is created by warping of both the current left (channel 50) and previous right segments using the disparity information and optical flow vector field (channel 4), respectively (see Section II-E). Similar to the segmentation of the left stream, the initial labels are adjusted to the current right frame by the relaxation
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 4 process. The segmentation results of the right frame, which is now consistently labeled with respect to its corresponding left frame, are stored in channel 6. Once segmentation for both left and right frames is achieved, meaningful stereo segments can be extracted. Segments smaller than a predefined threshold are removed. After all these processing steps each object is represented by uniquely identified left and right segments. This information can be exploited directly by a mobile robot. A prototype of the movable robot steered by a mobile system including stereo cameras and a laptop with an integrated mobile GPU is shown in Fig. 2(B). B. Image segmentation kernel Many different approaches for image segmentation have been proposed during the past three decades. Nowadays the most famous and efficient techniques are normalized cuts [22], graph-based [23], mean shift segmentation [18], graph-cuts and energy-based methods [24]. All these methods operate on single images, and cannot be applied directly to the video segmentation problem due to the temporal incoherence between adjacent frames, i.e., when segments of the same object keep different labels. As a consequence, some additional techniques are needed in order to link corresponding segments. In the proposed framework the real-time image segmentation algorithm based on the method of superparamagnetic clustering of data is used as an image segmentation kernel [25]. The method of superparamagnetic clustering represents an input image being segmented by a Potts model [26] of spins and solves the segmentation problem by finding the equilibrium states of the energy function of a ferromagnetic Potts model in the superparamagnetic phase [27], [28]. The Potts model describes a system of interacting granular ferromagnets or spins that can be in qdifferent states, characterizing the pointing direction of the respective spin vectors. Three phases, depending on the system temperature, i.e., disorder introduced to the system, are observed: the paramagnetic, the superparamagnetic, and the ferromagnetic phase. In the ferromagnetic phase, all spins are aligned, while in the paramagnetic phase the system is in a state of complete disorder. In the superparamagnetic phase regions of aligned spins coexist. Blatt et al. (1998) applied the Potts model to the image segmentation problems in a way that in the superparamagnetic phase regions of aligned spins correspond to a natural partition of the image data [29]. Finding the image partition corresponds to the computation of the equilibrium states of the Potts model. The equilibrium states of the Potts model have been approximated in the past using the Metropolis-Hastings algorithm with annealing [30] and methods based on cluster updating, which are known to accelerate the equilibration of the system by shortening the correlation times between distant spins, such as Swendsen-Wang [31], Wolff [32], and energy-based cluster updating (ECU) [27], [28]. All of these methods obey detailed balance, ensuring convergence of the system to the equilibrium state. In the current study we achieve efficient performance using the Metropolis algorithm with annealing [30], which can be easily parallelized and implemented on a GPU architecture. The method of superparamagnetic clustering of data was chosen as an image segmentation kernel for the video segmentation problem due to its following advantage. Since the segmentation problem is solved by finding equilibrium states of the Potts model using an annealing procedure, there are no particular requirements to the initial states of spins and they can take on any one of qavailable states. The closer the initial states are to the equilibrium, the less time the Metropolis algorithm needs to converge. This property allows us to achieve temporal coherency in the segmentation of monocular and stereo video streams just by using the previous segmentation results for the spin initialization of the current frame, while taking shifts between frames into account. A final segmentation result is obtained within a small number of Metropolis updates only, drastically reducing computation time. However, any other segmentation technique can be used for segmentation of the very first frame and the obtained segments can be considered as spin variables in the Potts model. The real-time image segmentation kernel proceeds as follows. Using the Potts model an input image is represented in a form of color vectors g1,g2,...,gNarranged on the N=LxLysites of a two-dimensional (2D) lattice. In the Potts model, a spin variable σk, which can take on qdiscrete values (q > 2)w1, w2, . . . , wq, called spin states, is assigned to each pixel of the image. We define a spin state configuration by S={σ1, σ2, . . . , σN} ∈ Ω, where Ωis the space of all spin configurations. For video segmentation, the parameter q should be chosen as large as possible since the spin states need to serve also as segment labels. In our experiments, we used q= 256. It is important to note that this choice of qhas no influence on the performance and computation time of the Metropolis algorithm itself. A global energy function or a cost function of this particular q-state Potts configuration S∈Ωis the Hamiltonian H[S] = −X <i,j> Jijδσiσj,(1) which represents the system energy where <i,j>denotes the closest neighborhood of spin iwith ||i, j|| ⩽`, where ` is a constant that needs to be set. 2D bonds (i, j)between two pixels with coordinates (xi, yi)and (xj, yj)are created only if |(xi−xj)|⩽`and |(yi−yj)|⩽`. In the current work we use `= 1.Jij is an interaction strength or coupling constant and the Kronecker δij function is defined as δij = 1if σi=σjand zero otherwise, where σiand σjare the respective spin variables of two neighboring pixels iand j (see Fig. 4). A coupling constant, determining the interaction strength between two spins iand j, is given by Jij = 1 −∆ij /∆,(2) where ∆ij =||gi−gj|| is the color difference between respective color vectors giand gjof the input image. ∆is the mean distance averaged over all bonds in the image. The interaction strength is defined in such a way that regions with similar color values will get positive weights with a maximum value of one for equal colors, whereas dissimilar regions
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 5 get negative weights [33]. The mean distance ∆represents the intrinsic (short-range) similarity within the whole input image 1: ∆ = α· 1 N 1 (2`+ 1)2−1 N X i=1 X <i,j> ||gi−gj|| ,(3) where (2`+ 1)2−1is the number of neighbors of a spin. The factor α∈(0,10] is a system parameter used to increase or decrease the coupling constants. Coupling constants are computed in the CIE (L∗a∗b∗) color space [34] instead of the input RGB format. Although RGB is a widely-used color space, it is not suitable for color segmentation and analysis because of the high correlation among all three components. The high correlation means that changes in intensity lead to changes in values of all three color components. The CIE (L∗a∗b∗) color space, which is obtained by applying a nonlinear transformation to the RGB, is a perceptual color space that gives a better hint of how different two colors are for a human observer [35]. In the CIE (L∗a∗b∗) space a pixel is represented by three values: L∗,a∗and b∗where L∗denotes lightness, while a∗and b∗ denote color information. The color difference between two color vectors gi= (L∗ i, a∗ i, b∗ i)Tand gj= (L∗ j, a∗ j, b∗ j)Tis determined by [36] ||gi−gj|| =qΨ2 L+ Ψ2 C+ Ψ2 H,(4) ΨL=∆L∗ KL ,ΨC=∆C∗ ab 1 + K1C∗ i ,ΨH=∆H∗ ab 1 + K2C∗ j ,(5) ∆L∗=L∗ i−L∗ j, C∗ i=q(a∗2 i+b∗2 i),(6) C∗ j=q(a∗2 j+b∗2 j),∆C∗ ab =C∗ i−C∗ j,(7) ∆H∗ ab =q∆a∗2+ ∆b∗2−∆C∗2 ab ,(8) ∆a∗=a∗ i−a∗ j,∆b∗=b∗ i−b∗ j,(9) where KL,K1and K2are the weighting factors. Since the current method uses 8-connectivity of pixels, interaction strengths for each pixel of the image need to be computed in four different directions: horizontal, left diagonal, vertical, right diagonal (see Fig. 3(B)). Matrices containing coupling constants that affect formation of segments are shown for one image in Fig. 3(C - F). The segmentation problem is solved by finding regions or clusters of correlated spins in the low temperature equilibrium states of the Hamiltonian H[S]. Simulated annealing works by simulating a random walk on the set of spin states Ωlooking for low-energy states. According to the Metropolis algorithm, one update iteration consists of the following steps: 1Note that (2) is ill-defined in the case of ∆ = 0. But in this case only a single uniform surface exists and segmentation is not necessary. C1 C2 C3 C4 (A) (B) C1 J JC2 JC3 JC4 0.0 -0.6 -1.2 -1.8 -2.4 0.0 -0.6 -1.2 -1.8 -2.4 (E) (C) (F) (D) Fig. 3. Coupling constants for the 8-connectivity case in the CIE (L∗a∗b∗) color space. (A) Original frame. (B) Mask for eight-connected connectivity. (C - F) Matrices with coupling constants computed for horizontal, left diagonal, vertical and right diagonal directions. Note, that only coupling constants leading to the formation of segments are shown here (J < 0). 1) The system energy H[Scur]of the current spin configuration Scur is computed according to (1). 2) For each pixel i, a set of n(number of neighbors) new possible spin configurations ~=S0 1, S0 2,· · · , S0 n is created by changing the spin state of pixel ito the spin states of the neighbors. The number of new possible spin configurations ndoes not depend on q. 3) Every spin configuration S0 i∈~is considered as a potential new configuration of the system. Therefore energy values of all configurations from the set ~need to be computed according to (1). 4) Among all new possible configurations from the set ~ a spin configuration with the minimum energy value is selected according to H[Snew] = min(H[S0 1], H[S0 2],· · · , H[S0 n]).(10) The respective change in energy between the current configuration Scur and a configuration Snew ∈~having the energy value H[Snew]is defined as ∆H≡ H[Snew]−H[Scur]. According to ∆H > 0or ∆H⩽0, moves can be classified as uphill and downhill, respectively. 5) To effect a bias in favor of moves that decrease the energy, downhill moves are always accepted, whereas uphill moves are accepted only sometimes in order to avoid getting trapped in local minima. Therefore the probability that the proposed move leading to increase in energy will be accepted is given by [37] P(Scur →Snew) = exp −|∆H| Tn.(11) A number ξis drawn randomly from a uniform distribution in the range of [0,1]. If ξ < P(Scur →Snew),
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 6 the move is accepted. 6) The temperature is gradually reduced after every iteration according to the pre-defined annealing schedule Tn+1 =γ·Tn, where γis the annealing coefficient (γ < 1). The update process (1) - (5) runs until convergence, i.e., when no more spin flips towards a lower energy state are being observed. The equilibrium state of the system, achieved after several Metropolis iterations, corresponds to the image partition or segmentation. Then, the final segments larger than a pre-defined threshold are extracted. BLOCK (0,0) BLOCK (1,0) BLOCK (0,0) BLOCK (0,1) j i update 1 update 2 update 3 update 4 2Ɩ Fig. 4. Update of a spin state configuration of the input image on a GPU. Pixels depicted by the same pattern are updated simultaneously. Blue regions show overlaps between neighboring thread blocks. The green region includes (2`+ 1)2−1pixels from the closest neighborhood of the pixel i. The arrow shows an interaction between pixels iand j. Each spin update in the Metropolis algorithm involves only the nearest neighbors of the considered pixel. Hence, the spin variables of pixels that are not neighbors of each other can be updated simultaneously [38]. Therefore the Metropolis algorithm fits very well to the GPU architecture and all spin variables can be updated in four iterations as shown in Fig. 4. On a GPU an image is divided into some processing blocks (taking overlaps between them into account) which are distributed between multiple multiprocessors on the card. In the current implementation a thread block of size 16 ×16 is used and each thread loads and updates four pixels. Such a configuration makes it possible to avoid idle threads (only loading data from overlaps without performing any spin update) and to use the resources of the GPU in a very efficient way. Four coupling constants (a byte each) and a current spin value (one byte) are loaded from the global memory to the shared memory for each pixel resulting in five matrices of size 32×32 within every thread block. 5 KB in total of the shared memory are occupied by one block which makes it possible to run 4blocks on each multiprocessor of the NVIDIA GeForce GT 240M at the same time. Because of the high intensity of the Metropolis procedure with numerous accesses to the same data within one iteration, the shared memory is used for data access due to its low latency instead of the global memory. Since threads from diverse thread blocks cannot cooperate with each other, overlaps between blocks need to be synchronized via the global memory, once all spin variables of the current spin configuration are updated. Global memory throughput is maximized through the coalesced memory accesses achieved by rearrangement of input data in the global memory and usage of data types fulfilling the size and alignment requirements [39]. Due to the fact that the coupling constants can be computed simultaneously for all pixels in the image, this procedure is performed on the GPU as well. In the current study only the first frame from the left video stream is segmented completely from scratch (all spin variables are initialized randomly). Subsequent left frames and their corresponding right frames are first initialized by a spin state configuration taken from previous frames considering movements and stereo displacements between them (see Section II-A). Therefore the relaxation process is applied to preinitialized images to adjust initial spins to the current frame (see Sections II-D and II-E). Since every found segment is carrying a spin variable which is unique within the whole image, the terms spin and label are equivalent in this work. C. Phase-based optical flow and disparity Since fast processing is a very important issue in the present study, the real-time phase-based optical flow and stereo algorithms, proposed by Pauwels et al. (2010) [40], are used to find pixel correspondences between adjacent frames in a monocular video stream and left and right frames in a stereo video stream. Both algorithms run on a GPU and belong to the class of phase-based techniques, which are highly robust to changes in contrast, orientation and speed. The optical flow algorithm integrates the temporal phase gradient (extracted from five subsequent frames) across orientation and gradually refines its estimates by traversing a Gabor pyramid from coarser to finer levels. Although any other optical flow estimation technique can be used here [41], we decided on the mentioned phase-based approach since it combines high accuracy with computational efficiency. Furthermore, due to the shared image representation based on the responses of a Gabor filterbank, stereo correspondences, used to find corresponding stereo segments (see Section II-E), can be obtained with very little overhead. A comparable qualitative evaluation of the methods including test sequences from the Middlebury benchmark can be found in [42], [43]. Implementation details and performance analyses of the phase-based optical flow and stereo algorithms are given in [43]. D. Monocular segmentation using optical-flow based label warping In the current framework optical flow is computed for both the left and right video streams. The algorithm provides a vector field which indicates the motion of pixels in textured regions u(x, y)=(ux(x, y), uy(x, y)).(12)
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 7 (A) (B) Frame t Frame t+1 (C) Flow vector field (D) Segments t Initialization t+1 (E) Segments t+1 (G) (F) 0510 15 20 25 -1.34 -1.3 -1.26 -1.22 x 105 Energy iterations (H) T = 1.0 T = 0.999*T 0 n+1 n 1 1 2 3 4 4 Label transfer t+1 Fig. 5. Segmentation of two adjacent frames in a sequence using 30 iterations and α= 2.5. Numbers at arrows show the sequence of computations. (A) Original frame t. (B) Original frame t+ 1. (C) Estimated optical flow vector field from the phase-based method (sub-sampled 13 times and scaled 6 times) (step 1). (D) Extracted segments Stfor frame t(step 1). (E) Label transfer from frame tto frame t+ 1 (step 2). (F) Initialization of frame t+ 1 for the image segmentation kernel (step 3). (G) Extracted segments St+1 for frame t+ 1 (step 4). (H) Convergence of the Metropolis algorithm for frame t+ 1. An estimated optical flow vector field for two adjacent frames tand t+ 1 out of the “Toy” sequence with a moving camera from the motion annotation benchmark 2is shown in Fig. 5(A - C). Since we are using a local algorithm, optical flow cannot be estimated everywhere (for example not in the very weakly-textured black regions of the panda toy). For pixels in these regions, vertical and horizontal flows, i.e., uy and ux, do not exist. Suppose frame tis segmented and St is its final label configuration (see Fig. 5(D)). An initial label configuration for frame t+ 1 is found by warping all labels from frame ttaking estimations from the optical flow vector field into account (see Fig. 5(E)) St+1(xt+1, yt+1) = St(xt, yt),(13) xt=xt+1 −ux(xt+1, yt+1),(14) yt=yt+1 −uy(xt+1, yt+1),(15) where (ux, uy)is the flow at time t+ 1. Since there is only one flow vector per pixel, there will only be one label transferred per pixel. Note that it is not the case if the flow at time tis used for linking, since there can be multiple flow vectors pointing to the same pixel in frame t+ 1. Pixels which did not obtain an initialization via (13) are then given a randomly chosen label between 1and qwhich is not occupied by any of the found segments (see Fig. 5(F)). Once frame t+1 is initialized, a relaxation process (see II-B) is needed in order to fix erroneous bonds that can take place during the transfer of spin states. Flow interpolations for weaklytextured regions are not considered in this work because (i) the image segmentation kernel inherently incorporates the data during spin relaxation, and (ii) an interpolation based on a 2available under http://people.csail.mit.edu/celiu/motionAnnotation/ camera motion estimation is only useful in static scenes (with moving cameras), but cannot help when dealing with moving objects. The relaxation process runs until convergence and only after that are the final segments extracted (see Fig. 5(G) where corresponding segments between frames tand t+1 are labeled with identical colors). Convergence of the relaxation process against a number of iterations is shown in Fig. 5(H). For the relaxation process we use a schedule with the starting temperature T0= 1.0and annealing coefficient γ= 0.999. As we can see the annealing process with this schedule converges after 25 −30 iterations making it possible to segment stereo video streams with a frame size of 320 ×256 in real-time. Longer annealing schedules can lead to better segmentation results but at the cost of processing time. E. Stereo segmentation using disparity-based label warping The segmentation of every right frame is performed in a similar way. Here, an initial label configuration for the right frame at time tis obtained by warping the labels from both the corresponding left frame and the previous right frame. Labels from the left frame are transferred using the disparity map D (see Fig. 6(A - C)) and labels from the previous right frame are transferred using the optical flow vector field (see Fig. 6(E)). Since the stereo algorithm relies on phase (and not magnitude), it can find correct matches even in weakly-textured regions. Also, ambiguous matches are avoided by the use of a coarse- to-fine control mechanism. However, it cannot find reliable information under drastically changing light conditions (see the reflection shift over the table). We suppose that the left frame Ltis segmented and SLis its final label configuration (see Fig. 6(D)). Labels from the previous right frame Rt−1are
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 8 (A) (B) Left frame t Right frame t (C) (D) Left segments t Initialization (E) Right segments t (F) Disparity map 0 10 20 30 40 50 Label transfer Flow vector field Right segments t-1 (G) (H) (J) 1 1 2 2 3 4 40510 15 20 25 iterations -1.25 -1.15 -1.05 -0.95 x 105 Energy T = 1.0 T = 0.999*T 0 n+1 n no right optical flow with right optical flow Fig. 6. Segmentation of a stereo pair for the time moment t. Numbers at arrows show the sequence of computations. (A) Original left frame Lt. (B) Original right frame Rt. (C) Disparity map estimated by the phase-based method (step 1). (D) Extracted segments SLfor frame Ltafter 30 iterations with α= 2.5 (step 1). (E) Segments and estimated optical flow vector field for right frame t−1(sub-sampled 13 times and scaled 6 times). (F) Label transfer from frame Ltto frame Rt(step 2). (G) Initialization of frame Rtfor the image segmentation kernel (step 3). (H) Extracted segments SRfor frame Rtafter 10 iterations with α= 2.5(step 4). (J) Convergence of the Metropolis algorithm for frame Rt. warped according to the procedure described in II-D, whereas labels from the current left frame Ltare warped as follows: SR(xR, yR) = SL(xL, yL),(16) xL=xR+D(xR, yR), yL=yR.(17) The disparity map Dis computed relative to the right frame which guarantees that there will only be one label transferred per pixel from the left frame. Both warpings are performed at the same time (see Fig. 6(F)). In the case of multiple correspondences, i.e., if a pixel in frame Rthas label candidates in frames Ltand Rt−1, there are no preferences and we select randomly either the flow or the stereo. In this way they can both contribute without bias and the segmentation kernel can make the final decision. Pixels that did not obtain a label initialization via (16) are given a randomly chosen label between 1and qwhich is not occupied by any of the found segments (see Fig. 6(G)). Once frame Rtis initialized, a relaxation process (see II-B) is needed in order to fix erroneous bonds that can take place during the transfer of spins. The relaxation process runs again until it converges and only after that are the final right segments SRat time textracted (see Fig. 6(H) where correspondening segments between frames Lt and Rtare labeled with identical colors). Convergence of the relaxation process against a number of iterations is shown in Fig. 6(J) for the proposed label transfer and for the label transfer based only on disparity shifts. Here we use the same annealing schedule as for the segmentation of the left video stream. We can see that the use of the previous right labels drastically reduces a number of iterations needed for convergence and already after 5−10 iterations the final right segments can be extracted. Using only stereo information about 25 −30 iterations are needed in order to reach the equilibrium state. This is because the occlusions in the stereo images are significantly larger than the occlusions between adjacent frames taken from one video stream. III. EXPERIMENTAL RESULTS A. Quantitative evaluation To measure the quality of video segmentations we use the segmentation covering metric introduced by Arbel´ aez et al. (2009) [44]. The idea of the metric is to evaluate the covering of a machine segmentation Sby a human segmentation S0. A human segmentation, called also ground truth segmentation, is a manual annotation of a video sequence showing how humans perceive the scene, whereas a machine segmentation is an output result of the considered video segmentation algorithm. In the current study the human-assisted motion annotation tool proposed by Liu et al. [10] is used which allows a user to annotate video sequences very efficiently. For one frame, the segmentation covering metric is defined as C(S0→S) = 1 NX R∈S |R| · max R0∈S0O(R, R0),(18) where Nis the total number of pixels in the image, |R| the number of pixels in region R, and O(R, R0)is the overlap between regions Rand R0defined as O(R, R0) = |R∩R0| |R∪R0|.(19)
JOURNAL OF L A T EX CLASS FILES, VOL. 22, NO. 9, SEPTEMBER 2012 9 (A) (B) (C) (D) (E) (F) iterations 0 1 2 3 4 5678 9 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.74 0.72 0.7 0.68 0.66 0.64 0510 15 20 25 30 35 40 45 V(S'→S) V(S'→S) α CIE (L*a*b*) color space RGB color space T = 1.0 T = 0.999*T 0 n+1 n Frame 5 Frame 9 Frame 13 Frame 15 Frame 17 Fig. 7. Segmentation results for the “Toy” monocular video sequence with a moving camera. (A) Original frames. (B) Ground-truth segmentation created by the human-assisted annotation. (C) Machine segmentation performed in the input RGB color space (30 iterations, α= 2.5). (D) Machine segmentation performed in the perceptual color space CIE (L∗a∗b∗) (30 iterations, α= 2.5). (E,F) The segmentation covering shown for both color spaces against the system parameter αand the number of iterations. To find the most similar machine spatio-temporal volume for each volume from the ground-truth video segmentation, we compute the segmentation covering for all ground-truth regions in all frames applying the following constrains: (i) all segments within one volume are temporally coherent, i.e., carry the same label in all frames; (ii) if the ground-truth volume extends over the more frames than the selected machine volume, then we repeat the selection of the best overlap over the remaining time intervals [16]. The segmentation covering for the video sequence is computed by averaging of the segmentation coverings over all frames Min the sequence: V(S0→S) = 1 M M X i=1 Ci(S0→S).(20) For the segmentation evaluation of stereo videos temporal coherence in both the left and right streams needs to be taken into account. B. Monocular segmentation results In Fig. 7 video segmentation results for the “Toy” video sequence with a moving camera are presented. The ground truth segmentation created with the human-assisted motion annotation tool is shown in Fig. 7(B). Note that the ground truth segmentations provided on the web page of the motion annotation benchmark cannot be used for the comparison in this work, since they show layer segmentation based on motion only without considering color differences. Also the very textured background is not considered in the ground truth because its manual annotation is extremely difficult. The video segmentation results for both the RGB and CIE color spaces are shown in Fig. 7(C) and in Fig. 7(D), respectively. In both cases the same segmentation parameters and the same