WorksEngineering
Personalized and Adaptive Federated Learning for Canine Cardiomegaly Keypoint Prediction
Abstract
In the field of medical imaging, limited data and cross-institutional heterogeneity remain major challenges for training robust deep learning models. Federated learning (FL) has emerged as a promising approach that enables collaborative training across institutions while preserving data privacy by keeping datasets local. In this work, we propose a structure-aware personalized and adaptive federated learning framework, PAFL, for automatic vertebral heart score (VHS) estimation and cardiomegaly classification from canine thoracic X-rays. Our method treats the task as anatomical keypoint prediction followed by geometry-based VHS computation, introducing implicit structural consistency and improving interpretability. To address cross-institutional heterogeneity, we adopt a parameter-decomposed architecture that separates shared feature representations from client-specific adaptation modules. Furthermore, we introduce an adaptive, quality-aware aggregation strategy that dynamically weights client contributions based on both dataset size and model quality, thereby enhancing robustness to non-IID data distributions. Experimental results demonstrate that the proposed PAFL framework improves models' predictive performance compared to isolated training and to conventional and existing personalized federated learning (PFL) methods. Our results demonstrate the potential of integrating structure-aware modeling with PFL for reliable and interpretable medical image analysis.
Introduction
The rapid development of deep learning techniques has greatly advanced medical image analysis in both human and veterinary medicine. However, training high-performing deep learning models typically requires large-scale, diverse, and annotated datasets. In clinical environments, such datasets are often difficult to obtain due to privacy restrictions and limited annotations. Consequently, models trained on small or institution-specific datasets often suffer from limited generalization when deployed in new clinical settings. Federated learning (FL) has recently emerged as a promising framework for collaborative model training without requiring the cross-sharing of raw data. In an FL framework, each participating client independently trains an initial, centrally distributed model using its local data; only model weights are transmitted to a central server for aggregation [6]. This decentralized training strategy preserves data privacy while supporting cross-institutional collaboration, enabling multiple institutions to benefit from larger and more diverse training data [14].
Recent advances in personalized federated learning attempt to address data heterogeneity by decomposing models into shared and client-specific components [3], [8], [18], [20]. While effective, these approaches assume the shared global representation generalize across clients without considering task-specific structural constraints. In medical imaging tasks, this assumption is often violated. In particular, directly applying FL methods to medical imaging analysis tasks may lead to two issues: (1) structural inconsistency, where models may fail to preserve geometric relationships between anatomical landmarks, and (2) domain inconsistency, where shared representations are biased toward dominant clients, reducing performance on underrepresented domains.
Among different canine diseases, cardiomegaly, defined as the enlargement of the cardiac silhouette [13], is a critical indicator of potentially life-threatening cardiac conditions, calling the attention of both pet owners and the veterinary field. To standardize diagnostic procedures for cardiomegaly, the Vertebral Heart Score (VHS), proposed by Buchanan and Bücheler [1], has become a widely used clinical metric for assessing heart size in canine thoracic X-rays. Although VHS provides a standardized, reproducible measurement method, manual estimation is time-consuming and prone to variability, especially when comparing across breeds and imaging conditions. Automatic estimation of VHS from X-rays, therefore, is favored for both improved efficiency and diagnostic consistency [9], [12], [15]. However, the generalization of deep learning models in veterinary practices remains limited, and the FL training still faces several challenges. Data collected from different veterinary hospitals may show substantial heterogeneity due to variations in imaging equipment and patient populations. Such heterogeneity can reduce the effectiveness of conventional federated learning algorithms that rely on fully shared model parameters or naive aggregation.
To address these limitations, we propose a structure-aware PFL framework, PAFL, for automatic VHS estimation and cardiomegaly classification. Instead of directly predicting clinical scores, our method performs VHS estimation through anatomical keypoint detection followed by geometric computation. This design better preserves structural consistency and improves interpretability. Furthermore, we integrate this two-stage process into a PFL framework that separates shared feature representations from client-specific adaptation modules, enabling robust learning under heterogeneous data distributions. To further enhance robustness, we introduce a quality-aware aggregation strategy that dynamically weights client contributions based on both dataset size and model quality, mitigating the negative impact of low-quality or under-trained clients. The main contributions of this paper are as follows:
Multi-institutional veterinary dataset. We construct and utilize three canine thoracic X-ray datasets from institutions in the US, China, and Korea, capturing real-world heterogeneity in veterinary imaging.
Structure-aware personalized federated learning. We propose a federated learning framework that combines anatomical keypoint modeling with parameter decomposition between shared and client-specific, enabling robust learning under cross-institutional data heterogeneity, assisted by a domain adapter module in client models.
Quality-aware aggregation strategy. We design an adaptive aggregation mechanism that accounts for both dataset size and model quality based on relative client performance, improving training stability and model generalization across heterogeneous settings.
Methods
Overview
In veterinary imaging, training well-performing models faces two primary challenges: structural inconsistency in clinical measurement tasks, which arises when models fail to preserve anatomical geometry, and domain heterogeneity across institutions, which stems from institutional variations. To address these challenges, our PAFL framework is designed with three objectives: (1) maintaining anatomical structures through keypoint modeling, (2) separating shared and personalized parameters to handle heterogeneity, and (3) adaptively weighting client contributions based on model quality.
Preliminaries
We propose a federated learning framework with clients, where each client possesses a private dataset following an underlying distribution , where denotes a thoracic X-ray and represents six anatomical keypoints. Unlike standard supervised learning, the client distributions across datasets are non-identical, reflecting domain heterogeneity across institutions.
a) Personalized federated learning: To address heterogeneity, PFL decomposes the model as:
where is shared and is client-specific. Our objective is to train a set of client-specific models and minimize the average errors across clients while accounting for the heterogeneity of local data distributions:
where denotes the relative dataset size, and the local objective is defined as:
where denotes the client-specific model by , and is the local dataset of client .
b) Keypoint-based clinical metric measurement: In canine cardiomegaly assessment, the VHS is computed from six anatomical keypoints. The calculation sums the lengths of the long and short cardiac axes and then normalizes them to the vertebral column, starting at the T4 vertebral level [1]. An example of canine thoracic X-ray is presented in Figure 1 with six keypoints annotated. Given six keypoints , the geometric calculation for VHS is defined as:

