Package deepWhistle

Class DeepWhistleMask

java.lang.Object
deepWhistle.DeepWhistleMask
All Implemented Interfaces:
PamFFTMask

public class DeepWhistleMask extends Object implements PamFFTMask
  • Field Details

    • matFilePath

      public String matFilePath
  • Constructor Details

  • Method Details

    • initMask

      public boolean initMask()
      Description copied from interface: PamFFTMask
      Initialize the mask. Called once before processing starts.
      Specified by:
      initMask in interface PamFFTMask
      Returns:
      true if initialization was successful, false otherwise
    • applyMask

      public List<FFTDataUnit> applyMask(List<FFTDataUnit> batch)
      Description copied from interface: PamFFTMask
      Apply the mask to a batch of FFTDataUnit objects. The mask performs some operation on the FFT data within each FFTDataUnit in the batch and returns the modified data units.
      Specified by:
      applyMask in interface PamFFTMask
      Parameters:
      batch - List of FFTDataUnit objects to process
      Returns:
      List of FFTDataUnit objects after applying the mask
    • loadPyTorchdeepWhistleModel

      public static ai.djl.inference.Predictor<float[][],float[]> loadPyTorchdeepWhistleModel(String modelPathS, long fftLen, long fftNum)
      Load the deepWhistle into memory and create a predictor that can be called to run the model.
      Parameters:
      modelPathS - - the path to the PyTorch model file
      fftLen - - the fft length used in the model
      fftNum - - the number of runs (i.e. number of FFT
      Returns:
      the predictor which returns a flattened confidence surface.
    • runPyTorchDeepWhislte

      public static float[][] runPyTorchDeepWhislte(ai.djl.inference.Predictor<float[][],float[]> specPredictor, float[][] spectrogram)
      Simple function which loads up the deep PyTorch whistle model and then runs it on completely random data