Dense Contrastive Loss for Instance Segmentation

Hang Chen (Tsinghua University),* Chufeng Tang (Tsinghua University), Xiaolin Hu (Tsinghua University)
The 33rd British Machine Vision Conference


Instance segmentation, which requires instance-level mask prediction, is a fundamental task in computer vision. Many methods have been proposed in this field. However, the existing methods still do not perform well in complex scenarios such as occlusion. In this work, we analyzed the segmentation errors of some typical instance segmentation models. We found that false negatives (i.e. misclassification of foreground pixels as background) accounted for the majority of errors. It can be attributed to the inconsistent features of the same instance under complex scenarios. To address this problem, we proposed a dense contrastive loss to encourage the segmentation network to learn more consistent feature representations. Specifically, features on the same instance are pulled closer, while features on different instances and features between instances and the background are pushed farther apart. Without introducing any extra inference cost, the proposed method mitigated false-negative errors and achieved significant improvements on the Cityscapes and MS-COCO datasets. Code will be available at



author    = {Hang Chen and Chufeng Tang and Xiaolin Hu},
title     = {Dense Contrastive Loss for Instance Segmentation},
booktitle = {33rd British Machine Vision Conference 2022, {BMVC} 2022, London, UK, November 21-24, 2022},
publisher = {{BMVA} Press},
year      = {2022},
url       = {}

Copyright © 2022 The British Machine Vision Association and Society for Pattern Recognition
The British Machine Vision Conference is organised by The British Machine Vision Association and Society for Pattern Recognition. The Association is a Company limited by guarantee, No.2543446, and a non-profit-making body, registered in England and Wales as Charity No.1002307 (Registered Office: Dept. of Computer Science, Durham University, South Road, Durham, DH1 3LE, UK).

Imprint | Data Protection