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.voidCalled 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 StandardModelParamsGet 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.intGet the number of output classes.Get raw settings panebooleanisDecision(StandardPrediction modelResult, StandardModelParams modelParmas) Make a decision on whether a result passed a decisionbooleanisModelExtensions(URI uri) doublemillis2Samples(double millis) Get the number of samples for microseconds.protected voidnewResult(StandardPrediction modelResult, PamDataUnit groupedRawData) Send a new result form the thread queue to the process.voidPrepare 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, waitMethods inherited from interface rawDeepLearningClassifier.dlClassification.DLClassiferModel
getDLModelSettings, getModelUI, getName, isModelTypeMethods inherited from interface PamController.PamSettings
getSettingsReference, getSettingsVersion, getUnitType, restoreSettingsMethods inherited from interface PamController.SettingsNameProvider
getUnitName
-
Field Details
-
dlControl
-
-
Constructor Details
-
StandardClassifierModel
-
-
Method Details
-
runModel
public ArrayList<? extends PredictionResult> runModel(ArrayList<? extends PamDataUnit> groupedRawData) Description copied from interface:DLClassiferModelRun 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:
runModelin interfaceDLClassiferModel- Returns:
- the deep learning model.
-
prepModel
public void prepModel()Description copied from interface:DLClassiferModelPrepare the model. This is called on PAMGuard start up and before processing in viewer mode.- Specified by:
prepModelin 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:DLClassiferModelReference to the dlControl- Specified by:
getDLControlin interfaceDLClassiferModel- Returns:
- reference to the DL control.
-
getNumClasses
public int getNumClasses()Description copied from interface:DLClassiferModelGet the number of output classes.- Specified by:
getNumClassesin interfaceDLClassiferModel- Returns:
- the number of output classes.
-
getClassNames
Description copied from interface:DLClassiferModelGet the number of output classes.- Specified by:
getClassNamesin interfaceDLClassiferModel- Returns:
- the number of output classes.
-
getModelStatus
Description copied from interface:DLClassiferModelCheck whether a model has been selected and can be loaded successfully.- Specified by:
getModelStatusin interfaceDLClassiferModel
-
setModel
Description copied from interface:DLClassiferModelSet and load the model.- Specified by:
setModelin 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:DLClassiferModelCalled whenever PAMGuard stops.- Specified by:
closeModelin 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:DLClassiferModelGet the allowed data types for the model.The can be null in which case only data units with raw data are allowed.- Specified by:
getAllowedDataTypesin interfaceDLClassiferModel- Returns:
- a list of the allowed data types.
-