Figure 1. An annotated example of canine thoracic X-ray image.
Structure-Aware Anatomical Learning via Keypoint prediction
a) Motivations: Existing approaches treat VHS estimation as a direct regression or classification problem. They typically approximate a mapping for VHS estimation. However, such mappings ignore the anatomical structure when measuring clinical metrics, leading to lack of interpretability in predictions, undermining the model’s trustworthiness.
b) Structure-aware prediction: To overcome this limitation, we treat VHS estimation as a structured geometric prediction problem. The prediction process is expressed as:
where denotes predicted keypoint coordinates and is a deterministic geometric formula. Let with . We define:
and
The classification head, a hard-coded classification algorithm, then classifies the cardiomegaly condition in X-rays through using the predefined threshold:
Incorporating the clinical keypoint prediction and measurement process into the model training ensures that models learn spatially consistent, anatomically meaningful keypoints, minimizing geometric error.
Personalized Federated Learning under Heterogeneity
a) Motivation: Federated learning aims to leverage distributed data across clients to train more generalizable models, but standard approaches assume a shared representation across all clients. In practice, veterinary datasets demonstrate significant heterogeneity, making a fully shared model insufficient to improve predictive performance. At the same time, fully local models fail to benefit from cross-institutional knowledge.
Therefore, in our proposed framework, we design and decompose each client model into a shared backbone, a personalized adapter, and a prediction head:
where , , , and are for backbone, adapter, and regression head.
b) Shared representation: The backbone extracts latent representations from input X-rays:
capturing domain-invariant anatomical features.
c) Adaptive transformation: The adapter is composed of a 2-layer MLP with a ReLU activation. It acts as a residual feature transformation:
where is a learnable nonlinear mapping. The incorporation of this adapter module ensures that features extracted using the backbone with globally shared weights can be dynamically adapted to the local data distributions.
d) Personalized prediction: The prediction head outputs normalized keypoint coordinates:
The backbone captures universal anatomical features that are consistent across institutions, such as cardiac shape and spatial layout. The adapter and prediction head allow each client to adjust to local variations, including breed distribution and imaging conditions. This parameter separation prevents conflicting optimization objectives between global and local knowledge, mitigating learning compromise across heterogeneous clients.
e) Personalized federated optimization: We adopt a personalized parameter sharing strategy:
where is shared and are client-specific. Each client trains following the minimization of the mean squared error (MSE) objective:
During this process, each local model learns a shared feature extractor with task-specific heads. After training, only the shared backbone is transmitted to the server, preserving privacy while enabling collaboration.
Quality-Aware Federated Aggregation
a) Motivation: A critical limitation of standard FedAvg is that it treats all clients equally or relies solely on dataset size. However, in heterogeneous clinical environments, clients may differ not only in data quantity but also in data and model quality. Aggregating low-quality or under-trained models can degrade global performance.
b) Quality-aware weighting: In our proposed framework, the classification accuracy was calculated as a geometric derivative using threshold-based metrics, making it unsuitable for capturing fine-grained differences and thus for accurately assessing the model’s performance in keypoint coordinate prediction. Therefore, compared with other works [5], [16], [17], we select validation loss, derived using the EfficientNet-B7 backbone [19], as the quality metric as it provides a more stable measure of model performance on keypoint prediction.
Instead of directly using the absolute validation loss per client, which may not be comparable due to heterogeneity, we define a normalized relative quality score:
where for clients, and is a small constant to ensure numerical stability, in our case, .
c) Weighted Aggregation: To balance the dataset size and model quality during our weight aggregation process, we define the aggregation weight as:
where controls the influence of the quality term. We set to avoid over-amplifying noisy or biased clients under heterogeneous data distributions.
The global backbone update is then computed as:
By normalizing validation losses across clients, our proposed framework ensures that model quality is comparable across clients with non-IID distributions. The term allows higher-quality clients to contribute more while preventing over-amplification for larger datasets. The comprehensive federated learning architecture is shown in Figure 2.

