-
Notifications
You must be signed in to change notification settings - Fork 34
Description
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
gdalbuildvrtto 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
-
Processing time:
- Single band: ~10 minutes
- Multiband (4 bands): ~3.5 hours (21x slower)
-
Memory consumption: Significantly higher with multiband input, requiring reduction to 6 CPUs
-
Expected behavior: Since
s_b4match=4specifies 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
-
Performance expectation: Should multiband and single-band coregistration have similar performance when using
s_b4matchparameter? Is my assumption correct? -
Documentation interpretation: Does the current behavior align with the intended design, or am I misunderstanding the documentation?
-
Best practice: Is the two-step workaround (single-band coregistration + DeShifter) the recommended approach for multiband images?
-
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.