Image harmonization is a critical task in computer vision, which aims to adjust the foreground to make it compatible with the background. Recent works mainly focus on using global transformations (i.e., normalization and color curve rendering) to achieve visual consistency. However, these models ignore local visual consistency and their huge model sizes limit their harmonization ability on edge devices. In this paper, we propose a hierarchical dynamic network (HDNet) to adapt features from local to global view for better feature transformation in efficient image harmonization. Inspired by the success of various dynamic models, local dynamic (LD) module and mask-aware global dynamic (MGD) module are proposed in this paper. Specifically, LD matches local representations between the foreground and background regions based on semantic similarities, then adaptively adjust every foreground local representation according to the appearance of its $K$-nearest neighbor background regions. In this way, LD can produce more realistic images at a more fine-grained level, and simultaneously enjoy the characteristic of semantic alignment. The MGD effectively applies distinct convolution to the foreground and background, learning the representations of foreground and background regions as well as their correlations to the global harmonization, facilitating local visual consistency for the images much more efficiently. Experimental results demonstrate that the proposed HDNet significantly reduces the total model parameters by more than 80\% compared to previous methods, while still attaining state-of-the-art performance on the popular iHarmony4 dataset. Notably, the HDNet achieves a 4\% improvement in PSNR and a 19\% reduction in MSE compared to the prior state-of-the-art methods.
翻译:图像和谐化是计算机视觉中的关键任务,旨在调整前景使其与背景兼容。现有方法主要依赖全局变换(如归一化与颜色曲线渲染)实现视觉一致性,但此类模型忽略了局部视觉一致性,且其庞大的模型规模限制了在边缘设备上的和谐化能力。本文提出一种层次化动态网络(HDNet),通过从局部到全局视角自适应特征变换,实现高效的图像和谐化。受多种动态模型成功经验的启发,本文设计了局部动态(LD)模块与掩码感知全局动态(MGD)模块。具体而言,LD基于语义相似性匹配前景与背景区域的局部表示,并根据其K近邻背景区域的外观自适应调整每个前景局部表示,从而在更细粒度层面生成更真实的图像,同时保持语义对齐特性。MGD有效地对前景和背景应用差异化卷积,学习前景、背景区域及其与全局和谐化关联的表示,显著提升图像局部视觉一致性。实验结果表明,与先前方法相比,HDNet在减少总模型参数超过80%的同时,在主流iHarmony4数据集上仍达到最优性能。值得注意的是,相比现有最优方法,HDNet的PSNR提升4%,MSE降低19%。