Skip to content

Performance Issue with Multiband Images in COREG_LOCAL #69

@SARcycle

Description

@SARcycle

Performance Issue with Multiband Images in COREG_LOCAL

Environment

  • AROSICS version: 1.11.0
  • Python version: 3.10.18
  • OS: Ubuntu 24.04.2 LTS x86_64
  • Kernel: 6.11.0-29-generic
  • CPU: AMD Ryzen Threadripper PRO 5975WX
  • GPU: NVIDIA GeForce RTX 4080
  • Memory: 128 GB

Issue Description

I'm experiencing significant performance degradation when using COREG_LOCAL with multiband images compared to single-band images, despite the documentation indicating that coregistration should use only a single band regardless of input format.

Test Setup

Data: Sentinel-2 10m tiles covering Switzerland (date: 20250619, orbit: 65)

  • Downloaded from browser.dataspace.copernicus.eu
  • Mosaicked using gdalbuildvrt to create multiband VRT (bands B02, B03, B04, B08)
  • Reference image extent equalized to match multiband VRT
  • Data validated and visualizable in QGIS

Code Used

kwargs = {
    'path_out': 'S2_mosaic_coreg.tif',
    'projectDir': '/path/to/folder',
    'q': False,
    'nodata': (0, 0),
    'out_crea_options': ['COMPRESS=DEFLATE', 'PREDICTOR=2'],
    'CPUs': 6,
    'progress': True,
    'fmt_out': 'GTIFF',
    'r_b4match': 1,
    's_b4match': 4,  # B04
    'window_size': [128, 128],
    'max_iter': 10,
    'max_shift': 5,
    'grid_res': 580,
}

# Perform coregistration
CRL = COREG_LOCAL(im_reference_masked, multiband_mosaic_10m, **kwargs)

Performance Issues Observed

  1. Processing time:

    • Single band: ~10 minutes
    • Multiband (4 bands): ~3.5 hours (21x slower)
  2. Memory consumption: Significantly higher with multiband input, requiring reduction to 6 CPUs

  3. Expected behavior: Since s_b4match=4 specifies band 3 for coregistration, I expected similar performance to single-band processing

Workaround Attempted

I tried processing only B04 directly:

multiband_mosaic_10m = '/path/to/folder/S2-L2A-mosaic_20250619T101559_B04_10m.vrt'
del kwargs['s_b4match']
CRL = COREG_LOCAL(im_reference_masked, multiband_mosaic_10m, **kwargs)

# Then apply to multiband image
im_target = '/path/to/S2-L2A-multiband_20250619T101559_10m.vrt'
DeShifter.DESHIFTER(im2shift=str(im_target), coreg_results=coreg_info, **kwargs).correct_shifts()

This approach is faster but requires an additional step, which seems counterintuitive given the documentation.

Questions

  1. Performance expectation: Should multiband and single-band coregistration have similar performance when using s_b4match parameter? Is my assumption correct?

  2. Documentation interpretation: Does the current behavior align with the intended design, or am I misunderstanding the documentation?

  3. Best practice: Is the two-step workaround (single-band coregistration + DeShifter) the recommended approach for multiband images?

  4. Different GSD support: Is there a straightforward way to apply calculated CRL results to images with the same extent but different Ground Sample Distance (GSD)?

Additional Notes

The resulting coregistration from the multiband approach appears valid, but the performance impact makes it impractical for routine processing of large datasets.

Thank you for your time and for maintaining this valuable tool. I'm happy to provide additional information or test potential solutions if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions