During the training stage, we apply the affinity kernel on the instance segmentation ground truth to generate the affinity ground truth. Since affinity ground truth is imbalanced, an OHEM [1]} loss is calculated between the predicted affinity map and the affinity ground truth to effectively alleviate the problem. Affinities that connect segments of fragmented instances are important but hard to learn. Thanks to the difficulty of learning these affinities, the OHEM loss pays more attention to these important affinities.
