OSOceanAcoustics / echoregions

Interfacing water column sonar data with annotations and labels
https://echoregions.readthedocs.io/
Apache License 2.0
6 stars 6 forks source link

Add Inference Module For Hake Predictions #138

Closed ctuguinay closed 11 months ago

ctuguinay commented 11 months ago

This issue is a feature request to add a module for masking Hake on an Sv DataArray given some acoustic model weights. This module will serve as a one-place-stop for Hake Predictions for regridded Sv Data.

Type hint for the primary masking function can look like this:

def predict_hake(
    da_Sv: xr.DataArray,
    model_file: str,
) -> xr.DataArray:

The actual inference part should be a block-by-block (chunk-by-chunk) operation described by the following:

hake_mask = target_Sv[:,:,:depth_lim_px].map_blocks(
    predict_from_xarray, 
    args=[model, transform_params],
    template=template
).compute()

Since the dependencies for whichever model(s) is used will be fairly large, these dependencies should be in their own requirements folder. Call this requirements folder requirements-inference.txt and instructions should be added to the mamba create section of the docs to only install requirements-inference.txt if inference is needed.

leewujung commented 11 months ago

Hey @ctuguinay : thanks for writing this up. I was thinking more about this last night and felt that maybe we should have this in a different repo/package, and potentially a new one. The reason is the large dependency, and that the model part will be in active changes for some time. Both of these will make echoregions hard to maintain. How about we move this issue to the project repo I was working on these part few days? The functions already exist in the form described above.

ctuguinay commented 11 months ago

Yeah, the dependencies will be large. That does sound like a better idea. @leewujung

ctuguinay commented 11 months ago

Temporarily moved to Hake NASC repo.