open-forest-observatory / geograypher

Enabling Geospatial Predictions from Individual Drone Images
https://open-forest-observatory.github.io/geograypher/
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

Accelerate polygon labeling #119

Closed russelldj closed 6 months ago

russelldj commented 6 months ago

Assigning per-polygon labels from per-face labels becomes a bottleneck for very large meshes. This introduces a couple optimizations. The first is to use a simplified ROI to crop the mesh to the region around the polygons, since this can get expensive using the full-resolution ROI. The second is add a derived method that breaks the polygons up into clusters and labels each cluster individually. This adds overhead, but decreases the number of mesh faces and polygons used in the expensive sjoin/overlay operation. So for very large meshes, it seems beneficial.

Finally, I added some caching to the code which computes the 2D geodata representation of the mesh faces. This allows it to be called multiple times with the same input and not recompute the data, which is useful for the batched/clustered implementation.

russelldj commented 6 months ago

I also added polygon labeling to the aggregation example notebook.