New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tie Point Grid Calculation takes ages #36
Comments
Computing 28 tie points on 24 CPU cores should be a matter of seconds. This looks rather like the code hangs somewhere in multiprocessing for some reason. To figure out what happened exactly, I would need the input data and the exact way how you installed arosics. As a workaround for now, just disable multiprocessing ( Also the rest of the above code seems a bit complicated for what it actually does. I would rather go for something like this: from arosics import COREG_LOCAL
COREG_LOCAL(
"session_000_001k_185_sprad_clipped_ORTHO.tif",
"PNEO3_2023_09_04_10_33_30_L2W_rhow_563_ortho.tif",
grid_res=50,
window_size=(256, 256),
r_b4match=50,
path_out=None,
CPUs=1,
q=False
).correct_shifts() No-data values are auto-detected, otherwise you can also set them with the |
Probably, the code hangs because of this: https://git.gfz-potsdam.de/danschef/arosics/-/issues/93. But that is just a guess and I need to have a closer look. However, to me it looks like it is a Windows-specific issue. |
Setting the I installed arosics from conda-forge into a fresh anaconda environment and later installed rioxarray, also from conda-forge. And yes I know, the code is a bit complicated at the moment,. I wanted to have the option to enhance the image quality of my hyperspectral images on the fly because this data contains few objects with little contrast. I may need to come back to you with this problem at some point in the future. |
You could let arosics ignore these areas by setting |
AROSICS v1.10.2 replaces the former multiprocessing implementation with joblib-based parallelization which should (I think) fix your issue. Would be nice if you could try it out and provide me some feedback. |
Works fine for me. All cores are used at 100 % and the computation time reduces significantly, in my particular case ~ factor 5. Thank you very much! |
Cool, thanks for trying! |
I have no problem with co-registration using the Global approach. However, the error message below occurs when trying the local registration, even when I use only 1 CPU. Different grid_res same error. Any suggestions? >>> COREG_LOCAL(
... "path_to/RefImage.tif",
... "path_to/SourceImage.tif",
... grid_res=50,
... window_size=(256, 256),
... r_b4match=1,
... path_out=None,
... CPUs=1,
... q=False
... ).correct_shifts()
Calculating footprint polygon and actual data corner coordinates for reference image...
Bounding box of calculated footprint for reference image:
(474683.0, 6686905.0, 476442.0, 6691721.0)
Calculating footprint polygon and actual data corner coordinates for image to be shifted...
Polygonize progress |==================================================| 100.0% Complete => 0:00:00
Bounding box of calculated footprint for image to be shifted:
(474682.96922200004, 6686904.749473, 476441.569222, 6691721.099473)
Matching window position (X,Y): 475562.28606702085/6689313.000074867
Initializing tie points grid...
Equalizing pixel grids and projections of reference and target image...
Warping progress |==================================================| 100.0% Complete => 0:00:18
Warping progress |==================================================| 100.0% Complete => 0:00:01
Calculating tie point grid (16692 points) using 1 CPU cores...
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
File "d:\pygis\Lib\site-packages\arosics\CoReg_local.py", line 821, in correct_shifts
self.calculate_spatial_shifts()
File "d:\pygis\Lib\site-packages\arosics\CoReg_local.py", line 491, in calculate_spatial_shifts
self._tiepoint_grid.get_CoRegPoints_table()
File "d:\pygis\Lib\site-packages\arosics\Tie_Point_Grid.py", line 345, in get_CoRegPoints_table
Parallel(n_jobs=self.CPUs, **kw_parallel)(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Parallel.__init__() got an unexpected keyword argument 'return_as' |
Thanks for reporting, looks like an incompatibility with the latest version of |
That was version: 1.3.2
|
I tried it also on my home computer, and it seems to work there, at least for a small area. The joblib version I read out earlier was from that computer. The laptop, where it doesn’t work, has the joblib version 1.2.0
|
Description
I am currently trying to perform a local co-registration of an hyperspectral image (410x410 pixels) to a PleiadesNeo scene (subsetted to ~1000x1000 pixels). scene. However, the calculation of the tie point grid takes much longer than I would expect. The last printed message says it is using all 24 CPU cores, but my total CPU usage is ~1%. It is also strange that I still can't see the progres bar of the tie point grid calculation, although the code is running for more than 50 minutes.
I already tried different
grid_res
, but the result was always the same...What I Did
And in the console:
The text was updated successfully, but these errors were encountered: