8. Downloads

Everything you need to follow this tutorial is collected here: the three Python scripts, links to the pretrained model weights, and a small sample dataset to test on. Arrange them in the project layout below, then set the path block at the top of each script.


8.1. Scripts

Right-click β†’ Save link as…, or just click to download.

File

Purpose

Chapter

PredictEF.py

Ejection-fraction prediction

EF Prediction

PredictSegmentation.py

LV segmentation (videos + .npy)

Segmentation

CalculateStats.py

Optional MEAN/STD recomputation

Normalization Statistics

Put all three in a scripts/ folder and configure the path block at the top of each one.


8.2. Pretrained weights

Both prediction scripts load a checkpoint into WEIGHTS. Each file is larger than 100 MB, so it is not stored in this repository β€” download the two checkpoints from the ModelFLOWs-cardiac releases page and save them into EchoNet-dynamic/stats/. The script WEIGHTS paths already use the exact release file names, so no renaming is needed:

File

Model

Loaded by

Source

r2plus1d_18_32_2_pretrained.pt (~239 MB)

R(2+1)D-18 (EF regression)

PredictEF.py

Download

deeplabv3_resnet50_random.pt (~303 MB)

DeepLabV3-ResNet50 (segmentation)

PredictSegmentation.py

Download

Don’t mix up the two checkpoints

The names already match what the scripts expect β€” just drop both into stats/. Loading the EF checkpoint into the segmentation script (or vice-versa) raises a state_dict size-mismatch error, because the two heads have different output shapes.


8.3. Sample data (demo)

A small demo dataset is bundled so you can test the scripts end-to-end before switching to your own data.

File

Contents

demo.zip

An apical-4-chamber echo video in video/ (0X243FDE8AE0A05B6F.avi) and 138 single-frame .npy arrays in npy/

Unzip it into the project root so it becomes the demo/ folder, with two sub-folders, one per input type:

EchoNet-dynamic/
└── demo/
    β”œβ”€β”€ video/   0X243FDE8AE0A05B6F.avi   # the echo video
    └── npy/     frame_0000.npy … (138)   # single-frame arrays

The default INPUT_DIR is demo/video/, so both prediction scripts run on the video straight away. To process the .npy frames instead, change INPUT_DIR to demo/npy/ in PredictSegmentation.py:

  • EF prediction β€” demo/video/ (default); PredictEF.py reads the .avi.

  • Segmentation β€” video β€” demo/video/ (default); processed by Module B.

  • Segmentation β€” .npy frames β€” set INPUT_DIR to demo/npy/.

Point at a sub-folder, not at the demo root

Both scripts scan only the top level of INPUT_DIR β€” sub-folders are not searched. Pointing INPUT_DIR at demo/ itself would find nothing, because the files live one level down in video/ and npy/. That is also why the video and the frames are two separate runs.


8.4. Ground-truth labels (for validation)

To check the scripts quantitatively (see Results & Troubleshooting), use the two EchoNet-Dynamic label files. Both ship with the EchoNet-Dynamic dataset:

File

Contents

FileList.csv

Per-video true EF, ESV, EDV, Split and frame size/rate

VolumeTracings.csv (~30 MB)

LV boundary tracings (X1,Y1,X2,Y2,Frame) on the ED/ES frame of each video

The demo video is already labelled

Both label files include the bundled demo video’s row (0X243FDE8AE0A05B6F, true EF 29.9 %), so once you have them you can validate the EF by the demo without downloading all 10,030 videos.


8.5. After downloading

  1. Arrange the files into the project layout β€” scripts/, stats/ and demo/ side by side inside one EchoNet-dynamic/ folder:

    EchoNet-dynamic/
    β”œβ”€β”€ scripts/   PredictSegmentation.py Β· PredictEF.py Β· CalculateStats.py
    β”œβ”€β”€ stats/     deeplabv3_resnet50_random.pt Β· r2plus1d_18_32_2_pretrained.pt
    └── demo/      video/ Β· npy/
    
  2. Open each script and set its path block. To use your own data, point INPUT_DIR at it; results land in demo_output\.

  3. Keep the default MEAN/STD for EchoNet-style data, or recompute them with CalculateStats.py (see Normalization Statistics).

  4. Run a script β€” full walkthroughs are in Segmentation and EF Prediction.

Need the environment first? See Installation & Setup.