Abstract
Deep Metric Learning (DML) is helpful in computer vision tasks. In this paper, we firstly introduce DML into image co-segmentation. We propose a novel Triplet loss for Image Segmentation, called IS-Triplet loss for short, and combine it with traditional image segmentation loss. Different from the general DML task which learns the metric between pictures, we treat each pixel as a sample, and use their embedded features in high-dimensional space to form triples, then we tend to force the distance between pixels of different categories greater than of the same category by optimizing IS-Triplet loss so that the pixels from different categories are easier to be distinguished in the high-dimensional feature space. We further present an efficient triple sampling strategy to make a feasible computation of IS-Triplet loss. Finally, the IS-Triplet loss is combined with 3 traditional image segmentation losses to perform image segmentation. We apply the proposed approach to image co-segmentation and test it on the SBCoseg dataset and the Internet dataset. The experimental result shows that our approach can effectively improve the discrimination of pixels' categories in high-dimensional space and thus help traditional loss achieve better performance of image segmentation with fewer training epochs.
Introduction
Image co-segmentation is the task of identifying and extracting common objects from a group of related images. While traditional loss functions like Cross-Entropy (CE), Dice, and Focal loss are effective, they primarily focus on the "distinguishability" of low-dimensional semantic features (the final labels).
This paper argues that these methods ignore the discrimination of high-dimensional features. In many cases, pixels that are difficult to classify in low-dimensional space could be easily separated if their high-dimensional embeddings were more distinct. To address this, the authors introduce the IS-Triplet loss, a novel deep metric learning approach that treats individual pixels as samples to improve image co-segmentation. By forcing foreground and background pixels into distinct clusters in high-dimensional embedding space, the framework achieves better segmentation accuracy and faster convergence across multiple standard loss functions.
Methodology
Network Architecture
The researchers propose a framework that combines traditional segmentation losses with the new IS-Triplet loss. The architecture is based on a Siamese U-Net using ResNet-50 encoders, modified with a co-attention block to capture shared features between image pairs and a dedicated embedding branch for the metric learning task.
Pixel-Level Metric Learning
Unlike standard DML which treats an entire image as a single data point, this method treats each pixel as a sample. It uses a 64-channel embedding layer to represent each pixel in a high-dimensional space. The IS-Triplet loss forces the distance between pixels of different categories (foreground vs. background) to be larger than the distance between pixels of the same category by a specific margin.
Efficient Triple Sampling Strategy
To solve the $O(N^3)$ complexity of triplet selection, which is otherwise prohibitive for millions of pixels, the authors developed an efficient sampling strategy. They randomly select $K$ foreground points and $K$ background points to form two sets ($F1, F2$ and $B1, B2$), then construct $2K$ triples.
This strategy ensures a balanced representation of both classes regardless of the actual object size in the image, bypassing the class imbalance problem that often causes standard losses to fail on small objects.
Experimental Evaluation
Datasets
The model was evaluated on several benchmark datasets:
- SBCoseg: 16,002 images across 889 groups.
- Internet Dataset: Thousands of images of airplanes, cars, and houses.
- Pascal VOC 2012 & MSRC: Used as a combined collection for training complex experiments.
Key Results
The experimental results demonstrate consistent improvements:
- Accuracy Boost: On the SBCoseg dataset, adding IS-Triplet loss to Dice loss improved the Jaccard index (IoU) from 0.981 to 0.985. On the more difficult Internet dataset, the Jaccard index jumped from 0.760 to 0.801.
- Faster Convergence: Training curves show that models using IS-Triplet loss reach higher accuracy in fewer epochs compared to those using traditional losses alone.
- Universal Compatibility: The IS-Triplet loss acts as an "enhancer" for traditional losses. Interestingly, while Dice, CE, and Focal losses usually perform differently, adding IS-Triplet loss brought all three to a similarly high level of performance.
Conclusion
By explicitly supervising the high-dimensional manifold—making foreground clusters tight and far from background clusters—the final classification layer has a much easier task. While the sampling strategy is efficient, calculating high-dimensional embeddings for every pixel adds some computational overhead. Future research may explore this pixel-level DML approach for general semantic segmentation and video dynamic segmentation.
Summary updated