Cow postpartum uterus involution prediction method and system based on multi-modal multi-scale attention fusion

By employing a multimodal, multi-scale attention fusion prediction method, combined with ultrasound images and uterine artery resistance index time series, the accuracy of existing technologies for monitoring postpartum uterine involution in dairy cows has been improved, achieving efficient and accurate prediction of uterine involution and assessment of its physiological rationality.

CN121661676APending Publication Date: 2026-03-13CHINA AGRI UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies for monitoring postpartum uterine involution in dairy cows rely on manual measurements and fail to fully utilize continuous monitoring data over multiple days, resulting in insufficient accuracy and reliability of prediction results and an inability to comprehensively reflect the dynamic changes in uterine involution.

Method used

A prediction method based on multimodal and multiscale attention fusion is adopted. By combining ultrasound image sequences and uterine artery resistance index time series, image coding branch, time coding branch, gating fusion unit, multiscale self-attention fusion unit, focal multilayer perceptron and intermediate auxiliary branch, the probability of uterine involution is generated.

Benefits of technology

It improves the accuracy and physiological rationality of uterine involution prediction, adapts to actual clinical data collection conditions, reduces model complexity, and supports low-latency deployment in edge computing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661676A_ABST
    Figure CN121661676A_ABST
Patent Text Reader

Abstract

The invention provides a dairy cow postpartum uterus involution prediction method and system based on multi-modal multi-scale attention fusion, and relates to the field of deep learning, and the method comprises the steps: obtaining bimodal input data, and carrying out the preprocessing of the bimodal input data; uterine involution prediction is carried out through a uterus involution prediction model, specifically, an image coding branch extracts a comprehensive image feature vector of a B-mode ultrasound image sequence, a time sequence coding branch extracts a time sequence feature vector of a uterus artery resistance index time sequence, and a gating fusion unit carries out uterine involution prediction on the basis of the comprehensive image feature vector and the time sequence feature vector. A multi-scale self-attention fusion unit carries out parallel modeling on a plurality of receptive fields and outputs a second fusion vector, a focus multi-layer perceptron generates a focus feature, a middle-term auxiliary branch generates a middle-term prior feature corresponding to a first target day, and double output heads carry out multi-scale self-attention fusion on the first target day based on the middle-term prior feature and the focus feature. And outputting the involution probability of the first target day and the second target day. The method has the advantage of improving the accuracy of uterus involution prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of deep learning, and in particular to a method and system for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion. Background Technology

[0002] The postpartum uterine involution process in dairy cows directly affects their reproductive health and subsequent reproductive performance, thus impacting the economic benefits of the entire dairy farming industry. Poor uterine involution can lead to prolonged estrus intervals, reduced conception rates, and even infertility, increasing farming costs and reducing efficiency. Therefore, accurately monitoring and predicting the postpartum uterine involution process in dairy cows, and promptly identifying abnormalities and taking appropriate measures, is crucial for ensuring the sustainable development of the dairy farming industry.

[0003] In existing technologies, transrectal Doppler ultrasound can be used to continuously monitor uterine involution in dairy cows; however, this technology has significant limitations. It relies heavily on manual measurement or single-period interpretation, meaning the accuracy and consistency of the measurement results can be affected by human factors, and its efficiency is low. More importantly, it does not integrate early multi-day imaging with blood flow timelines within the same model end-to-end, failing to fully utilize the information contained in continuous multi-day monitoring data and making it difficult to comprehensively and accurately reflect the dynamic changes in uterine involution. Perinatal data-driven early prediction approaches are based on behavioral sensing and routine clinical information. Rumination duration and activity levels are collected in short time windows before and after calving, combined with variables such as parity, dystocia, and body condition, to construct logistic regression or tree models for predicting the risk and treatment outcomes of diseases such as metritis. However, this approach also has shortcomings. It typically does not incorporate ultrasound images and blood flow details, which can intuitively and accurately reflect the morphological structure and hemodynamic changes of the uterus and are important bases for judging the state of uterine involution. Due to the lack of this crucial information, the technology has insufficient grasp of the involution status at the lesion level, making it difficult to accurately assess the specific situation of uterine involution. Furthermore, the lack of cross-stage joint prediction and calibration prevents the full utilization of data from different stages for comprehensive analysis and prediction, thus affecting the accuracy and reliability of the prediction results.

[0004] Therefore, there is a need to provide a method and system for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, so as to improve the accuracy of uterine involution prediction. Summary of the Invention

[0005] This invention provides a method for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, comprising: acquiring and preprocessing bimodal input data, wherein the bimodal input data includes ultrasound image sequences and uterine artery resistance index time series; and predicting uterine involution based on the preprocessed bimodal input data using a uterine involution prediction model, wherein the uterine involution prediction model includes an image coding branch, a time-series coding branch, a gated fusion unit, a multiscale self-attention fusion unit, a focus multilayer perceptron, a mid-term auxiliary branch, and a dual-output head, wherein the image coding branch is used to extract comprehensive image features from the ultrasound image sequences. The system comprises the following components: a temporal coding branch for extracting temporal feature vectors from the uterine artery resistance index time series; a gated fusion unit for outputting a first fusion vector based on the integrated image feature vector and the temporal feature vector; a multi-scale self-attention fusion unit for parallel modeling across multiple receptive fields based on the first fusion vector and outputting a second fusion vector; a focal multilayer perceptron for generating focal features based on the second fusion vector; a mid-term auxiliary branch for generating mid-term prior features corresponding to the first target day; and a dual-output head for outputting the restoration probabilities of the first and second target days based on the mid-term prior features and the focal features.

[0006] Furthermore, the ultrasound image sequence includes ultrasound images from multiple consecutive detection days; the image coding branch includes multiple parallel image branches and an aggregation layer, with one parallel image branch corresponding to one detection day, and multiple parallel image branches sharing convolutional kernel parameters; the parallel image branch includes multiple repeating components and a global average pooling layer, wherein the repeating components include feature extraction units as well as channel attention and spatial attention units, and adjacent repeating components are connected in a residual manner; the global average pooling layer is used to output the representation vector corresponding to the parallel image branch; the aggregation layer is used to combine the acquisition mask and quality weight to aggregate the representation vector corresponding to each parallel image branch to generate a comprehensive image feature vector.

[0007] Furthermore, the gated fusion unit outputs a fusion vector based on the integrated image feature vector and the temporal feature vector, including: determining the adaptive weights of the integrated image feature vector and the temporal feature vector; and outputting the fusion vector based on the adaptive weights of the integrated image feature vector and the temporal feature vector.

