Skip to content

Run the pipeline

The pipeline encodes images and measures quality metrics in a single pass. Both a study ID and a time budget are required:

Terminal window
just pipeline format-comparison 30m

This processes images one at a time — encoding all configured format variants and measuring quality metrics for each — until the time budget runs out.

For crop-impact studies, the pipeline first selects a fixed worst-case analysis fragment in the original image, then generates crop windows of different sizes around that fragment and measures quality only inside the fragment. This keeps the compared content identical across crop levels.

Results are saved to data/metrics/<study-id>/quality.json.

ExampleMeaning
30m30 minutes
2h2 hours
1h30m1 hour 30 minutes
36003600 seconds
90s90 seconds

These study configurations ship in config/studies/:

Study IDDescription
format-comparisonCompare JPEG, WebP, AVIF, JPEG XL
avif-speed-sweepAVIF speed parameter sweep
avif-chroma-subsamplingAVIF chroma subsampling comparison
jxl-effort-sweepJPEG XL effort level comparison
webp-method-sweepWebP method parameter sweep
resolution-impactImpact of image resolution on quality
jpeg-crop-impactJPEG crop-impact study
webp-crop-impactWebP crop-impact study
avif-crop-impactAVIF crop-impact study
jxl-crop-impactJPEG XL crop-impact study

Ensure the study’s dataset is downloaded first:

Terminal window
just fetch div2k-valid

For additional control, use the script directly:

Terminal window
# Dry run — preview what would run without executing
python3 scripts/run_pipeline.py format-comparison --time-budget 30m --dry-run
# Save encoded artifacts to disk (normally discarded after measurement)
python3 scripts/run_pipeline.py format-comparison --time-budget 1h --save-artifacts
# Control parallelism
python3 scripts/run_pipeline.py format-comparison --time-budget 30m --workers 8
  • resolution sweeps downscale the entire image before encoding. They are useful when you want to study true lower-resolution inputs, but the measured content and the behaviour of quality metrics both change with resolution.
  • crop sweeps keep the selected analysis fragment at full resolution and only reduce the surrounding image area. They are useful when you want to isolate the impact of image area and bit allocation without introducing resampling effects.
  • Crop-impact studies store two extra metadata fields per measurement: analysis_fragment for the measured fragment coordinates inside the encoded source, and crop_region for the crop window in original-image coordinates.
data/metrics/<study-id>/
└── quality.json # All quality measurements

When the study uses preprocessing, the pipeline also records source-image labels such as data/preprocessed/<study-id>/r1280/... for resized inputs or data/preprocessed/<study-id>/c800/... for cropped inputs.

With --save-artifacts, encoded images are also saved:

data/encoded/<study-id>/
├── jpeg/ # Encoded JPEG files
├── webp/ # Encoded WebP files
├── avif/ # Encoded AVIF files
└── jxl/ # Encoded JXL files

Remove all generated data for a specific study:

Terminal window
just clean-study format-comparison

Remove all study data (preserves datasets):

Terminal window
just clean-studies
Terminal window
just fetch div2k-valid # 1. Get images
just pipeline format-comparison 30m # 2. Encode + measure
just analyze format-comparison # 3. Generate plots
just compare format-comparison # 4. Visual comparisons
just report # 5. Interactive report
just serve-report # 6. View in browser

For a crop-impact study, swap in one of the *-crop-impact study IDs.