java.lang.Object
rawDeepLearningClassifier.dlClassification.genericModel.DLModelWorker<T>
Direct Known Subclasses:
GenericModelWorker, KetosWorker, SoundSpotWorker

public abstract class DLModelWorker<T> extends Object
Runs the deep learning model and performs feature extraction.

Author:
Jamie Macaulay
  • Field Details

    • MAX_QUEUE_SIZE

      public static final int MAX_QUEUE_SIZE
      The maximum allowed queue size;
      See Also:
  • Constructor Details

    • DLModelWorker

      public DLModelWorker()
  • Method Details

    • dataUnits2ModelInput

      public float[][][] dataUnits2ModelInput(ArrayList<? extends PamDataUnit> dataUnits, float sampleRate, int iChan)
      Convert a list of data units to a stack if images.
      Parameters:
      dataUnits - - the data units.
      sampleRate - - the sample rate
      iChan - - the channels
      Returns:
      a stack of images for input into a deep learning model.
    • runModel

      public ArrayList<T> runModel(ArrayList<? extends PamDataUnit> dataUnits, float sampleRate, int iChan)
      Run the initial data feature extraction and the model
      Parameters:
      iChan - - the channel to run the data on.
      rawDataUnit - - the raw data unit. This is a stack of data units to be classified either together or separately.
      Returns:
      the model to run.
    • runModel

      public abstract float[] runModel(float[][][] transformedDataStack)
      Run the model on a stack of transformed data.
      Parameters:
      transformedDataStack - - the input data for the model where the outer array is the number of input images or wavforms.
      Returns:
      the prediction as a flattened array of probabilities for each class.
    • isModelNull

      public abstract boolean isModelNull()
      Check whether a model is null or not.
      Returns:
      true of the model is null.
    • makeModelResult

      public abstract T makeModelResult(float[] prob, double time)
      Make a model result from the probabilities and the time it took to run the model.
      Parameters:
      prob - - the probabilities for each class.
      time - - the time taken to run the model.
      Returns:
      a model result object.
    • prepModel

      public abstract DLStatus prepModel(StandardModelParams standardModelParams, DLControl dlControl)
      Prepare the model for running.
      Parameters:
      standardModelParams - - the parameters for the sound spot model.
      dlControl - - the control object for the deep learning process.
      Returns:
      a status of the preparation of the model.
    • closeModel

      public abstract void closeModel()
      Destroy the model.
    • getModelTransforms

      public ArrayList<org.jamdev.jdl4pam.transforms.DLTransform> getModelTransforms()
      Get the model transforms for the data. These are the transforms that are applied to the data before it is input into the model.
      Returns:
      the model transforms.
    • setModelTransforms

      public void setModelTransforms(ArrayList<org.jamdev.jdl4pam.transforms.DLTransform> modelTransforms)
      Set the model transforms for the data. These are the transforms that are applied to the data before it is input into the model.
      Parameters:
      modelTransforms - - the model transforms.
    • model2DLTransforms

      public ArrayList<org.jamdev.jdl4pam.transforms.DLTransform> model2DLTransforms(org.jamdev.jdl4pam.animalSpot.AnimalSpotParams dlParams)
      Convert the parameters saved in the sound spot model to DLtransform parameters.
      Returns:
      the DLTransform parameters.
    • isEnableSoftMax

      public boolean isEnableSoftMax()
      Check whether the results are normalised with a softmax function.
      Returns:
      true if results are normalised using a softmax function
    • setEnableSoftMax

      public void setEnableSoftMax(boolean enableSoftMax)
      Set whether the results are normalised with a softmax function.
      Parameters:
      set - to true if results are normalised using a softmax function