Package deepWhistle
Class DeepWhistleMask
java.lang.Object
deepWhistle.DeepWhistleMask
- All Implemented Interfaces:
PamFFTMask
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyMask(List<FFTDataUnit> batch) Apply the mask to a batch of FFTDataUnit objects.booleaninitMask()Initialize the mask.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.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
-
Field Details
-
matFilePath
-
-
Constructor Details
-
DeepWhistleMask
-
-
Method Details
-
initMask
public boolean initMask()Description copied from interface:PamFFTMaskInitialize the mask. Called once before processing starts.- Specified by:
initMaskin interfacePamFFTMask- Returns:
- true if initialization was successful, false otherwise
-
applyMask
Description copied from interface:PamFFTMaskApply 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:
applyMaskin interfacePamFFTMask- 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 filefftLen- - the fft length used in the modelfftNum- - 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
-