Repository navigation
Optimization/shadow land water probability - #456
Open
NinaHerrmann wants to merge 5 commits into
Open
NinaHerrmann wants to merge 5 commits into
NinaHerrmann wants to merge 5 commits into
Conversation
…ty and water_probability by having a function that can also pass float values
…use the histogram for quantiles instead of gdal quantile function
…improvements: variable for repeated array check and break instead of continue)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speed up
shadow_probability/land_probability/water_probabilitySummary
small) instead of GDAL full sort.The
quantile()function from GDAL first sorts a double array and then returns the quantile. While this is efficient for smaller data structures, large double arrays take some time (and come with additional memory when converting small to double). This PR implements a histogram instead. It requires less space and is faster for Satellite image sizes (Sorting isshadow_probabilityGreyscale Reconstructioncontinueis changed tobreakto exit the loop early. Moreover, inlining theenqueueanddequeuefunction allows the compiler to directly insert the function. Finally, readingMARKER[p]once and reusing it should provide slight cache improvements.This change is applied in:
force_pr/src/modules/cross-level/stats-cl.cquantile_short(),quantile_hist()andhist_short()functionssrc/modules/low-level/cloud-ll.cshadow_probability(),land_probability()&water_probabilitysrc/modules/cross-level/imagefuns-cl.cgreyscale_reconstruction_slight initalization improvement, and continue vs. break.src/modules/cross-level/queue-cl.hsrc/modules/cross-level/queue-cl.cTesting
Unit Test
Added the
test_quantile-clunit test, which compares the newquantile_short()with the previously used GDALquantile()function. I am not sure how many test you would like to have, as those also take some time in the pipeline, so I can easily reduce/increase the configuration tested (make test_quantile-cl). Or also test other functions not yet included.src/tests/test_quantile-cl.cbuild/tests/test_quantile-cl.mkbuild/tests.mkEnd-to-end test
I ran a test set of Sentinel-2 images and Landsat images with 4 processes and 4 threads. Level-2 output was compared to be bit-identical. One note about the attached graph. For the splitting in Shadow probability, I took the max of the runtime of the threads. So, sometimes greyscale + quantile would be slightly bigger than the overall loop.
Additional experiment: Downhill filter (not included)