[0008] Furthermore, the gated fusion unit determines the adaptive weights of the integrated image feature vector and the temporal feature vector by: normalizing the integrated image feature vector and the temporal feature vector and concatenating them to generate a concatenated feature vector; generating unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector based on the concatenated feature vector through a gated network; and adjusting the unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector based on a modal availability mask, and then normalizing them to generate adaptive weights for the integrated image feature vector and the temporal feature vector.

[0009] Furthermore, the multi-scale self-attention fusion unit is used to model in parallel across multiple receptive fields based on the first fusion vector and output a second fusion vector, including: generating image token sequences and uterine artery resistance index time token sequences arranged by postpartum age corresponding to the ultrasound image sequence and the uterine artery resistance index time sequence; generating a stacked sequence based on the image token sequence, the uterine artery resistance index time token sequence and the fusion vector; and calculating multi-head self-attention with different window sizes and expansion coefficients at multiple scales for the stacked sequence based on mask bias, modality type bias, relative age bias and time difference attenuation term, and outputting the second fusion vector.

[0010] Furthermore, the focus multilayer perceptron generates focus features based on the second fusion vector, including: dividing the second fusion vector into multiple groups; For each group, generate a group-level representation vector. Based on the group's statistics and quality factors, generate a descriptor for the group. Through a gating network, generate the weights for the group. Based on the weights for the groups, perform a weighted summation on multiple groups. After linear mapping, add the residuals of the summation to the second fusion vector to obtain the focal features.

[0011] Furthermore, the intermediate auxiliary branch generates intermediate prior features corresponding to the first target date, including: generating intermediate prior features corresponding to the first target date based on the ultrasound image and uterine artery resistance index corresponding to the first target date.

[0012] Furthermore, the loss function used to train the uterine involution prediction model is related to multi-task weighted cross-entropy, prior consistency, probability calibration constraints, gating stability, and group sparsity regularization.

[0013] Furthermore, the loss function is: in, For the total loss, As the time difference decay weight, For multi-task weighted cross-entropy, For probability calibration constraints, For prior consistency, For gating stability, For group sparse regularization.

[0014] This invention provides a postpartum uterine involution prediction module for dairy cows based on multimodal and multiscale attention fusion. Applying the aforementioned method for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, the module includes: a data acquisition module for acquiring and preprocessing bimodal input data, wherein the bimodal input data includes ultrasound image sequences and uterine artery resistance index time series; and an involution prediction module for predicting uterine involution based on the preprocessed bimodal input data using a uterine involution prediction model, wherein the uterine involution prediction model includes an image coding branch, a time-series coding branch, a gated fusion unit, a multiscale self-attention fusion unit, a focus multilayer perceptron, a mid-term auxiliary branch, and a dual-output head. The image coding branch is used to extract the comprehensive image feature vector of the B-ultrasound image sequence, the temporal coding branch is used to extract the temporal feature vector of the uterine artery resistance index time series, the gated fusion unit is used to output a first fusion vector based on the comprehensive image feature vector and the temporal feature vector, the multi-scale self-attention fusion unit is used to model in parallel on multiple receptive fields based on the first fusion vector and output a second fusion vector, the focal multilayer perceptron is used to generate focal features based on the second fusion vector, the intermediate auxiliary branch is used to generate intermediate prior features corresponding to the first target day, and the dual output head is used to output the restoration probability of the first target day and the second target day based on the intermediate prior features and the focal features.

[0015] Compared with existing technologies, the method and system for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion provided by this invention have at least the following beneficial effects: 1. Integrating ultrasound image sequences and uterine artery resistance index time series creates a dual representation of anatomical structure and hemodynamics. Ultrasound images provide intuitive spatial information on uterine morphology and involution progress, while the uterine artery resistance index time series reflects the dynamic characteristics of changes in uterine artery blood flow. The two complement each other to comprehensively characterize the postpartum uterine recovery status. Time window constraints (e.g., days 2-15) focus on the critical recovery period, avoiding irrelevant data interference, allowing the uterine involution prediction model to focus on learning physiologically relevant features, thereby improving the physiological rationality and clinical interpretability of the prediction.

[0016] 2. The parallel image branching with shared weights across multiple days reduces the risk of overfitting due to differences in daily imaging. It combines channel attention and spatial attention units to suppress ultrasound speckle noise and dynamically focuses on key anatomical structures such as the uterine region. The day-by-day masking mechanism of the temporal coding branch masks uncollected data, preventing bias introduced by missing values. The gated fusion unit adaptively allocates weights based on modality quality, automatically reducing weights when a single modality is of low quality or missing, ensuring the stability of the fused features. These designs enable the uterine involution prediction model to remain robust under noisy and missing data conditions, adapting to actual clinical acquisition conditions.

[0017] 3. The multi-scale self-attention fusion unit simultaneously captures local details (such as daily changes in uterine contour) and long-term dependencies across days (such as morphology-blood flow trend correlations) by performing parallel attention calculations across different receptive fields, thus addressing the shortcomings of traditional single-scale attention in modeling complex temporal relationships. The focal multilayer perceptron recalibrates the fused features through channel grouping, strengthening the discriminative subspace (such as channels related to reverting key indicators), suppressing redundant dimensions, and further improving feature separability. This multi-granularity modeling and dynamic weighting mechanism enables the model to stably extract cross-modal temporal relationships even with small sample conditions.

[0018] 4. The intermediate auxiliary branch extracts intermediate prior features corresponding to the first target day and injects them into the dual output head, providing physiological milestone guidance for the recovery probability of the second target day and alleviating the dependence of long-term prediction on time-series modeling. The dual output head design directly connects to the recovery probabilities of the first and second postpartum target days, meeting the dual-stage needs of veterinary clinical practice for intermediate assessment and final diagnosis. Parameter sharing strategies and lightweight module designs (such as dilated convolution and depthwise separable convolution) reduce model complexity, support low-latency deployment, and are suitable for edge computing scenarios in ranches, improving the feasibility of technology implementation. Attached Figure Description

[0019] This specification will be further described by way of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting; in these embodiments, the same reference numerals denote the same structures, wherein: Figure 1 This is a flowchart illustrating a method for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, as shown in some embodiments of this specification. Figure 2 This is a schematic diagram illustrating the process of preprocessing historical measured data from the upstream of the watershed where the forecast section is located, based on some embodiments of this specification. Figure 3 This is a schematic diagram of the structure of a multi-day shared weight medical image encoder according to some embodiments of this specification; Figure 4This is a schematic diagram of the structure of a multi-scale self-attention fusion unit according to some embodiments of this specification; Figure 5 This is a schematic diagram of a module of a dairy cow postpartum uterine involution prediction system based on multimodal and multiscale attention fusion, as shown in some embodiments of this specification. Detailed Implementation

