mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-25 08:32:32 +00:00
Fixes issues #111 and fixes #112 (DIFAR module crashes and ability to use Deep Learning Detections in DIFAR module) (#110)
* Bugfix for OverlayMarks Check for a null pointer exception in OverlayMarks that was causing a crash on startup. * Bugfix for null pointer in symbol manager Fix a bug that I found where the DIFAR module was crashing the symbol manager. Seems that this was due to this subclass of clip generator having a null value for it's uniqueName. I've fixed by checking for null values and assigning a generic symbol when null. * DeepLearning detections canGenerateClips=true Set flag in DeepLearning detector so that detections are considered 'clips' by Pamguard. This allows them to be processed automatically in the DIFAR Localisation module (and maybe others). * DIFAR: bugfix frequency limits for auto-detections Fix a bug in DIFAR module where the frequency limits of automated detections were not being set properly by the DIFAR module. * DeepLearning - Bugfix to detection duration Fix bug in deep learning detector where duration (in samples) was being set to number of samples in a hop instead of the number of samples in a segment.
This commit is contained in:
parent
8e8bc56b37
commit
60435e567a
@ -49,7 +49,7 @@ public class OverlayMarkProviders {
|
||||
continue;
|
||||
}
|
||||
String existingName = marker.getMarkerName();
|
||||
if (existingName.equals(nameToAdd)) {
|
||||
if (existingName!=null && existingName.equals(nameToAdd)) {
|
||||
markProviders.remove(i);
|
||||
break;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ abstract public class PamSymbolManager<T extends PamSymbolChooser> implements Pa
|
||||
* This doesn't work since different displays will still need different options based on
|
||||
* their projector - so it can work, but need to set the projector.
|
||||
*/
|
||||
if (managedSymbolData.useGeneric) {
|
||||
if (managedSymbolData.useGeneric || displayName==null) {
|
||||
displayName = GENERICNAME;
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,10 @@ public class DataSelectorSettings implements Serializable, ManagedParameters {
|
||||
if (selectorParams == null) {
|
||||
selectorParams = new Hashtable<>();
|
||||
}
|
||||
if (name != null) {
|
||||
selectorParams.put(name, params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data selector params for a given name.
|
||||
|
@ -316,10 +316,18 @@ public class DifarProcess extends PamProcess {
|
||||
sP = difarControl.getDifarParameters().findSpeciesParams(difarDataUnit);
|
||||
}
|
||||
difarDataUnit.setDisplaySampleRate(sP.sampleRate);
|
||||
if (!sP.useMarkedBandsForSpectrogramClips){
|
||||
if (difarDataUnit.triggerName.equals(difarControl.getUnitName())) { // User detection
|
||||
if (!sP.useMarkedBandsForSpectrogramClips ){
|
||||
double[] frequency = {sP.processFreqMin, sP.processFreqMax};
|
||||
difarDataUnit.setFrequency(frequency);
|
||||
}
|
||||
} else { //Check whether to override auto detection freq limits with DIFAR limits
|
||||
if (!sP.useDetectionLimitsForTriggeredDetections ){ // Auto-detection
|
||||
double[] frequency = {sP.processFreqMin, sP.processFreqMax};
|
||||
difarDataUnit.setFrequency(frequency);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
demuxDataUnit(difarDataUnit, demuxWorker, startTime);
|
||||
|
||||
|
@ -107,7 +107,8 @@ public class DLClassifyProcess extends PamInstantProcess {
|
||||
addOutputDataBlock(dlDetectionDataBlock);
|
||||
dlDetectionDataBlock.setNaturalLifetimeMillis(600*1000); //keep this data for a while.
|
||||
dlDetectionDataBlock.addDataAnnotationType(dlAnnotationType);
|
||||
|
||||
//ClipGeneration allows processing of detections by DIFAR module (and possibly others)
|
||||
dlDetectionDataBlock.setCanClipGenerate(true);
|
||||
//add custom graphics
|
||||
PamDetectionOverlayGraphics overlayGraphics = new DLGraphics(dlModelResultDataBlock);
|
||||
overlayGraphics.setDetectionData(true);
|
||||
@ -483,7 +484,7 @@ public class DLClassifyProcess extends PamInstantProcess {
|
||||
|
||||
DataUnitBaseData basicData = groupDataBuffer.get(0).getBasicData().clone();
|
||||
basicData.setMillisecondDuration(1000.*rawdata[0].length/this.sampleRate);
|
||||
basicData.setSampleDuration((long) (groupDataBuffer.size()*dlControl.getDLParams().sampleHop));
|
||||
basicData.setSampleDuration((long) (groupDataBuffer.size()*dlControl.getDLParams().rawSampleSize));
|
||||
|
||||
// System.out.println("Model result: " + modelResult.size());
|
||||
DLDetection dlDetection = new DLDetection(basicData, rawdata);
|
||||
|
Loading…
Reference in New Issue
Block a user