Deep GrabCut for Object Selection

Ning Xu, Brian L. Price, Scott Cohen, Jimei Yang, Thomas S. HuangBMVC 2017

Abstract

Most previous bounding-box-based segmentation methods assume the bounding box tightly covers the object of interest. However, it is common that a rectangle input could be too large or too small. In this paper, we propose a novel segmentation approach that uses a rectangle as a soft constraint by transforming it into a Euclidean distance map. A convolutional encoder-decoder network is trained end-to-end by concatenating images with these distance maps as inputs and predicting the object masks as outputs. Our approach gets accurate segmentation results given sloppy rectangles while being general for both interactive segmentation and instance segmentation. We show our network extends to curve-based input without retraining. We further apply our network to instance-level semantic segmentation and resolve any overlap using a conditional random field. Experiments on benchmark datasets demonstrate the effectiveness of the proposed approaches.

Introduction: The Challenge of Sloppy Inputs

In computer vision, selecting an object typically begins with a bounding box. Traditional interactive tools, such as the original GrabCut, and modern instance segmentation pipelines rely heavily on these rectangles. However, these methods often assume a "perfect" box—one that tightly encloses the object with minimal background.

In practice, user-provided boxes are frequently "sloppy"—either too large, too small, or cutting off parts of the object. Traditional algorithms and many deep learning methods that "crop" the image to the box tend to fail in these scenarios because they discard global context. Deep GrabCut addresses this by treating the rectangle as a soft constraint rather than a hard boundary.

Comparison of baseline segmentation methods and their sensitivity to bounding box constraints.

Methodology: From Hard Crops to Soft Constraints

The core innovation of Deep GrabCut is the transformation of the bounding box into a Euclidean Distance Map (EDM). Instead of cropping the image, the algorithm calculates the distance from every pixel to the nearest edge of the bounding box. Pixels inside the box receive negative values, while those outside receive positive values.

This distance map is concatenated with the standard RGB image to form a 4-channel tensor (R, G, B, Distance). This input is fed into a Convolutional Encoder-Decoder Network (CEDN). The encoder utilizes the first 14 layers of VGG-16, while the decoder consists of deconvolutional layers that reconstruct the object mask from coarse to fine details. To ensure robustness, the model is trained with "jittered" ground truth boxes—randomly stretched or shrunk—teaching the network to handle imprecise user inputs effectively.

Experimental Results and Robustness

Deep GrabCut was evaluated on several benchmarks, including PASCAL VOC 2012, MS COCO, and the classic GrabCut dataset. The results demonstrate significant improvements over both traditional and contemporary baselines:

  • Accuracy: On the GrabCut dataset, the model achieved a low error rate of 3.3%, outperforming the original GrabCut (8.1%) and specialized methods like BoxPrior (3.7%).
  • Robustness to Scale: While the performance of competing methods drops sharply when bounding boxes are scaled (from 0.6x to 1.4x), Deep GrabCut’s error rate remains remarkably stable.
  • Instance Segmentation: On PASCAL VOC, the model achieved a 67.3 mAP (at 0.5 IoU), surpassing complex pipelines like MNC and Hypercolumn.

A key insight is that by retaining the entire image context via the distance map, the network can "see" if a box has accidentally truncated an object, allowing for more accurate mask generation. Furthermore, the model generalizes to non-rectangular inputs, such as rough curves or circles, without requiring retraining.

Conclusion and Future Directions

Deep GrabCut provides a robust framework for object selection that is resilient to the variability of human input. By leveraging distance maps and global image context, it moves beyond the limitations of hard-cropping methods. Future work may involve reducing the computational overhead of the CRF post-processing step used for multi-object scenes and integrating iterative refinement through user clicks to further polish the generated masks.

Summary updated

BibTeX
@inproceedings{xu2017deep,
  author = {Ning Xu and Brian L. Price and Scott Cohen and Jimei Yang and Thomas S. Huang},
  title = {{Deep GrabCut for Object Selection}},
  booktitle = {BMVC},
  year = {2017},
  url = {https://openreview.net/forum?id=5_9t0AyQWf},
}
Figure