mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
CTD Data Selector fixes (#66)
* Plugin Help Small change to Help system so that plugins under development can more easily display their help * PamModel update Notes on how to add a plugin to the model during the plugin development phase. * Click Train Detector Help * Help for backup manager * Temp version 2.02.04ac CTD data selector fixes Fixed both the way the CTD uses data selectors from other detectors AND the way that it's own data selector works.
This commit is contained in:
parent
313ce0c46f
commit
f6e6cd0fde
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.pamguard</groupId>
|
||||
<artifactId>Pamguard</artifactId>
|
||||
<version>2.02.04aa</version>
|
||||
<version>2.02.04ac</version>
|
||||
<name>Pamguard Java12+</name>
|
||||
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
|
||||
<url>www.pamguard.org</url>
|
||||
|
@ -31,12 +31,12 @@ public class PamguardVersionInfo {
|
||||
* Version number, major version.minorversion.sub-release.
|
||||
* Note: can't go higher than sub-release 'f'
|
||||
*/
|
||||
static public final String version = "2.02.04aa";
|
||||
static public final String version = "2.02.04ac";
|
||||
|
||||
/**
|
||||
* Release date
|
||||
*/
|
||||
static public final String date = "13 September 2022";
|
||||
static public final String date = "22 September 2022";
|
||||
|
||||
// /**
|
||||
// * Release type - Beta or Core
|
||||
|
@ -238,10 +238,10 @@ public class CTClassifierManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ctParams[i].uniqueID ==null) {
|
||||
//old versions may not have a unique ID so needs to be added.
|
||||
ctParams[i].uniqueID = UUID.randomUUID().toString();
|
||||
}
|
||||
// if (ctParams[i].uniqueID ==null) {
|
||||
// //old versions may not have a unique ID so needs to be added.
|
||||
// ctParams[i].uniqueID = UUID.randomUUID().toString();
|
||||
// }
|
||||
aClassifier.setParams(ctParams[i]);
|
||||
cTClassifiers.add(aClassifier);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
|
||||
|
||||
|
||||
public CTClassifierParams() {
|
||||
this.uniqueID = UUID.randomUUID().toString();
|
||||
// this.uniqueID = UUID.randomUUID().toString(); // see comment below
|
||||
}
|
||||
|
||||
|
||||
@ -32,10 +32,13 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
|
||||
public String classifierName = "";
|
||||
|
||||
|
||||
/**
|
||||
* A unique ID for the classifier that never changes. This is important for accessing data selectors.
|
||||
*/
|
||||
public String uniqueID;
|
||||
// /**
|
||||
// * A unique ID for the classifier that never changes. This is important for accessing data selectors.
|
||||
// * GET RID OF THIS, Every time you make a new set of params you get a new ID and it then creates a new
|
||||
// * classifier selector with default settings, so the classifier selectors never work.
|
||||
// Classifier selectors need to be names on something that's not oging to change, so the module name and the classifier species ame.
|
||||
// */
|
||||
// public String uniqueID;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -120,7 +120,8 @@ public class Chi2ThresholdClassifier implements CTClassifier {
|
||||
//create the data selector
|
||||
//System.out.println("Data selector: " + dataSelector);
|
||||
if (source!=null) {
|
||||
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + " " + clssfrParams.uniqueID
|
||||
|
||||
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.classifierName
|
||||
+ "_X2_threshold_classifier", false, null);
|
||||
//System.out.println("Data selector: " + dataSelector);
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ public class CTDataSelector extends DataSelector {
|
||||
|
||||
if (ctSelectParams.needsLoc && !pamDataUnit.getLocalisation().hasLocContent(LocContents.HAS_RANGE)) return 0;
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,11 @@ public class CTDataSelector extends DataSelector {
|
||||
*/
|
||||
private boolean isClassified(CTDetectionGroupDataUnit ctDataUnit) {
|
||||
|
||||
if (!ctSelectParams.needsClassification) return true;
|
||||
if (ctSelectParams.allowAnyClassification) return true;
|
||||
|
||||
if (this.getSelectorName().contains("Dolphin")) {
|
||||
System.out.println("Dolphin classifier looking at " + ctDataUnit);
|
||||
}
|
||||
|
||||
if (ctDataUnit instanceof CTDataUnit) {
|
||||
|
||||
@ -131,9 +135,13 @@ public class CTDataSelector extends DataSelector {
|
||||
|
||||
if (clickTrain.ctClassifications==null) return false;
|
||||
|
||||
int nClass = clickTrain.ctClassifications.size();
|
||||
if (ctSelectParams.allowMultipleChoices == false) {
|
||||
nClass = Math.min(nClass, 1);
|
||||
}
|
||||
//iterate through all the classifiers and allowed classification types.
|
||||
for (int i=0; i<ctSelectParams.classifier.length; i++) {
|
||||
for (int j=0; j<clickTrain.ctClassifications.size(); j++) {
|
||||
for (int j=0; j<nClass; j++) {
|
||||
if (clickTrain.ctClassifications.get(j).getSpeciesID()==ctSelectParams.classifier[i]) {
|
||||
return true;
|
||||
}
|
||||
|
@ -35,9 +35,22 @@ public class CTSelectParams extends DataSelectParams implements Serializable, Cl
|
||||
public int minSubDetections = 10;
|
||||
|
||||
/**
|
||||
* True of the click train detector needs a classifcation
|
||||
* True of the click train detector needs a classifcation No !!!!
|
||||
* This 'needsClassification' variable was been used the wrong way around throughout and is screwing the classiifer.
|
||||
* I've therefore replaced it with the variable allowAll which is how this is actually used !
|
||||
* Given that anything using this would have has screwed logic, I don't care if I break
|
||||
* a config or two ! DG 22/9/22
|
||||
*/
|
||||
public boolean needsClassification = false;
|
||||
public boolean allowAnyClassification = false;
|
||||
// private boolean needsClassification = false;
|
||||
|
||||
/**
|
||||
* In the data selector, if this is false it will only look at the best classifier, i.e. the
|
||||
* one with the best classifier score. If set true it will check every species above min
|
||||
* score even if it's not the first classification choice.
|
||||
*/
|
||||
public boolean allowMultipleChoices = false;
|
||||
|
||||
|
||||
/**
|
||||
* The classifier type(s) to select
|
||||
|
@ -78,6 +78,8 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
|
||||
private JCheckBox[] classifierCheckBoxes;
|
||||
|
||||
private JCheckBox allowMultipleChoices; //
|
||||
|
||||
private JCheckBox unclassifiedCheckBox;
|
||||
|
||||
private JPanel classificationFilter;
|
||||
@ -232,6 +234,12 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
classifierCheckBoxes[i].setSelected(true); //default should be selected
|
||||
constraints.gridy++;
|
||||
}
|
||||
|
||||
constraints.gridy++;
|
||||
classification.add(allowMultipleChoices = new JCheckBox("Allow multiple classification options"), constraints);
|
||||
allowMultipleChoices.setToolTipText("If not selected, then only the first choice classification is compared to the " +
|
||||
"selected list. If selected, then all classifiers passing minimum score may be used");
|
||||
|
||||
classification.validate(); //make sure everything is laid out properly.
|
||||
|
||||
setClassifierParams();
|
||||
@ -245,6 +253,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
classifierCheckBoxes[i].setEnabled(!unclassifiedCheckBox.isSelected());
|
||||
}
|
||||
}
|
||||
allowMultipleChoices.setEnabled(!unclassifiedCheckBox.isSelected());
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +262,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
*/
|
||||
private void setClassifierParams() {
|
||||
|
||||
unclassifiedCheckBox.setSelected(currentParams.needsClassification );
|
||||
unclassifiedCheckBox.setSelected(currentParams.allowAnyClassification );
|
||||
|
||||
if (currentParams.classifier==null ) {
|
||||
for (int i=0; i<classifierCheckBoxes.length; i++) {
|
||||
@ -270,6 +279,7 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
}
|
||||
}
|
||||
}
|
||||
allowMultipleChoices.setSelected(currentParams.allowMultipleChoices);
|
||||
|
||||
}
|
||||
|
||||
@ -278,7 +288,9 @@ public class CTDataSelectPanel implements PamDialogPanel {
|
||||
* Get the parameters for the classifiers to use.
|
||||
*/
|
||||
private void getClassifierParams() {
|
||||
currentParams.needsClassification = unclassifiedCheckBox.isSelected();
|
||||
currentParams.allowAnyClassification = unclassifiedCheckBox.isSelected();
|
||||
|
||||
currentParams.allowMultipleChoices = allowMultipleChoices.isSelected();
|
||||
|
||||
int count = 0;
|
||||
for (int i=0; i<classifierCheckBoxes.length; i++) {
|
||||
|
@ -489,7 +489,7 @@ abstract public class PamCursor {
|
||||
preparedUpdateStatement.setObject(iCol + 1, tableDef.getIndexItem().getValue());
|
||||
int result = preparedUpdateStatement.executeUpdate();
|
||||
if (result<1) {
|
||||
System.out.println("update db result = " + String.valueOf(result));
|
||||
// System.out.println("update db result = " + String.valueOf(result));
|
||||
String msg = String.format("There was a problem updating row %d in table %s",
|
||||
tableDef.getIndexItem().getValue(), tableDef.getTableName());
|
||||
PamWarning dispWarning = new PamWarning("Database Error", msg, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user