[0020] To more clearly illustrate the technical solutions of the embodiments in this specification, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some examples or embodiments of this specification. For those skilled in the art, these drawings can be applied to other similar scenarios without creative effort. Unless obvious from the context or otherwise specified, the same reference numerals in the drawings represent the same structures or operations.

[0021] Figure 1 This is a flowchart illustrating a method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion, as shown in some embodiments of this specification. Figure 1 As shown, the method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion may include the following steps: Step 110: Obtain bimodal input data and perform preprocessing.

[0022] The bimodal input data includes ultrasound image sequences and a uterine artery resistance index time series. The ultrasound image sequences consist of ultrasound images from multiple consecutive monitoring days. The uterine artery resistance index time series can include uterine artery resistance indices from multiple consecutive monitoring days. The multiple consecutive monitoring days corresponding to the ultrasound image sequences and the uterine artery resistance index time series are consistent.

[0023] Preprocessing of ultrasound image sequences can include size unification, intensity normalization, interface element removal, and mask sequence generation. Specifically, all ultrasound images are resampled to a fixed resolution (512×512 pixels) to eliminate differences in device resolution. Z-score normalization is performed on image pixel values ​​to reduce intensity drift caused by different days and device auto-gain. Interface elements at image edges (such as device logos, scales, and text overlays) are masked or removed to avoid interference from irrelevant information. Motion artifacts or saturation stripe areas are partially masked (e.g., locally filled or blurred) to reduce noise. If the uterine artery resistance index value for a certain day is missing, linear interpolation is used to fill it in, maintaining the continuity of the time series trend. If the ultrasound image on day t is valid, then m t =1; if missing (including original missing values ​​and imputed values), then m t =0.

[0024] Preprocessing of the uterine artery resistance index (RI) time series can include missing value handling and mask sequence generation. Specifically, if the RI value for a certain day is missing, linear interpolation is used to fill the missing value, maintaining the continuity of the time series trend. If the RI value on day t is valid, then m... t =1; if missing (including original missing values ​​and imputed values), then m t =0.

[0025] Missing days for ultrasound image sequences and uterine artery resistance index time series are recorded and a joint mask is generated for subsequent gating fusion units to determine modality availability. If both modalities are missing on a given day, that day's data is excluded from the statistics.

[0026] By standardizing size, intensity, and interface masking, the impact of non-task-related factors such as device parameters and operating habits on feature learning is reduced. Linear interpolation and masking mechanisms utilize some effective data while avoiding missing values ​​from interfering with the model.

[0027] Step 120: Using the uterine involution prediction model, uterine involution is predicted based on the preprocessed bimodal input data.

[0028] The uterine involution prediction model includes an image coding branch, a temporal coding branch, a gated fusion unit, a multi-scale self-attention fusion unit, a focal multilayer perceptron, a mid-term auxiliary branch, and a dual-output head. The image coding branch is used to extract the comprehensive image feature vector of the ultrasound image sequence. The temporal coding branch is used to extract the temporal feature vector of the uterine artery resistance index time series. The gated fusion unit is used to output the first fusion vector based on the comprehensive image feature vector and the temporal feature vector. The multi-scale self-attention fusion unit is used to model in parallel on multiple receptive fields based on the first fusion vector and output the second fusion vector. The focal multilayer perceptron is used to generate focal features based on the second fusion vector. The mid-term auxiliary branch is used to generate the mid-term prior features corresponding to the first target day. The dual-output head is used to output the involution probability of the first target day and the second target day based on the mid-term prior features and the focal features.

[0029] In some embodiments, the image coding branch employs a multi-day shared weight medical image encoder, such as... Figure 3 As shown, it includes multiple parallel image branches and aggregation layers. One parallel image branch corresponds to one detection day. Multiple parallel image branches share convolution kernel parameters. The convolution kernel parameters of all row image branches are completely shared, rather than modeling each date independently. This significantly reduces the number of model parameters, avoids overfitting, forces images from different dates to extract basic features through the same transformation, and weakens the impact of operator differences and equipment fluctuations on feature distribution. The parallel image branch comprises multiple repeating components and a global average pooling layer. The repeating components include feature extraction units, channel attention units, and spatial attention units. Adjacent repeating components are connected via residuals. The global average pooling layer outputs the representation vector corresponding to the parallel image branch. The repeating components include convolutional layers, batch normalization, and the GELU (Gaussian Error Linear Unit) activation function to achieve nonlinear feature transformation. The channel attention and spatial attention units adaptively adjust the weights of each channel through global pooling and MLP (Multilayer Perceptron) to suppress noisy channels (such as speckle-dominated channels). Convolution focuses on key regions, suppressing invalid background or artifact regions. Adjacent components are connected via residuals to alleviate the gradient vanishing problem in deep networks and accelerate training convergence. Multiple stacked repeating components progressively extract multi-level features from edge texture to higher-order semantics. At the end of each branch, global average pooling compresses the high-dimensional feature map into a low-dimensional representation vector. (e.g., 512-dimensional), where t represents the detection day. Spatial dimensions are removed, but channel-level global information is retained for easier subsequent cross-day aggregation. The aggregation layer combines the acquisition mask and quality weights to aggregate the representation vectors corresponding to each parallel image branch, generating a comprehensive image feature vector. The quality weights are dynamically adjusted based on image quality (e.g., signal-to-noise ratio, artifact severity), with higher quality images receiving larger weights. For example, for each detection day, the product of the low-dimensional representation vector, mask, and quality weights for that day can be calculated, and the sum of these products for each detection day is used as the comprehensive image feature vector. The mask filters out invalid days to prevent them from interfering with the comprehensive features, while the quality weights make the model focus more on high signal-to-noise ratio images, improving feature reliability.

