Class StandardClassifierModel
java.lang.Object
rawDeepLearningClassifier.dlClassification.StandardClassifierModel
- All Implemented Interfaces:
PamSettings
,SettingsNameProvider
,DLClassiferModel
- Direct Known Subclasses:
ArchiveModelClassifier
,DelphinIDClassifier
,GenericDLClassifier
,KetosClassifier
,SoundSpotClassifier
public abstract class StandardClassifierModel
extends Object
implements DLClassiferModel, PamSettings
A useful abstract class for standard models which are a file or URL that is loaded, have a UI and
utilise PAMSettings to save settings state. These models only accept raw sound data segments.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayList
<PamWarning> checkSettingsOK
(StandardModelParams genericModelParams, DLControl dlControl) Deprecated.void
Called whenever PAMGuard stops.Get the allowed data types for the model.The can be null in which case only data units with raw data are allowed.static short[]
getClassNameIDs
(StandardModelParams standardModelParams) Get the class name IDsGet the number of output classes.Reference to the dlControlabstract StandardModelParams
Get the sound spot worker.abstract DLModelWorker
<? extends PredictionResult> Get the sound spot worker.Check whether a model has been selected and can be loaded successfully.int
Get the number of output classes.Get raw settings paneboolean
isDecision
(StandardPrediction modelResult, StandardModelParams modelParmas) Make a decision on whether a result passed a decisionboolean
isModelExtensions
(URI uri) double
millis2Samples
(double millis) Get the number of samples for microseconds.protected void
newResult
(StandardPrediction modelResult, PamDataUnit groupedRawData) Send a new result form the thread queue to the process.void
Prepare the model.ArrayList
<? extends PredictionResult> runModel
(ArrayList<? extends PamDataUnit> groupedRawData) Run the deep learning model on a list of grouped raw data units and return a corresponding list of model results.Set and load the model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rawDeepLearningClassifier.dlClassification.DLClassiferModel
getDLModelSettings, getModelUI, getName, isModelType
Methods inherited from interface PamController.PamSettings
getSettingsReference, getSettingsVersion, getUnitType, restoreSettings
Methods inherited from interface PamController.SettingsNameProvider
getUnitName
-
Field Details
-
Constructor Details
-
Method Details
-
runModel
public ArrayList<? extends PredictionResult> runModel(ArrayList<? extends PamDataUnit> groupedRawData) Description copied from interface:DLClassiferModel
Run the deep learning model on a list of grouped raw data units and return a corresponding list of model results.Note the reason we use list is that often it is more efficient to get a model to predict a stacked group of inputs rather than one at a time.
- Specified by:
runModel
in interfaceDLClassiferModel
- Returns:
- the deep learning model.
-
prepModel
public void prepModel()Description copied from interface:DLClassiferModel
Prepare the model. This is called on PAMGuard start up and before processing in viewer mode.- Specified by:
prepModel
in interfaceDLClassiferModel
-
getDLWorker
Get the sound spot worker.- Returns:
- the sound spot worker.
-
getDLParams
Get the sound spot worker.- Returns:
- the sound spot worker.
-
getDLControl
Description copied from interface:DLClassiferModel
Reference to the dlControl- Specified by:
getDLControl
in interfaceDLClassiferModel
- Returns:
- reference to the DL control.
-
getNumClasses
public int getNumClasses()Description copied from interface:DLClassiferModel
Get the number of output classes.- Specified by:
getNumClasses
in interfaceDLClassiferModel
- Returns:
- the number of output classes.
-
getClassNames
Description copied from interface:DLClassiferModel
Get the number of output classes.- Specified by:
getClassNames
in interfaceDLClassiferModel
- Returns:
- the number of output classes.
-
getModelStatus
Description copied from interface:DLClassiferModel
Check whether a model has been selected and can be loaded successfully.- Specified by:
getModelStatus
in interfaceDLClassiferModel
-
setModel
Description copied from interface:DLClassiferModel
Set and load the model.- Specified by:
setModel
in interfaceDLClassiferModel
- Returns:
- the status of the model e.g. if there has been an error loading
-
isDecision
Make a decision on whether a result passed a decision- Parameters:
modelResult
- - the model result.modelParmas
- - the model parameters.- Returns:
- true if a threshold has been met.
-
getClassNameIDs
Get the class name IDs- Returns:
- an array of class name IDs
-
closeModel
public void closeModel()Description copied from interface:DLClassiferModel
Called whenever PAMGuard stops.- Specified by:
closeModel
in interfaceDLClassiferModel
-
newResult
Send a new result form the thread queue to the process.- Parameters:
modelResult
- - the model result;groupedRawData
- - the grouped raw data.
-
millis2Samples
public double millis2Samples(double millis) Get the number of samples for microseconds. Based on the sample rate of the parent data block. -
getRawSettingsPane
Get raw settings pane- Returns:
- the setting pane.
-
isModelExtensions
-
checkSettingsOK
@Deprecated public static ArrayList<PamWarning> checkSettingsOK(StandardModelParams genericModelParams, DLControl dlControl) Deprecated. -
getAllowedDataTypes
Description copied from interface:DLClassiferModel
Get the allowed data types for the model.The can be null in which case only data units with raw data are allowed.- Specified by:
getAllowedDataTypes
in interfaceDLClassiferModel
- Returns:
- a list of the allowed data types.
-