zea.models.echonetlvh¶
EchoNetLVH model for segmentation of PLAX view cardiac ultrasound.
To try this model, simply load one of the available presets:
>>> from zea.models.echonetlvh import EchoNetLVH
>>> model = EchoNetLVH.from_preset("echonetlvh")
Important
This is a zea implementation of the model.
For the original code, see here.
Reference
G. Duffy, P. P. Cheng, N. Yuan, B. He, A. C. Kwan, M. J. Shun-Shin, et al., “High-Throughput Precision Phenotyping of Left Ventricular Hypertrophy with Cardiovascular Deep Learning,” JAMA Cardiology, vol. 7, no. 4, pp. 386–395, 2022. doi.org/10.1001/jamacardio.2021.6059
See also
A tutorial notebook where this model is used: Task-based transmit beamforming perception-action loop.
Classes
|
EchoNet Left Ventricular Hypertrophy (LVH) model for echocardiogram analysis. |
- class zea.models.echonetlvh.EchoNetLVH(*args, **kwargs)[source]¶
Bases:
BaseModelEchoNet Left Ventricular Hypertrophy (LVH) model for echocardiogram analysis.
This model performs semantic segmentation on echocardiogram images to identify key anatomical landmarks for measuring left ventricular wall thickness:
LVPWd_1: Left Ventricular Posterior Wall point 1
LVPWd_2: Left Ventricular Posterior Wall point 2
IVSd_1: Interventricular Septum point 1
IVSd_2: Interventricular Septum point 2
The model outputs 4-channel logits corresponding to heatmaps for each landmark.
For more information, see the original project page: https://echonet.github.io/lvh/
Initialize the EchoNetLVH model.
- Parameters:
**kwargs – Additional keyword arguments passed to BaseModel
- call(inputs)[source]¶
Forward pass of the model.
- Parameters:
inputs (Tensor) – Input images of shape [B, H, W, C]. They should be scan converted, with pixel values in range [0, 255].
- Returns:
Logits of shape [B, H, W, 4] with 4 channels for each landmark
- Return type:
Tensor
- expected_coordinate(mask, coordinate_grid=None)[source]¶
Compute the expected coordinate (center-of-mass) of a heatmap.
This implements a differentiable version of taking the max of a heatmap by computing the weighted average of coordinates.
Reference
A. Nibali, Z. He, S. Morgan, and L. Prendergast, “Numerical Coordinate Regression with Convolutional Neural Networks,” arXiv preprint, 2018. arXiv:1801.07372
- Parameters:
mask (Tensor) – Heatmap of shape [B, H, W]
coordinate_grid (Tensor, optional) – Grid of coordinates. If None, uses
coordinate_grid.
- Returns:
Expected coordinates of shape [B, 2] in (x, y) format
- Return type:
Tensor
- extract_key_points_as_indices(logits)[source]¶
Extract key point coordinates from logits using center-of-mass calculation.
- Parameters:
logits (Tensor) – Model output logits of shape [B, H, W, 4]
- Returns:
Key point coordinates of shape [B, 4, 2] where each point is a
(row, col)index into the heatmap.- Return type:
Tensor
- overlay_labels_on_image(image, label, alpha=0.5)[source]¶
Overlay predicted heatmaps and connecting lines on the input image.
- Parameters:
image (Tensor) – Input image of shape [H, W] or [H, W, C]
label (Tensor) – Predicted logits of shape [H, W, 4]
alpha (float) – Blending factor for overlay (0=transparent, 1=opaque)
- Returns:
Image with overlaid heatmaps and measurements of shape [H, W, 3]
- Return type:
ndarray
- visualize_logits(images, logits)[source]¶
Create visualization of model predictions overlaid on input images.
- Parameters:
images (Tensor) – Input images of shape [B, H, W, C]
logits (Tensor) – Model predictions of shape [B, H, W, 4]
- Returns:
Images with overlaid predictions of shape [B, H, W, 3]
- Return type:
Tensor