[0030] To enhance the characterization of speckle noise and low-contrast structures, the channel attention and spatial attention units innovatively introduce global standard deviation pooling on the basis of traditional global average pooling and max pooling, forming a three-path (mean / maximum / standard deviation) joint description mechanism: standard deviation pooling sensitively captures the pixel fluctuation characteristics of the speckle region in B-ultrasound, and combined with the nonlinear mapping of the shared two-layer MLP, the generated channel weights can accurately characterize the speckle undulations and tissue contrast changes at the uterine boundary, especially strengthening the response to subtle morphological changes during the involution process; at the same time, sample-level correction is applied to the channel weights through quality factors (such as signal-to-noise ratio) and modal masks. When the B-ultrasound image is blurred or the modality is missing on a certain day, the corresponding channel weights are dynamically suppressed to avoid low-quality data interfering with feature learning. This logic is consistent with the design of the upstream gated fusion unit. To address the detection requirements of elongated structures (such as the uterine outline) and low-contrast regions in ultrasound imaging, the standard 7×7 convolution is replaced with a 5×5 dilated convolution (d=2) or a depth-separable dilated convolution. The dilated convolution expands the receptive field to an equivalent 7×7 range through interval sampling, capturing the drift changes in uterine position across days with low parameter counts. The depth-separable design further reduces computational overhead, adapting to edge device deployments. Simultaneously, the sparse sampling mechanism with a dilation rate of d=2 skips densely populated speckle noise regions, focusing on more discriminative long-range contextual information. Furthermore, the strategy of sharing attention parameters across multiple day branches effectively suppresses feature shifts caused by imaging conditions on different days (such as probe pressure and gain settings), reduces model redundancy through parameter reuse, and ensures low-latency real-time prediction.

[0031] The temporal coding branch is used to extract dynamic temporal feature vectors from the uterine artery resistance index time series, capturing the trend of uterine artery resistance changes over time (such as recovery rate and fluctuation patterns). Simultaneously, a masking mechanism is used to shield the influence of missing data, ensuring the robustness of feature extraction. The temporal coding branch can employ sequence modeling networks (such as LSTM (Long Short-Term Memory Network) / Transformer) to extract dynamic temporal feature vectors from the uterine artery resistance index time series. If there are missing data in the sequence (e.g., day 5 is invalid), aggregation only considers m... t The hidden states with a value of 1 are weighted averaged to generate time series feature vectors.

[0032] For example, images from each day are input into an encoder with the same set of weights, and channel attention and spatial attention units (CBAM) are concatenated at each stage to suppress speckle and cross-day imaging drift; each day's images are then subjected to global average pooling at the end of the branch to obtain a low-dimensional representation vector. Subsequently, on The composite image feature vector is obtained by aggregating the features based on the day-to-day mask (missing days are excluded) and optional quality weights. Then, a multilayer perceptron with a focal spot can be connected to perform shared mapping and learnable weight recalibration by channel grouping, outputting the final image features. Compared with schemes that only share weights in a single period or do not share weights, this structure improves longitudinal consistency and reduces parameters through cross-day sharing, and adapts to ultrasound speckle, incomplete acquisition, and operator differences through CBAM noise suppression and mask management.

[0033] In some embodiments, the gated fusion unit outputs a fusion vector based on the integrated image feature vector and the temporal feature vector, including: Determine the adaptive weights for the integrated image feature vector and the temporal feature vector; Based on adaptive weights of integrated image feature vectors and temporal feature vectors, a fused vector is output.

[0034] In some embodiments, the gated fusion unit determines adaptive weights for the synthesized image feature vector and the temporal feature vector, including: The integrated image feature vector and temporal feature vector are normalized and then stitched together to generate a stitched feature vector. Based on the stitched feature vectors, unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector are generated by a gated network. Based on the modal availability mask, the unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector are adjusted and then normalized to generate adaptive weights for the integrated image feature vector and the temporal feature vector.

[0035] Specifically, the gated fusion process achieves adaptive fusion of multimodal features through dynamic weight allocation. First, the integrated image feature vector... and time series feature vectors Normalization is performed to eliminate scale differences between modalities to improve training stability; subsequently, the normalized composite image feature vector is... Temporal feature vectors , mask and quality factor The vectors are concatenated to form a gated input vector, where... This is the mask for the ultrasound image. This is a mask for the uterine artery resistance index.

[0036] The gated network employs a two-layer MLP structure, generating unnormalized weights for images and temporal modalities based on the input vector. Its numerical value implicitly reflects the reliability of the feature. To address the issue of missing data, a modal availability mask is introduced by adding a logarithmic bias term (such as...). ,in, For the mask, The unnormalized weights are adjusted using minimal positive numbers. When a modality is missing, its weight is forced to approach negative infinity to ensure that the weight approaches zero after subsequent normalization. Simultaneously, bias terms induced by quality factors (such as image signal-to-noise ratio or temporal smoothness score) are incorporated to ensure that the weight allocation is compatible with prior data quality. The adjusted weights are then normalized using Softmax to generate adaptive weights. ,in, To achieve adaptive weights for the integrated image feature vectors, The adaptive weights for the time-series feature vectors High-quality modalities (such as those with clear images and complete time sequences) are given high weights, while low-quality or missing modalities are given reduced weights, thus achieving a weight allocation strategy that prioritizes high-quality modalities.

[0037] To improve interpretability and separation, channel-level recalibration is applied to both feature paths before weight allocation. By dynamically adjusting the weights of each feature channel, the model's sensitivity to key information is enhanced, while redundant or noisy channels are suppressed. ,in, This is the channel attention transformation matrix for synthesizing image feature vectors. This is the channel bias term for the integrated image feature vector. This is the channel weight vector of the integrated image feature vector. The channel attention transformation matrix of the temporal feature vector. For the channel bias term of the time series feature vector, The channel weight vector of the temporal feature vector is used to output the fused vector. .

[0038] The gated fusion unit uses masking to block invalid data, quality factors to guide weight learning, and gated networks to dynamically adjust weights. Even when data is missing or modal quality is inconsistent, it can still extract robust cross-modal representations, significantly improving the reliability of downstream tasks such as postpartum recovery assessment.

[0039] Figure 4 This is a schematic diagram of the structure of a multi-scale self-attention fusion unit according to some embodiments of this specification, such as... Figure 4 As shown, in some embodiments, the multi-scale self-attention fusion unit is used to model in parallel across multiple receptive fields based on a first fusion vector, and output a second fusion vector, including: Generate ultrasound image sequences and uterine artery resistance index time series corresponding to postpartum age-arranged image token sequences and uterine artery resistance index time token sequences; Based on the image token sequence, the uterine artery resistance index time token sequence, and the fusion vector, a stacked sequence is generated; Based on mask bias, modality type bias, relative age bias, and time difference decay term, multi-head self-attention with different window sizes and inflation coefficients is calculated for stacked sequences at multiple scales, and a second fusion vector is output.

