  The performance of existing underwater object detection methods degrades
seriously when facing domain shift caused by complicated underwater
environments. Due to the limitation of the number of domains in the dataset,
deep detectors easily memorize a few seen domains, which leads to low
generalization ability. There are two common ideas to improve the domain
generalization performance. First, it can be inferred that the detector trained
on as many domains as possible is domain-invariant. Second, for the images with
the same semantic content in different domains, their hidden features should be
equivalent. This paper further excavates these two ideas and proposes a domain
generalization framework (named DMC) that learns how to generalize across
domains from Domain Mixup and Contrastive Learning. First, based on the
formation of underwater images, an image in an underwater environment is the
linear transformation of another underwater environment. Thus, a style transfer
model, which outputs a linear transformation matrix instead of the whole image,
is proposed to transform images from one source domain to another, enriching
the domain diversity of the training data. Second, mixup operation interpolates
different domains on the feature level, sampling new domains on the domain
manifold. Third, contrastive loss is selectively applied to features from
different domains to force the model to learn domain invariant features but
retain the discriminative capacity. With our method, detectors will be robust
to domain shift. Also, a domain generalization benchmark S-UODAC2020 for
detection is set up to measure the performance of our method. Comprehensive
experiments on S-UODAC2020 and two object recognition benchmarks (PACS and
VLCS) demonstrate that the proposed method is able to learn domain-invariant
representations, and outperforms other domain generalization methods.
