Class DLModelWorker<T>
java.lang.Object
rawDeepLearningClassifier.dlClassification.genericModel.DLModelWorker<T>
- Direct Known Subclasses:
GenericModelWorker
,KetosWorker
,SoundSpotWorker
Runs the deep learning model and performs feature extraction.
- Author:
- Jamie Macaulay
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Destroy the model.float[][][]
dataUnits2ModelInput
(ArrayList<? extends PamDataUnit> dataUnits, float sampleRate, int iChan) Convert a list of data units to a stack if images.ArrayList<org.jamdev.jdl4pam.transforms.DLTransform>
boolean
Check whether the results are normalised with a softmax function.abstract boolean
Check whether a model is null or not.abstract T
makeModelResult
(float[] prob, double time) 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.abstract void
prepModel
(StandardModelParams soundSpotParams, DLControl dlControl) abstract float[]
runModel
(float[][][] transformedDataStack) runModel
(ArrayList<? extends PamDataUnit> dataUnits, float sampleRate, int iChan) Run the initial data feature extraction and the modelvoid
setEnableSoftMax
(boolean enableSoftMax) Set whether the results are normalised with a softmax function.void
setModelTransforms
(ArrayList<org.jamdev.jdl4pam.transforms.DLTransform> modelTransforms)
-
Field Details
-
MAX_QUEUE_SIZE
public static final int MAX_QUEUE_SIZEThe 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 rateiChan
- - 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 seperately.- Returns:
- the model to run.
-
runModel
public abstract float[] runModel(float[][][] transformedDataStack) -
isModelNull
public abstract boolean isModelNull()Check whether a model is null or not.- Returns:
- true of the model is null.
-
makeModelResult
-
prepModel
-
closeModel
public abstract void closeModel()Destroy the model. -
getModelTransforms
-
setModelTransforms
public void setModelTransforms(ArrayList<org.jamdev.jdl4pam.transforms.DLTransform> modelTransforms) -
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
-