[0040] In a specific embodiment, the attention calculation process of the multi-scale self-attention fusion unit can be further defined as follows. First, the image token sequence corresponding to the ultrasound images arranged by postpartum age, the uterine artery resistance index time token sequence, and the fusion vector output by the gated fusion unit are used as global tokens. These tokens are stacked in the order of "[global token, (day 2 image token, day 2 resistance index token), (day 3 image token, day 3 resistance index token), ...]" to generate a unified sequence z = [z1, z2, ..., z N For example, the tokens are first stacked to form a sequence z, which is then fed in parallel into a multi-scale attention branch: scale 1 uses window 3 and dilation 1 to model the local neighborhood, scale 2 uses window 5 and dilation 1 to cover mid-range dependencies, and scale 3 uses window 7 and dilation 2 to capture long-range dependencies. Multi-head self-attention is used within each scale, and the same mask is shared to mask missing time steps. The outputs of the three scales are then processed with learnable weights. The mixture is normalized to obtain the fused representation H, whose dimension is consistent with the upstream, and then enters the focus.

[0041] For the i-th token in the sequence, record its postpartum age tag. Modal type tags (For example, representing image mode, drag index mode, and global mode respectively) and validity markers (Indicates whether the corresponding detection date is missing).

[0042] To simultaneously model local and long-range dependencies, multi-head self-attention computation at multiple scales is performed in parallel on the sequence z. For the s-th scale, a pre-defined window size is used. and expansion coefficient At this scale, for the i-th token, only if the index difference... satisfy And Δp is the expansion coefficient. Only when the value is an integer multiple of the value, is the j-th token included in the attention neighborhood of the i-th token at scale s; otherwise, it is considered to be outside the receptive field.

[0043] At each scale s and each attention head h, the query matrix Q is obtained by linearly mapping the stacked sequence z. (s,h) Key matrix K (s,h) The sum-value matrix V (s,h)For the i-th token and its neighborhood j-th token, first calculate the basic score: in, This represents the vector dimension for each attention head. Based on the basic score, mask bias, modality type bias, relative age bias, and time difference decay term are introduced to form a comprehensive score: Among them, mask offset Used to simultaneously encode window structure constraints and missing day masking rules: When the j-th token is not within the window and dilation neighborhood corresponding to the s-th scale, or its validity flag valid(j) = 0, Set to a preset large negative value (e.g., -10). 9 The attention weight at that position is approximately 0 after softmax normalization; the mask bias is 0 only when the j-th token is within the window and is a valid detection day.

[0044] Modal type bias This is used to explicitly model the prior relationships between different modal pairs. In one embodiment, modal type labels are encoded as discrete values ​​(e.g., image modality, drag index modality, and global modality are labeled as 0, 1, and 2, respectively), and a learnable bias matrix B of size 3×3 is constructed. type , where matrix element B type [a, b] represents the type bias value from the query token of modality a to the key token of modality b. For the i-th and j-th tokens, we have: in, Let i be the modal type label of the i-th token. Let be the modal type label for the j-th token.

[0045] Through training, the bias values ​​of corresponding modal pairs such as image-drag index and global-image in the matrix are automatically adjusted to enhance cross-modal alignment and global information convergence capabilities.

[0046] Relative age bias This is used to encode the relative prior relationship between different postpartum ages. Specifically, for the i-th and j-th tokens, the age difference is calculated: in, Let j be the postpartum age of the j-th token. Let i be the postpartum age of the i-th token.

[0047] To control parameter size and avoid instability caused by abnormally large age differences, one can... The truncated relative age difference is obtained within a preset range [-Dmax, Dmax]. And construct a relative age offset lookup table B with a length of 2Dmax + 1. age (For learnable vectors), by index To obtain the bias value, i.e.: .

[0048] This method allows for the automatic learning of different attention bias patterns between "same postpartum days, adjacent postpartum days, and distant postpartum days" during the training process, thereby enhancing vertical alignment capabilities.

[0049] Time difference decay term This is used to suppress historical information from distant locations based on actual sampling time intervals, adapting to irregular clinical data collection conditions. Specifically, for each token, the actual sampling time of its corresponding test is recorded. (For example, the actual postpartum date in days), calculate the time difference: in, Let i be the time difference between the i-th token and the j-th token. For the i-th token, record the actual sampling time of its corresponding detection. Record the actual sampling time of the corresponding detection for the j-th token.

[0050] Given a nonnegative attenuation coefficient (Can be preset or learned during training), definition of time difference decay term: This causes the attention score to decrease linearly in logarithmic space as the detection time interval increases, while the weights after softmax normalization decay exponentially. Optionally, when the time difference exceeds a preset threshold, it can also be... By setting the bias term to a large negative value, historical information that is too early or too late is completely masked. After introducing the above bias term, a softmax function is used to score the overall results for a fixed scale s, attention head h, and query token i. Normalize j within its neighborhood to obtain attention weights, then... The context representation at scale s is obtained by weighted summation.

[0051] The outputs of all attention heads are concatenated along the channel dimension and then linearly transformed to obtain the output features corresponding to scale s. .

[0052] To achieve adaptive fusion of multi-scale information, a learnable scalar can be introduced for each scale s. The scale weights are obtained by normalizing them using the softmax function. And press: We then perform weighted aggregation on the outputs at each scale to obtain a second fusion vector that combines local refinement with global semantics.

[0053] The second fusion vector can be taken as the feature corresponding to the global token position in the fusion sequence, or as the global representation obtained after pooling all token features, and used for subsequent focus multilayer perceptrons and dual output heads.

[0054] Specifically, the multi-scale self-attention fusion unit achieves multi-dimensional feature alignment and fusion by dynamically modeling cross-modal and temporal dependencies. This unit first encodes the ultrasound image sequence and the uterine artery resistance index time series into image token sequences and uterine artery resistance index time token sequences, respectively, and arranges them in chronological order to preserve the longitudinal recovery trajectory. Simultaneously, it introduces the fusion vector output by the gating fusion unit as higher-order semantic guidance, stacking the three types of tokens into a unified sequence z to construct a cross-modal-temporal joint representation space.

[0055] To capture contextual dependencies across different scales, the multi-scale self-attention fusion unit employs a multi-scale parallel attention strategy: multi-head self-attention computations with varying window sizes and expansion coefficients are simultaneously performed on sequence z. For example, small windows focus on details within a local modality (such as daily image texture or fluctuations in the uterine artery resistance index), while large windows combine long-range cross-modal information (such as the correlation between image morphology changes and RI trends). Expanding attention, through sparse sampling, broadens the receptive field, efficiently modeling long-distance cross-day dependencies. To address the challenges of irregular clinical data acquisition, the attention scoring mechanism introduces multiple bias terms: mask bias, modality type bias, relative age bias, and time difference attenuation term, avoiding ineffective computations. Modality type bias and relative age bias explicitly encode image / RI modal differences and age interval priors, enhancing the interpretability of cross-modal and longitudinal alignment. The time difference attenuation term adjusts attention weights based on actual date intervals, suppressing noise accumulation from long-term historical data. The contextual representations output at each scale are dynamically weighted and merged using learnable weights to generate a second fusion vector that combines local refinement with global semantics. This design, through multi-granularity modeling, prior bias guidance, and adaptive merging, can still stably extract cross-modal temporal relationships in scenarios with small samples or data mismatch.

[0056] In some embodiments, the focus multilayer perceptron generates focus features based on a second fusion vector, including: The second fusion vector is divided into multiple groups; For each group, generate the group-level representation vector, generate the group descriptor based on the group's statistics and quality factor, and generate the group weights through a gating network. Based on the weights corresponding to the groups, multiple groups are weighted and summed. After linear mapping, the residuals are added to the second fusion vector to obtain the focal features.

[0057] Specifically, the focal multilayer perceptron extracts highly discriminative focal features from the second fusion vector through dynamic grouping and gated weighting mechanisms. This process first applies a hierarchical strategy to the second fusion vector, dividing it into multiple logical groups along the channel dimension. Each group shares local feature patterns. This design aims to capture the multi-granular information implicit in high-dimensional features through subspace decomposition, while simultaneously stabilizing the training process through hierarchical normalization. For each group, a compact group-level representation vector is generated through a low-rank MLP transformation. Statistical features (such as mean and standard deviation) of the group are extracted simultaneously and fused with external quality factors (such as image signal-to-noise ratio and temporal smoothness) to construct a group descriptor. This descriptor serves as a priori guide input to a lightweight gated network, generating interpretable group weights. The weight values ​​dynamically reflect the contribution of each group to the current task; for example, groups related to key physiological indicators receive higher weights. Subsequently, the weighted sum of all groups undergoes a linear mapping transformation and is added to the original second fusion vector through a residual connection. This design aggregates multiple groups of features through gated weights while preserving the integrity of the original information, preventing information bottlenecks. In particular, the dynamic grouping strategy and the mid-term prior injection mechanism work synergistically: the former adaptively adjusts the group division based on feature relevance, strengthening key channels; the latter injects pre-computed statistical priors during training, guiding the model to focus on clinically significant patterns. The final output focal features are dimensionally aligned with the upstream features, but through multi-group collaboration and gating modulation, the separability of key patterns in cross-modal temporal relationships is significantly enhanced, providing a more discriminative representation basis for subsequent prediction heads.

[0058] In some embodiments, the intermediate auxiliary branch generates intermediate prior features corresponding to the first target day, including: Based on the ultrasound image and uterine artery resistance index corresponding to the first target day, intermediate prior features corresponding to the first target day are generated.

[0059] Specifically, the ultrasound images and uterine artery resistance index corresponding to the first target day (21 days postpartum) are the actual examination data collected during the follow-up phase.

[0060] During the inference phase, the probability of involution on the first target day can be inferred solely based on ultrasound image sequences and uterine artery resistance index time series acquired from days 2 to 15 postpartum. This is achieved through image coding, temporal coding, gated fusion units, multi-scale self-attention fusion units, and a focus multilayer perceptron, extracting the second fusion vector and focus features. This means that even before the first target day has arrived or an ultrasound examination has been performed, an intermediate involution risk assessment for the first target day can still be provided in advance. The ultrasound images and uterine artery resistance index corresponding to the first target day are primarily used in the intermediate auxiliary branch to generate intermediate prior features, which are then combined with focus features to predict the involution status on the second target day. When an ultrasound examination is not performed on the first target day, the intermediate auxiliary branch can be skipped, and the prediction of uterine involution on both the first and second target days can be completed solely based on the second fusion vector and focus features.

[0061] Specifically, the ultrasound image corresponding to the first target day is first encoded using lightweight encoding: a parameter-constrained convolutional encoder is used to extract morphological features of the uterine region, and global average pooling is used to compress the spatial features into vectors, eliminating the influence of minor diurnal displacements and enhancing translation invariance. Simultaneously, the uterine artery resistance index corresponding to the first target day is nonlinearly embedded using a two-layer perceptron (including nonlinear activation), mapping the one-dimensional time-series signal to a high-dimensional feature space to capture the nonlinear dynamic pattern of resistance changes. Subsequently, the image feature vector and the RI embedding vector are concatenated along the feature dimension to form a cross-modal joint representation, and the dimension is adjusted through linear transformation to generate intermediate-term prior features.

[0062] In the dual-output head, the restoration probability of the first target day is directly predicted based on the focal feature, while the restoration probability of the second target day is predicted based on the intermediate prior feature and the focal feature. The two heads are trained in parallel, simultaneously outputting the restoration probabilities of the first and second target days.

[0063] In some embodiments, the loss function used to train the uterine involution prediction model is related to multi-task weighted cross-entropy, prior consistency, probability calibration constraints, gating stability, and group sparsity regularization. Specifically, the loss function can be: in, For the total loss, As the time difference decay weight, For multi-task weighted cross-entropy, For probability calibration constraints, For prior consistency, For gating stability and group sparsity regularization, two phases of tasks ,Label The corresponding category header's logit is probability The class-unbalanced weights are... The task weight is The sample-level time difference is Its attenuation weight The gating weight vector is Group weights of the focus MLP .

[0064] Group sparse regularization terms This constraint is used to constrain the group weights of each feature group in the focal multilayer perceptron, encouraging the retention of only a few groups that contribute most to the task, thereby improving the sparsity and interpretability at the feature subspace level. The focal multilayer perceptron divides the second fusion vector by channel into... Group 1, and for the 1st group Group learning scalar group weights (For example, non-negative coefficients output through a gating network), to achieve group-level sparsity, the following is adopted: Group sparsity regularization of the form, the regularization term is defined as ,in This is a non-negative hyperparameter used to control the strength of group sparsity regularization. If a certain group consistently contributes little to the discrimination result, its group weight is adjusted accordingly. During training, the value will be compressed to near 0 under the action of this regularization term, thereby automatically weakening or closing the corresponding feature subspace, achieving the suppression of redundant feature subspaces and the highlighting of key feature subspaces. To simplify the symbolic representation, the above... , Weighting coefficients included , It is a non-negative hyperparameter, which can be determined by tuning the validation set according to the specific task and dataset. This invention does not limit its specific value.

[0065] The sample data was stratified by cow, with no overlap between the training, validation, and test sets, and data from the same cow not crossing subsets to avoid information leakage. Common enhancement techniques such as small-angle rotation, scaling, contrast variations, and local occlusion were used during training. To improve robustness, modality and day-specific dropouts were performed randomly, allowing the network to adapt to missing inputs during the learning phase. When images and resistance indices were not strictly from the same day, loose pairing was used, with gradually decreasing weights applied based on the time difference to reduce interference from mismatched learning. The optimizer employed adaptive moment estimation with weight decay, starting the learning rate with a small initial value, minimal warm-up, and cosine annealing. Automatic precision mixing and gradient clipping were enabled to stabilize the training process. The model selection prioritized the discriminative power of the 42-day task, supplemented by probabilistic calibration error. During deployment, the optimal weights were exported to a general intermediate format, loaded into the inference engine for operator fusion and necessary precision or quantization optimization, and latency and resource consumption were tested on the target hardware. Once the threshold for first-line use was reached, the system was deployed online, and the confidence distribution was continuously monitored to maintain calibration levels.

[0066] The following explanation will be based on specific experiments.

[0067] During the on-site implementation, the cattle were first restrained, their rectum was cleaned, and the arms were lubricated. A 7.5 MHz rectal microprotrusion probe was used to acquire grayscale images in constant mode while simultaneously acquiring Doppler spectra. The Doppler beam angle was controlled between 20-60°, and the filter was set to approximately 100 Hz to suppress tissue movement interference.

[0068] The acquired ultrasound images were resampled to a uniform resolution and intensity standardized. Interface elements and scales were masked, and obvious artifact areas were masked with small blocks.

[0069] Multi-day ultrasound images from postpartum day 2 to day 15 are sequentially fed into a shared-weight image encoder. Texture and spatial structure are weighted in the channel attention and spatial attention units of each layer to suppress speckle and cross-day differences. The branch ends aggregate the features of each day into a comprehensive image vector.

[0070] In practical applications, ranches can use the uterine involution prediction model of this invention according to the following procedure: From day 2 to 15 postpartum, transrectal ultrasound images and uterine artery resistance index are collected following the steps described above. The preprocessed bimodal data is input into the uterine involution prediction model, which outputs the probability of good involution for the first target day (day 21 postpartum) and the second target day (day 42 postpartum). The probability of good involution on the first target day can be considered as an intermediate-term risk score, which can be combined with subjective assessment results such as routine rectal examinations and uterine secretion scores. When this probability is lower than a threshold preset based on historical data and ranch management strategies, it indicates that the individual has a risk of poor intermediate-term involution, facilitating veterinarians to arrange follow-up examinations or interventions in advance.

[0071] In another implementation, when the ranch performs an ultrasound examination on the first target day and actually obtains the ultrasound image and uterine artery resistance index of the first target day, the examination data of that day can be sent as a supplementary input to the intermediate auxiliary branch to generate intermediate prior features corresponding to the first target day. These features are then combined with the focal features obtained based on the data from days 2 to 15 to predict the recovery status on the second target day. This allows for the full utilization of intermediate examination results to optimize the accuracy of long-term (day 42) recovery prediction while maintaining the ability to predict in advance.

[0072] The combined image vectors are then fed into a focal multilayer perceptron. Features are grouped by channel and subjected to a nonlinear transformation using a shared structure. Subsequently, they are recalibrated using learnable importance weights to obtain focal image features. Simultaneously, the drag index time series is fed into a time-series encoder to obtain a time-series vector. A mask ensures that days not captured are not included in the calculation.

[0073] The focal image features and temporal vectors are adaptively matched by a gated fusion unit to obtain a fused vector, which then enters a multi-scale self-attention module. Attention is calculated in parallel under different window sizes and weighted and merged to output a fused representation that includes cross-modal and cross-schedule relationships.

[0074] For the discrimination on day 42, an intermediate prior result from day 21 is introduced. The image acquired on day 21 is lightweight encoded and globally averaged to obtain a vector. The drag index from day 21 is embedded through two layers of nonlinear mapping. The two are concatenated and linearly transformed to become intermediate prior features, which are then fused with the backbone for the output branch on day 42. Finally, the backbone representation enters two parallel classification heads for day 21 and day 42 respectively, and outputs the probabilities of good or poor restoration. In the validation phase, temperature scaling is used for probability calibration. In the application phase, thresholds are set according to the ranch's business objectives, and prediction results with confidence are provided. This method can also infer when only images or only drag index are available. Gating automatically reduces the weight of missing modalities and provides corresponding confidence levels. The channel importance from the image encoding branch can be used for dynamic grouping, dividing them into core and auxiliary groups, and the prior vector μ from day 21 is used. 21 Inject into the core group and then enter the shared folder. Group gate control This is to improve the consistency and stability of the judgment on day 42.

[0075] In an experiment conducted on a dairy farm with 10,000 cows, transrectal ultrasound and resistance index data from 160 lactating Holstein cows were included. During training data labeling, experienced veterinarians, based on existing clinical guidelines, comprehensively evaluated rectal examination results, uterine secretion scores, and ultrasound findings during postpartum follow-up. Individuals meeting the preset recovery criteria were labeled "good recovery," while those showing significant lag or abnormalities were labeled "poor recovery," serving as supervisory labels for the model on the first and second target days. Images and time series from day 2 to day 15 postpartum were collected and uniformly preprocessed. Data were stratified and randomly divided into training, validation, and test sets by cow, with no overlap between sets and no cow crossing subsets. Training was performed on four 24GB GPUs, employing weighted adaptive moment estimation and a learning rate strategy of preheating followed by cosine annealing. Automatic mixed precision and gradient pruning were used to ensure stable convergence. After temperature scaling calibration on the validation set, the model was exported to a general intermediate format, and operator fusion and acceleration were performed on the inference engine to meet the first-line latency requirements. The results show that, compared with models using only images or only resistance indices, the uterine involution prediction model proposed in this specification has higher discriminative power on the day 21 and day 42 tasks, and still maintains usable performance and good calibrability even with approximately 30% of the days missing.

[0076] Figure 5 This is a schematic diagram of a module of a dairy cow postpartum uterine involution prediction system based on multimodal and multiscale attention fusion, as shown in some embodiments of this specification. Figure 5 As shown, the postpartum uterine involution prediction system for dairy cows based on multimodal and multiscale attention fusion can include a data acquisition module and an involution prediction module.

[0077] The data acquisition module is used to acquire and preprocess bimodal input data, which includes ultrasound image sequences and uterine artery resistance index time series. The uterine involution prediction module is used to predict uterine involution based on preprocessed bimodal input data using a uterine involution prediction model. The uterine involution prediction model includes an image coding branch, a temporal coding branch, a gated fusion unit, a multi-scale self-attention fusion unit, a focal multilayer perceptron, a mid-term auxiliary branch, and dual output heads. The image coding branch extracts the comprehensive image feature vector from the ultrasound image sequence; the temporal coding branch extracts the temporal feature vector from the uterine artery resistance index time series; the gated fusion unit outputs a first fusion vector based on the comprehensive image feature vector and the temporal feature vector; the multi-scale self-attention fusion unit performs parallel modeling on multiple receptive fields based on the first fusion vector and outputs a second fusion vector; the focal multilayer perceptron generates focal features based on the second fusion vector; the mid-term auxiliary branch generates mid-term prior features corresponding to the first target day; and the dual output heads output the involution probabilities for the first and second target days based on the mid-term prior features and the focal features.

[0078] For a more detailed description of the prediction system for postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, please refer to the relevant description of the prediction method for postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion, which will not be repeated here.

[0079] Finally, it should be understood that the embodiments described in this specification are merely illustrative of the principles of the embodiments described herein. Other variations may also fall within the scope of this specification. Therefore, alternative configurations of the embodiments described herein are intended to be illustrative rather than limiting, and should be considered consistent with the teachings of this specification. Accordingly, the embodiments described herein are not limited to those explicitly introduced and described herein.

Claims

1. A method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion, characterized in that, include: Acquire bimodal input data and perform preprocessing, wherein the bimodal input data includes ultrasound image sequences and uterine artery resistance index time series; A uterine involution prediction model is used to predict uterine involution based on preprocessed bimodal input data. The uterine involution prediction model includes an image coding branch, a temporal coding branch, a gated fusion unit, a multi-scale self-attention fusion unit, a focal multilayer perceptron, a mid-term auxiliary branch, and a dual-output head. The image coding branch extracts a comprehensive image feature vector from the ultrasound image sequence. The temporal coding branch extracts a temporal feature vector from the uterine artery resistance index time series. The gated fusion unit outputs a first fusion vector based on the comprehensive image feature vector and the temporal feature vector. The multi-scale self-attention fusion unit performs parallel modeling on multiple receptive fields based on the first fusion vector and outputs a second fusion vector. The focal multilayer perceptron generates focal features based on the second fusion vector. The mid-term auxiliary branch generates mid-term prior features corresponding to the first target day. The dual-output head outputs the involution probabilities for the first and second target days based on the mid-term prior features and the focal features.

2. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to claim 1, characterized in that, The ultrasound image sequence includes ultrasound images from multiple consecutive testing days; The image coding branch includes multiple parallel image branches and an aggregation layer. One parallel image branch corresponds to one detection day, and multiple parallel image branches share convolutional kernel parameters. The parallel image branch includes multiple repeating components and a global average pooling layer. The repeating components include feature extraction units, channel attention units, and spatial attention units. Adjacent repeating components are connected in a residual manner. The global average pooling layer is used to output the representation vector corresponding to the parallel image branch. The aggregation layer is used to combine the acquisition mask and quality weight to aggregate the representation vectors corresponding to each parallel image branch, generating a comprehensive image feature vector.

3. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to claim 1, characterized in that, The gated fusion unit outputs a fusion vector based on the integrated image feature vector and the temporal feature vector, including: Determine the adaptive weights for the integrated image feature vector and the temporal feature vector; Based on adaptive weights of integrated image feature vectors and temporal feature vectors, a fused vector is output.

4. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to claim 3, characterized in that, The gated fusion unit determines the adaptive weights of the integrated image feature vector and the temporal feature vector, including: The integrated image feature vector and temporal feature vector are normalized and then stitched together to generate a stitched feature vector. Based on the stitched feature vectors, unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector are generated by a gated network. Based on the modal availability mask, the unnormalized weights corresponding to the integrated image feature vector and the temporal feature vector are adjusted and then normalized to generate adaptive weights for the integrated image feature vector and the temporal feature vector.

5. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to any one of claims 1-4, characterized in that, The multi-scale self-attention fusion unit is used to model in parallel across multiple receptive fields based on the first fusion vector, and outputs a second fusion vector, including: Generate ultrasound image sequences and uterine artery resistance index time series corresponding to postpartum age-arranged image token sequences and uterine artery resistance index time token sequences; Based on the image token sequence, the uterine artery resistance index time token sequence, and the fusion vector, a stacked sequence is generated; Based on mask bias, modality type bias, relative age bias, and time difference decay term, multi-head self-attention with different window sizes and inflation coefficients is calculated for stacked sequences at multiple scales, and a second fusion vector is output.

6. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to any one of claims 1-4, characterized in that, The focal multilayer perceptron generates focal features based on the second fusion vector, including: The second fusion vector is divided into multiple groups; For each group, generate the group-level representation vector, generate the group descriptor based on the group's statistics and quality factor, and generate the group weights through a gating network. Based on the weights corresponding to the groups, multiple groups are weighted and summed. After linear mapping, the residuals are added to the second fusion vector to obtain the focal features.

7. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to any one of claims 1-4, characterized in that, The intermediate auxiliary branch generates intermediate prior features corresponding to the first target day, including: Based on the ultrasound image and uterine artery resistance index corresponding to the first target day, intermediate prior features corresponding to the first target day are generated.

8. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion according to any one of claims 1-4, characterized in that, The loss function used to train the uterine involution prediction model is related to multi-task weighted cross-entropy, prior consistency, probability calibration constraints, gating stability, and group sparsity regularization.

9. The method for predicting postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion according to claim 8, characterized in that, The loss function is: in, For the total loss, As the time difference decay weight, For multi-task weighted cross-entropy, For probability calibration constraints, For prior consistency, For gating stability, For group sparse regularization.

10. A prediction system for postpartum uterine involution in dairy cows based on multimodal and multi-scale attention fusion, characterized in that, The method for predicting postpartum uterine involution in dairy cows based on multimodal and multiscale attention fusion as described in claim 1 includes: The data acquisition module is used to acquire and preprocess bimodal input data, wherein the bimodal input data includes ultrasound image sequences and uterine artery resistance index time series; The uterine involution prediction module is used to predict uterine involution based on preprocessed bimodal input data using a uterine involution prediction model. The uterine involution prediction model includes an image coding branch, a temporal coding branch, a gated fusion unit, a multi-scale self-attention fusion unit, a focal multilayer perceptron, a mid-term auxiliary branch, and dual output heads. The image coding branch extracts a comprehensive image feature vector from the ultrasound image sequence. The temporal coding branch extracts a temporal feature vector from the uterine artery resistance index time series. The gated fusion unit outputs a first fusion vector based on the comprehensive image feature vector and the temporal feature vector. The multi-scale self-attention fusion unit performs parallel modeling on multiple receptive fields based on the first fusion vector and outputs a second fusion vector. The focal multilayer perceptron generates focal features based on the second fusion vector. The mid-term auxiliary branch generates mid-term prior features corresponding to the first target day. The dual output heads output the involution probabilities for the first and second target days based on the mid-term prior features and the focal features.