dl

Deep learning based operators

source

download_dl_model

 download_dl_model (models:str|list=None, path:str=None)
Type Default Details
models str | list None deep learning models to be downloaded, all available models by default
path str None directory to save these models, inside installed Moraine package by default

Deep learning models have to be installed before use, download them by:

download_dl_model()
Downloading https://raw.githubusercontent.com/kanglcn/n2f/refs/heads/main/n2f.onnx to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2f.onnx
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2f.onnx' downloaded successfully.
Downloading https://raw.githubusercontent.com/kanglcn/n2f/refs/heads/main/n2fs3d.onnx to /work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2fs3d.onnx
File '/work/projects/jinwook/radarlab/kangl/moraine/moraine/dl_model/n2fs3d.onnx' downloaded successfully.

source

n2f

 n2f (intf:numpy.ndarray, chunks:tuple=None, depths:tuple=(0, 0),
      model:str=None)
Type Default Details
intf ndarray interferogram, 2d np.complex64 or cp.complex64
chunks tuple None chunksize, intf.shape by default
depths tuple (0, 0) width of the boundary
model str None path to the model in onnx format, use the model comes with this package by default

Usage:

import zarr
import numpy as np
import holoviews as hv
hv.extension('bokeh')
hv.output(widget_location='bottom')
from bokeh.models import WheelZoomTool
from holoviews import opts
rslc_zarr = zarr.open('../CLI/raw/rslc.zarr/','r')
intf = rslc_zarr[:,:,7]*rslc_zarr[:,:,13].conj()
intf.shape
(2500, 1834)
filtered_intf = n2f(intf,depths=(10,10),model='../../../noise2fringe_ps_cos/model_saved/noise2fringe_model_depth_4_0712_5/n2f.onnx')
CPU times: user 4min 6s, sys: 43.2 s, total: 4min 49s
Wall time: 5.06 s
raw_intf_plot = mr.ras_plot(np.angle(intf))
filtered_intf_plot = mr.ras_plot(np.angle(filtered_intf))
(raw_intf_plot+filtered_intf_plot).opts(
    opts.Image(
        cmap='colorwheel',width=600, height=600, colorbar=True,invert_yaxis=True,
        default_tools=['pan',WheelZoomTool(zoom_on_axis=False),'save','reset','hover'],
        active_tools=['wheel_zoom'])
)

source

n2fs3d

 n2fs3d (adi:numpy.ndarray, intf:numpy.ndarray, chunks:tuple=None,
         depths:tuple=(0, 0), model:str=None)
Type Default Details
adi ndarray amplitude dispersion index, 2d np.float32 or cp.float32
intf ndarray interferogram, 2d np.complex64 or cp.complex64
chunks tuple None chunksize, intf.shape by default
depths tuple (0, 0) width of the boundary
model str None path to the model in onnx format, use the model comes with this package by default

Usage:

import zarr
import numpy as np
import holoviews as hv
hv.extension('bokeh')
hv.output(widget_location='bottom')
from bokeh.models import WheelZoomTool
from holoviews import opts
rslc_zarr = zarr.open('../CLI/raw/rslc.zarr/','r')
intf = rslc_zarr[:,:,7]*rslc_zarr[:,:,13].conj()
adi = zarr.open('../CLI/ps/adi.zarr/','r')[:]
filtered_intf = n2fs3d(adi,intf,depths=(200,200),model='../../../noise2fringe_ps_cos_adi/model_saved/noise2fringe_model_depth_4_0721_8/n2fs3d.onnx')
CPU times: user 3min 36s, sys: 1min 1s, total: 4min 37s
Wall time: 5.02 s
if is_cuda_available():
    intf_cp = cp.asarray(intf)
    adi_cp = cp.asarray(adi)
    filtered_intf_cp = n2fs3d(adi_cp,intf_cp)
CPU times: user 3.76 s, sys: 613 ms, total: 4.38 s
Wall time: 4.34 s