ATRIA | EchoTrace: Fine-Tuning MedGemma 1.5 for Polygon-Based Heart Structure Contouring

Esteemed HAI-DEF & MedGemma Team,

I’m Shehab Anwer, a cardiologist. I recently shared some of my progress with Rory Pilgrim, who kindly suggested I post here to connect with the right folks for your valuable insights and feedback! Please read the disclaimer and references for more information on ATRIA and EchoTrace prototype (sections under my signature.)

I’ve been exploring the fine-tuning of the google/medgemma-1.5-4b-it model for endocardial tracing. Specifically, my project focuses on polygon-based contouring for the left ventricle (LV) endocardial border and the left atrium (LA) - and can be adjusted to any contouring tasks.


The Clinical Impact:
Automating this process addresses a critical, day-to-day task in Cardiac Imaging. Accurate contouring is the essential precursor for downstream management of cardiovascular disease, specifically enabling:

  • Geometric Assessment: Evaluating anatomical features, such as chamber area and estimated volume.

  • Mechanical Function: Assessing physiology, including the fraction at the end of contraction versus the end of relaxation.

  • Criteria-Based Decision Making: Applying gender-based normal limits for anatomical/functional parameters and executing guidelines-based decision workflows.


A quick overview of my workflow and setup:

  • Framework Integration: DEITY Principles Framework - The Adimension’s Foundational Framework to cover the pillars (Data, Ethics, Informatics, Technology and You) to healthcare operations towards human-machine synergy.

  • Dataset Integration: I am using pre-processed echocardiographic frames (ED and ES instants as PNGs) paired with serialized JSON traces.

  • Coordinate Geometry: The ground-truth segmentation masks are pre-computed into polygons featuring 30 points each for the LV and LA. These polygon coordinates are normalized to a [0, 1000] scale.

  • Prompting & Training: My prompt engineering was heavily inspired by the box localization notebook, but I have directed it specifically toward polygon geometry. I am currently utilizing JSON structured outputs from QLoRA training.

  • Structured Output in JSON array: MedGemma exceptionally capable of following the prompt command post-finetuning, and programmtic extraction of coordinates into JSON array follows the inference. Specifically to enable further dataset iteration, integration with PACS/DICOM packages, and enable further AI tasks (further tuning, reinforcement learning, directing towards another model architecture).

  • Human-in-the-Loop UI: I have built an interface to correct the model’s outputs. This allows the corrected data to be reused in continuous fine-tuning, which is incredibly helpful for managing inter- and intra-operator variability!


What Does ATRIA EchoTrace Currently Targets?

Internal development and validation within the ATRIA cardiac AI research initiative. The platform is designed for immediate collaborative adoption by academic hospitals, echocardiography core laboratories, and medical AI research groups working with CAMUS, EchoNet-Dynamic, or institution-specific echo datasets. Open to structured pilot programs focused on annotation efficiency, ground-truth quality improvement, and responsible AI governance.


What Are the Current Challenges Facing ATRIA EchoTrace?

  • Transitioning the interactive revision UI from Colab notebook to a lightweight, production-grade web or desktop clinical application
  • Extending the pipeline to full video/sequence modeling, temporal consistency, and additional cardiac structures (RV free wall, valves, strain curves)
  • Clarifying regulatory pathways and intended-use boundaries if the tool evolves from research annotation aid toward clinical decision-support components
  • Building larger-scale clinical validation studies quantifying time savings, inter-observer variability reduction, and downstream impact on ejection fraction/strain measurements
  • Further lowering resource barriers and optimizing for real-time or edge deployment scenarios

I would highly appreciate any insights, feedback, or best practices the team might have regarding polygon geometry generation, adapter training, or UI integration with MedGemma 1.5.

I am really grateful for the foundation you all have built—thank you to the moon and back!

Best regards,
Shehab Anwer, MD
Cardiologist & Medical AI Developer
The Adimension | Founder, CEO.

  • Google Scholar: [ scholar .google.com/citations?user=W-rpYiUAAAAJ&hl=en]

Important Disclaimers

I. INTENDED USE
ATRIA EchoTrace is currently classified as a Prototype / Advanced Minimum Viable Product (MVP). The platform, including its MedGemma-based models, LoRA adapters, pipelines, and user interfaces, is explicitly intended for research, academic collaboration, and internal validation. It is NOT a cleared or approved medical device by regulatory bodies at the time of this document generated.

II. NON-CLINICAL USE
Not for Direct Clinical Diagnosis.ATRIA EchoTrace is an AI-powered annotation and drafting tool designed to support and augment medical research and dataset creation. The software must not be used as a standalone diagnostic tool, for direct patient care, or as the sole basis for clinical decision-making. Any downstream metrics derived from its outputs (such as ejection fraction, cardiac volume, or strain calculations) are strictly for research and validation purposes.

III. MANDATORY HUMAN OVERSIGHT
In strict adherence to the DEITY Principles Framework (specifically the “You” pillar), this system relies on a Human-in-the-Loop (HITL) architecture. All AI-generated structural contours (LV/LA) and annotations are preliminary proposals. They must be independently reviewed, verified, and revised by qualified echocardiographers, cardiologists, or trained medical personnel.

IV. DATA PRIVACY
Users of ATRIA EchoTrace are solely responsible for ensuring that all echocardiographic inputs (DICOM, AVI, PNG) are properly anonymized and de-identified prior to processing.

V. REGULATORY COMPLIANCE
Users must ensure their use of the platform complies with all applicable local, national, and international healthcare data privacy regulations (e.g., HIPAA, GDPR).

VI. “AS IS” PROVISION
The ATRIA EchoTrace codebase, models, artifacts, and documentation are provided “AS IS” without any warranties of accuracy, reliability, or clinical fitness, either express or implied.

VII. LIMITATION OF LIABILITY
The developers, contributors, and affiliated research initiatives assume no liability for any direct, indirect, or consequential damages, or clinical outcomes arising from the use, misuse, or inability to use this platform.


REFERENCES

  • The Adimension & DEITY Principles Anwer, S. (2026). The Adimension: Bridging human ingenuity and machine intelligence through the DEITY principles framework. European Heart Journal - Imaging Methods and Practice, 4(1), qyaf038.

  • CAMUS Dataset Leclerc, S., Smistad, E., Pedrosa, J., Østvik, A., Cervenansky, F., Espinosa, F., Espeland, T., Berg, E. A. R., Jodoin, P.-M., Grenier, T., Lartizien, C., Dhooge, J., Løvstakken, L., & Bernard, O. (2019). Deep learning for segmentation using an open large-scale dataset in 2D echocardiography. IEEE Transactions on Medical Imaging, 38(9), 2198–2210. [

  • EchoNet-Dynamic Ouyang, D., He, B., Ghorbani, A., Yuan, N., Ebinger, J., Langlotz, C. P., Heidenreich, P. A., Harrington, R. A., Liang, D. H., Ashley, E. A., & Zou, J. Y. (2020). Video-based AI for beat-to-beat assessment of cardiac function. Nature, 580(7802), 252–256.

  • Google MedGemma 1.5 Google. (2026). MedGemma 1.5: Technical reports and model card (google/medgemma-1.5-4b-it). Hugging Face.

  • LoRA: Low-Rank Adaptation. Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., & Chen, W. (2021). LoRA: Low-rank adaptation of large language models. arXiv.

The Adimension’s ATRIA EchoTrace notebook is available online at: