## 1 Introduction  
Heart failure is a condition with a strong negative impact on the survival of patients, as well as having a high financial burden due to its increased incidence, with a lifetime risk of occurrence of 20% [1]. The mechanism behind it is the cardiac remodeling process, which includes cardiomyocyte injury (hypertrophy, apoptosis and necrosis) and fibrosis [2]. In myocardial fibrosis, type I collagen predominantly accumulates (to the detriment of type III collagen), which is more stable and rigid; the consequences of this are increased myocardial stiffness, decreased contractility, diastolic dysfunction, decreased myocardial perfusion, and increased risk of arrhythmia [3]. Considering the prognostic role of fibrosis, its identification is essential [4]. Current assessment options include serum markers, magnetic resonance imaging, and endomyocardial biopsy [5]. The histological evaluation of fibrosis is still the gold standard, with the significant disadvantage that it may miss a focal process due to spatial heterogeneity and the fact that extensive sampling is not feasible [5]. In both endomyocardial biopsies and autopsy specimens, the assessment of fibrosis is part of the pathologist's routine activities. Myocardial fibrosis is of two types: diffuse and replacement [6]. Replacement fibrosis involves the necrosis of cardiomyocytes and their replacement with scar tissue, thus leading to thick collagen fibers that form confluent areas of more than 2 mm, uninterrupted by the interposition of cardiomyocytes [7]. Diffuse fibrosis includes interstitial and perivascular fibrosis, resulting in the accumulation of fine collagen fibers (of approximately 10-500 um) surrounding groups of cardiomyocytes or individual cells, without forming confluent areas [7]. Diffuse fibrosis comprises three patterns, which most often coexist: microscars (small areas of replacement fibrosis arising in the context of isolated cardiomyocytescte death), perivascular deposits (around arterioles and intramyocardial vascular branches), and deposits around the perimysium and endomysim [8]. The extent of fibrosis can be quantified by measuring the collagen volume fraction (CVF), which represents the ratio of the proportion of collagen and the totality of the examined myocardial tissue, being reported to have a prognostic role in patients with hypertrophic cardiomyopathy [9]. The assessment can also be performed semi-quantitatively, although the threshold values for defining severe fibrosis are highly variable from one study to another [5], without a consensus at the moment. Although special stains for collagen fibers are used to evaluate fibrosis, the hematoxylin-eosin (H&E) stain is routinely performed in laboratories, being inexpensive and rapid. It allows fibrosis visualization, although it provides low contrast compared to other stains [10]. As a result of digitization, numerous computational methods have been developed to assist physicians and, at the same time, to encourage standardization [11; 12; 13; 14]. Several methods to quantify fibrosis on microscopic images have been reported, but most are focused on the liver [15; 16] and kidney [17]. Additionally, the technical details available in the literature are few, and the validation is frequently performed via semi-quantitative comparison performed by the pathologist, which is influenced by subjectivity and brings an additional volume of work [18]. As a result of the significant development of omic technologies, the quantitative information generated based on the analyzed biological processes requires the integration and modeling of the data, an area where machine learning strategies can have an impact [19; 20]. In cardiovascular pathology, a computational sequencing method was applied for the spatial transcriptomics of the aorta dissection, succeeding in the spatial localization of different cell subpopulations [21]. Employing a technique based on graph contrastive learning and multi-task learning can enhance spatial localization in transcriptomics [22].