Object counting models often degrade under cross-domain deployment because density composition varies across domains and is itself task-relevant. Standard feature alignment methods tend to suppress such variation by encouraging global domain invariance, which can be harmful when source and target domains contain different proportions of background, sparse foreground, and dense foreground. We propose Conditional Feature Alignment (CFA), a cross-domain counting framework that aligns representations within label-induced conditions rather than across full marginal feature distributions. Given density annotations or pseudo-density predictions, CFA constructs foreground/background or density-level conditions and aligns only features belonging to matching conditions. We formalise this idea through a conditional divergence perspective, showing that conditional alignment removes within-condition discrepancy while preserving condition-marginal density shift. For unsupervised domain adaptation, CFA estimates source conditions from annotations and target conditions from detached pseudo-density maps, then performs condition-wise adversarial alignment with full-image consistency regularisation. For source-domain generalisation, we instantiate the same principle with MPCount by enforcing condition-wise memory-consistency between generated source-domain views. Experiments on crowd and cell counting benchmarks show competitive or improved performance across diverse UDA and DG settings. For example, on JHU-CROWD++ FH$\rightarrow$SN, CFA-DG reduces MAE/RMSE from MPCount's 216.3/421.4 to 90.5/169.9, indicating that condition-wise alignment is especially effective under large weather- and density-induced shifts. These results suggest that condition-wise alignment is a promising design principle for domain-adaptive counting.
翻译:目标计数模型在跨域部署时性能往往会下降,因为密度分布在各域间存在差异且与任务本身相关。标准的特征对齐方法倾向于通过鼓励全局域不变性来抑制这种差异,当源域与目标域包含不同比例的背景、稀疏前景和密集前景时,这种做法可能适得其反。我们提出条件特征对齐(CFA),一种跨域计数框架,它在标签诱导的条件内部而非完整的边缘特征分布上进行表示对齐。基于密度标注或伪密度预测,CFA构建前景/背景或密度层级条件,并仅对齐属于匹配条件的特征。我们通过条件散度视角形式化这一思想,证明条件对齐能够消除条件内差异,同时保留条件-边缘密度偏移。针对无监督域自适应,CFA利用标注估计源域条件,利用分离的伪密度图估计目标域条件,进而通过全图一致性正则化执行条件级对抗对齐。针对源域泛化,我们将相同原则实例化到MPCount中,强制源域视图间条件级记忆一致性。在人群与细胞计数基准上的实验表明,该方法在多种无监督域自适应和源域泛化设置下均具有竞争力或更优的性能。以JHU-CROWD++ FH→SN为例,CFA-DG将MPCount的MAE/RMSE从216.3/421.4降至90.5/169.9,表明在天气和密度引起的显著偏移下条件级对齐尤为有效。这些结果表明,条件级对齐是一种有前景的域自适应计数设计原则。