Figure 2. Proposed personalized and adaptive federated learning architecture for quality-aware aggregation.
Model reconstruction and personalization
After aggregation, each client receives the global weight and reconstructs its model:
This design enables the model to retain globally shared anatomical features while adapting to local domain characteristics, improving both generalization and robustness towards domain shift and client heterogeneity.
a) Early stopping: Our framework employs a client-aware early stopping mechanism. We monitor validation loss for each client individually and define improvement as a reduction in loss of more than for any client. The training process continues as long as at least one client shows progress, and terminates when no client improves for 10 consecutive rounds.
Experiments
Datasets
In this paper, we utilize canine thoracic X-ray images collected from three countries: 2,000 from China [9], 1,600 from the United States, and 1,000 from the Republic of Korea. The datasets from China and the US were collected manually by the research group members, and the VHS ground-truth keypoint labels for all three datasets were generated using software developed with a few-shot generalization strategy, validated by professional vets. The China and Korea datasets follow a standard 70/10/20 training/validation/test split, while the U.S. dataset uses 700 training data points due to the data availability. The detailed dataset statistics are displayed in Table I. The last column indicates the class distributions are relatively balanced across three datasets.
| Train | Valid | Test | Cardiomegaly pct(%) | |
| China | 1,400 | 200 | 400 | 870/43.5% |
| United States | 700 | 300 | 600 | 655/40.9% |
| Korea | 700 | 100 | 200 | 568/56.8% |
Table I. Statistics for three client datasets
| Federated Learning | Server 1 (China) | Server 2 (US) | Server 3 (Korea) | |||
| Validation | Test | Validation | Test | Validation | Test | |
| Round 1 (initial) | 77.5% | 76.0% | 72.0% | 71.0% | 74.3% | 76.0% |
| Round 5 | 78.5% | 78.0% | 79.7% | 80.6% | 81.0% | 82.0% |
| Round 10 | 82.5% | 82.5% | 78.6% | 82.2% | 81.0% | 87.0% |
| Round 15 | 82.0% | 85.5% | 82.7% | 83.5% | 82.5% | 85.5% |
| Round 20 | 81.3% | 86.5% | 80.6% | 84.5% | 82.0% | 88.0% |
| Round 25 | 83.6% | 88.5% | 83.0% | 86.0% | 82.5% | 89.5% |
| Round 30 | 81.0% | 88.0% | 81.0% | 85.2% | 84.0% | 89.0% |
Table 2. Federated learning results on local datasets with 30 rounds of global training.
Implementation details
For the federated learning framework, we performed 30 rounds of global communication. Each local server trained its model on its own dataset for 50 epochs before sending the updated weights to the subsequent central aggregation process. The central server performed the adaptive weight aggregation based on dataset sizes and model training quality. The framework was run on three A100 GPUs in parallel with an image resolution of , a default batch size of 8, a learning rate of , and using an Adam optimizer. We select the EfficientNet-B7 as the backbone network for our experiments. Source code, training algorithm and more experiments are available at https://github.com/YSZ-by/PAFL.
Results
For federated learning, we trained the entire PAFL framework for 30 consecutive rounds, limited by training time. The central server received the model weights from individual clients and performed the adaptive weight aggregation using methods described in Sec. II. The results for the PAFL training are displayed in Tab. II. The results demonstrated that the model learned actively during the first 20 rounds, with every 5 steps showing accuracy improvements, then became relatively stagnant and fluctuated, but still showed reasonable improvement in subsequent training steps. Different clients exhibit different improvement rates, while we see that all client models performed best primarily around their 25th training step, achieving optimal performance in keypoint prediction and VHS calculation on local test sets, yielding the highest accuracy scores. Compared to the initial round of training, the accuracy scores in the 25th round improved by more than 10%, demonstrating the effectiveness of our personalized and adaptive federated learning framework in enhancing the deep learning model’s performance compared to isolated training. Additionally, we compare our PAFL framework with existing federated learning methods, traditional FL methods FedProx [10] and FedCross [7], as well as personalized FL frameworks, RobustPFL [2], and PSFL [4]. The comparison models were mostly reproduced from the method sections of the original papers or adapted from the source code for FedProx [11]. All models were trained for 10 rounds and compared to the performance at the 10th round of the proposed PAFL framework. The results in Tab. III show that our model outperformed traditional FL frameworks and RobustPFL, and achieved performance comparable to or better than PSFL, indicating the promising applicability of our PAFL framework to improved medical imaging analysis tasks.
Discussion
From the above results, we can see that our proposed PAFL framework improves deep learning model performance by expanding data availability and diversity for training while ensuring the model’s resistance to dataset heterogeneity. The results demonstrated at least a 10% increase in prediction performance across all local client servers, indicating promising aggregation outcomes.
To better analyze the efficacy of each module in our proposed PAFL framework, we conduct ablation studies to evaluate the performance of our model’s personalization strategy and quality-aware aggregation method. The results displayed in Tab. IV are the classification accuracy for 12 rounds of federated training. We conducted five studies, including comparisons of raw and relative quality computation, of personalized and non-personalized model aggregation, and of traditional FedAvg and quality-aware FedAvg. From Tab. IV, we can see that the choice of quality metric matters greatly for model performance, comparing model 4 (using individual raw MSE loss) and model 5 (using relative MSE loss across clients). Poor quality evaluation degraded overall model performance. Additionally, personalized models that aggregated only backbone parameters while preserving local feature adapters yielded better results than models fully aggregated via FL frameworks.
Additionally, during PAFL training, we found that frameworks without quality-aware aggregation always converged prematurely, around the 10th round, resulting in limited improvement in later stages compared to quality-aware FL. This finding explains why the PAFL framework achieved comparable or slightly better performance in the first dozen rounds (Tab. IV) and surpassed other frameworks as training rounds increased, as shown in Tab. II. This phenomenon demonstrates the promising application of our proposed PAFL framework in increasing model prediction accuracy while being more resistant to premature convergence.
Conclusions
In this paper, we present a structure-aware personalized and adaptive federated learning framework (PAFL) for automatic
Table III. Federated learning methods comparison on local datasets with 10 rounds of global training.
| Model | Personalization | Quality-aware | Relative quality | Server 1 (China) | Server 2 (US) | Server 3 (Korea) | |||
| Validation | Test | Validation | Test | Validation | Test | ||||
| 1 | × | × | × | 81.5% | 82.3% | 79.3% | 81.7% | 81.6% | 82.5% |
| 2 | ✓ | × | × | 81.5% | 85.8% | 81.0% | 82.0% | 82.0% | 86.5% |
| 3 | × | ✓ | ✓ | 80.5% | 82.5% | 80.0% | 81.2% | 83.0% | 85.0% |
| 4 | ✓ | ✓ | × | 76.5% | 81.8% | 73.3% | 70.0% | 77.0% | 80.0% |
| 5 | ✓ | ✓ | ✓ | 82.5% | 84.25% | 81.3% | 84.5% | 83.0% | 88.5% |
Table IV. Ablation study for the key components of the PAFL framework with 12 rounds of global training.
VHS estimation from canine thoracic X-rays. We applied a personalized federated learning strategy that decomposes the model into a shared backbone and client-specific adaptation and prediction modules. Moreover, we introduced a quality-aware aggregation mechanism that leverages relative validation performance to dynamically adjust client contributions, improving the FL framework’s robustness under non-IID data distributions. Extensive experiments showed that our proposed PAFL framework achieved state-of-the-art performance. The results demonstrated the promise of applying a personalized and quality-aware FL framework to medical imaging tasks to address training data scarcity and heterogeneity.
References
- [1]James W. Buchanan and Jörg Bücheler. Vertebral scale system to measure canine heart size in radiographs. Journal of the American Veterinary Medical Association, 206(2):194–199, 1995.pubmed.ncbi.nlm.nih.gov/7751220
- [2]Guorong Chen, Wei Wang, Yufan Guo, Li Guangquan Xu, Shouling Ji, Tao Li, Meng Shen, and Yufei Han. Robustpfl: Robust personalized federated learning. IEEE Transactions on Dependable and Secure Computing, 22(4):3224–3239, 2025.DOI
- [3]Liam Collins, Hamed Hassani, Aryan Mokhtari, and Sanjay Shakkottai. Exploiting shared representations for personalized federated learning. In International conference on machine learning, pages 2089–2099. PMLR, 2021.arxiv.org/abs/2102.07078
- [4]Cheng Dai, Tianli Zhu, Sha Xiang, Lipeng Xie, Sahil Garg, and M Shamin Hossain. Psfl: Personalized split federated learning framework for distributed model training in intelligent transportation systems. IEEE Transactions on Intelligent Transportation Systems, 2025.
- [5]Yongheng Deng, Feng Lyu, Jun Ren, Yi-Chao Chen, Peng Yang, Yuezhi Zhou, and Yaoxue Zhang. Improving federated learning with quality-aware user incentive and auto-weighted model aggregation. IEEE Transactions on Parallel and Distributed Systems, 33(12):4515–4529, 2022.DOI
- [6]Hao Guan, Pew-Thian Yap, Andrea Bozoki, and Mingxia Liu. Federated learning for medical image analysis: A survey. Pattern recognition, 151:110424, 2024.arxiv.org/abs/2306.05980
- [7]Ming Hu, Peihen Zhou, Zihao Yue, Zhiwei Ling, Yihao Huang, Anran Li, Yang Liu, Xiang Lian, and Mingsong Chen. Fedcross: Towards accurate federated learning via multi-model cross-aggregation. In 2024 IEEE 40th International Conference on Data Engineering (ICDE), pages 2137–2150. IEEE, 2024.DOI
- [8]Phung Lai, Xiaopeng Jiang, Hai Phan, Cristian Borcea, Khang Tran, An Chen, Vijaya Datta Mayyuri, and Ruoming Jin. Fedx: Adaptive model decomposition and quantization for iot federated learning. In 2025 21st International Conference on Distributed Computing in Smart Systems and the Internet of Things (DCOSS-IoT), pages 212–220. IEEE, 2025.arxiv.org/abs/2504.12849
- [9]Jialu Li and Youshan Zhang. Regressive vision transformer for dog cardiomegaly assessment. Scientific Reports, 14(1):1539, 2024.DOI
- [10]Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine learning and systems, 2:429–450, 2020.
- [11]Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks, 2020. Accessed: 2026-04-02.
- [12]Habtamu Tilahun Mekonnen, Núria Puig, Alejandro Elson, Elena López, Paula Martínez, Selene Campos, Francisco Hernández, Daniel Mayor, Jorge Quiles, Xavier Cufí, et al. Deep learning framework for vertebral heart size and cardiothoracic ratio estimation in dogs and cats using thoracic radiographs. Frontiers in Veterinary Science, 12:1612338, 2025.DOI
- [13]Arun Mourya, HK Mehta, Rekha Mourya, DK Gupta, Amitia Tiwari, Brejesh Singh, and PC Shukla. Vertebral heart scale: A diagnostic tool for cardiomegaly in dogs. Journal of Pharmacognosy and Phytochemistry, 7(4):506–508, 2018.
- [14]Sajid Nazir and Mohammad Kaleem. Federated learning for medical image analysis with deep neural networks. Diagnostics, 13(9):1532, 2023.DOI
- [15]Aymard Nguemo, Fozame Bryan, Asma Ghamacha, Anuradha Kar, and Doreid Ammar. Automated vertebral heart size estimation from thoracic radiographs in dogs with ai-assisted clinical decision support. The Veterinary Journal, page 106674, 2026.DOI
- [16]Balázs Pejó and Gergely Biczók. Quality inference in federated learning with secure aggregation. IEEE Transactions on Big Data, 9(5):1430–1437, 2023.arxiv.org/abs/2007.06236
- [17]Y Peng, C Wang, H Shi, R Ma, H Guan, and Hanbo Yang. Federated learning with client clustering selection and quality-aware model aggregation (2024). IEEE Internet of Things Journal, 2025.DOI
- [18]Fahad Sabah, Yuwen Chen, Zhen Yang, Muhammad Azam, Nadeem Ahmad, and Raheem Sarwar. Model optimization techniques in personalized federated learning: A survey. Expert Systems with Applications, 243:122874, 2024.DOI
- [19]Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.arxiv.org/abs/1905.11946
- [20]Xiyuan Yang, Wenke Huang, and Mang Ye. Dynamic personalized federated learning with adaptive differential privacy. Advances in Neural Information Processing Systems, 36:72181–72192, 2023.DOI