  Instance segmentation aims to locate targets in the image and segment each
target area at pixel level, which is one of the most important tasks in
computer vision. Mask R-CNN is a classic method of instance segmentation, but
we find that its predicted masks are unclear and inaccurate near contours. To
cope with this problem, we draw on the idea of contour matching based on
distance transformation image and propose a novel loss function, called contour
loss. Contour loss is designed to specifically optimize the contour parts of
the predicted masks, thus can assure more accurate instance segmentation. In
order to make the proposed contour loss to be jointly trained under modern
neural network frameworks, we design a differentiable k-step distance
transformation image calculation module, which can approximately compute
truncated distance transformation images of the predicted mask and
corresponding ground-truth mask online. The proposed contour loss can be
integrated into existing instance segmentation methods such as Mask R-CNN, and
combined with their original loss functions without modification of the
inference network structures, thus has strong versatility. Experimental results
on COCO show that contour loss is effective, which can further improve instance
segmentation performances.
