Updated POm to ignore test resources and updates to DL data selector

This commit is contained in:
Jamie Mac 2024-07-12 08:33:03 +01:00
parent 15d72c8fd5
commit f9e87e92ab
17 changed files with 208 additions and 38 deletions

View File

@ -6,7 +6,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -1,5 +1,6 @@
eclipse.preferences.version=1
encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8
encoding//src/test=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,9 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.targetPlatform=21
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -13,4 +13,4 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.source=21

View File

@ -107,6 +107,7 @@
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>test/resources/**</exclude>
</excludes>
</filter>
</filters>

View File

@ -101,6 +101,7 @@
<exclude>META-INF/*.SF</exclude> <!-- get rid of manifests from library jars - also done in orig ant build file -->
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>test/resources/**</exclude>
</excludes>
</filter>
</filters>
@ -179,7 +180,7 @@
-->
</executions>
</plugin>
</plugins>

View File

@ -13,6 +13,8 @@ public class CompoundDataSelector extends DataSelector {
private CompoundParams compoundParams = new CompoundParams();
private CompoundDialogPaneFX compoundPaneFX;
public CompoundDataSelector(PamDataBlock pamDataBlock, ArrayList<DataSelector> allSelectors,
String selectorName, boolean allowScores, String selectorType) {
super(pamDataBlock, selectorName, allowScores);
@ -57,8 +59,10 @@ public class CompoundDataSelector extends DataSelector {
@Override
public DynamicSettingsPane<Boolean> getDialogPaneFX() {
// TODO Auto-generated method stub
return null;
if (compoundPaneFX==null) {
compoundPaneFX = new CompoundDialogPaneFX(this);
}
return compoundPaneFX;
}
@Override

View File

@ -0,0 +1,81 @@
package PamguardMVC.dataSelector;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JPanel;
import PamView.dialog.PamDialogPanel;
import PamView.dialog.PamGridBagContraints;
import javafx.scene.Node;
import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamVBox;
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
public class CompoundDialogPaneFX extends DynamicSettingsPane<Boolean> {
private CompoundDataSelector compoundDataSelector;
private ArrayList<DataSelector> selectorList;
private ArrayList<PamDialogPanel> selectorPanels;
private PamVBox mainPanel;
public CompoundDialogPaneFX(CompoundDataSelector compoundDataSelector) {
this.compoundDataSelector = compoundDataSelector;
this.selectorList = compoundDataSelector.getSelectorList();
mainPanel = new PamVBox();
mainPanel.setSpacing(5);
selectorPanels = new ArrayList<PamDialogPanel>(selectorList.size());
int ind = 0;
for (DataSelector ds : selectorList) {
DynamicSettingsPane<Boolean> panel = ds.getDialogPaneFX();
// turn all these panels into the compound ones with the extra enable options.
// DataSelectorDialogPanel dsp = new DataSelectorDialogPanel(ds, panel, ind++);
// selectorPanels.add(dsp);
mainPanel.getChildren().add(panel.getContentNode());
}
}
@Override
public Boolean getParams(Boolean currParams) {
boolean ok = true;
for (int i = 0; i < selectorPanels.size(); i++) {
PamDialogPanel panel = selectorPanels.get(i);
ok |= panel.getParams();
}
return ok;
}
@Override
public void setParams(Boolean input) {
for (int i = 0; i < selectorPanels.size(); i++) {
PamDialogPanel panel = selectorPanels.get(i);
panel.setParams();
}
}
@Override
public String getName() {
return "Compound data selector pane";
}
@Override
public Node getContentNode() {
return mainPanel;
}
@Override
public void paneInitialized() {
// TODO Auto-generated method stub
}
}

View File

@ -1,11 +1,9 @@
package PamguardMVC.dataSelector;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.ArrayList;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;

View File

@ -0,0 +1,42 @@
package PamguardMVC.dataSelector;
import javafx.scene.Node;
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
public class DataSelectorDialogPaneFX extends DynamicSettingsPane<Boolean> {
public DataSelectorDialogPaneFX(Object ownerWindow) {
super(ownerWindow);
// TODO Auto-generated constructor stub
}
@Override
public Boolean getParams(Boolean currParams) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setParams(Boolean input) {
// TODO Auto-generated method stub
}
@Override
public String getName() {
return "Data selector wrapper pane";
}
@Override
public Node getContentNode() {
// TODO Auto-generated method stub
return null;
}
@Override
public void paneInitialized() {
// TODO Auto-generated method stub
}
}

View File

@ -242,6 +242,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
* @return the data select pane.
*/
private DynamicSettingsPane<Boolean> createDataSelectPane(){
System.out.println("Data selector: " + clickPlotInfo.getClickDataSelector());
return clickPlotInfo.getClickDataSelector().getDialogPaneFX();
}

View File

@ -1,23 +1,24 @@
package rawDeepLearningClassifier.dataSelector;
import PamguardMVC.PamDataBlock;
import PamguardMVC.dataSelector.DataSelectParams;
import PamguardMVC.dataSelector.DataSelector;
import PamguardMVC.dataSelector.DataSelectorCreator;
import clickDetector.dataSelector.ClickDataSelector;
import annotation.DataAnnotationType;
import annotation.dataselect.AnnotationDataSelCreator;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.logging.DLAnnotation;
import rawDeepLearningClassifier.logging.DLAnnotationType;
/**
* Creates a data selector for the deep learning module.
*
* @author Jamie Macaulay
*/
public class DLDataSelectCreator extends DataSelectorCreator {
public class DLDataSelectCreator extends AnnotationDataSelCreator<DLAnnotation> {
private DLControl dlcontrol;
public DLDataSelectCreator(DLControl dlcontrol, PamDataBlock pamDataBlock) {
super(pamDataBlock);
public DLDataSelectCreator(DLControl dlcontrol, DLAnnotationType type) {
super(type);
this.dlcontrol = dlcontrol;
}
@ -27,8 +28,13 @@ public class DLDataSelectCreator extends DataSelectorCreator {
}
@Override
public DataSelector createDataSelector(String selectorName, boolean allowScores, String selectorType) {
return new DLDataSelector(dlcontrol, this.getPamDataBlock(), selectorName, allowScores, selectorType);
public DataSelector createDataSelector(DataAnnotationType<DLAnnotation> dataAnnotationType, String selectorName,
boolean allowScores, String selectorType) {
// TODO Auto-generated method stub
return new DLDataSelector(dlcontrol, dataAnnotationType, null,
selectorName, allowScores);
}
}

View File

@ -8,21 +8,24 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.dataSelector.DataSelectParams;
import PamguardMVC.dataSelector.DataSelector;
import annotation.DataAnnotationType;
import annotation.dataselect.AnnotationDataSelector;
import pamViewFX.fxSettingsPanes.DynamicSettingsPane;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.logging.DLAnnotation;
/**
* Data selector of DL data units. Note that data selectors are really data
* unit specific and not annotation specific.
* Data selector of DL data units. Note that data selectors are for deep leanring annotations
* rather than deep learning data units.
* <p>
* The data selector can have different types of data selectors which can
* depend on the classifer used and user choice.
* depend on the classifier used and user choice.
* <p>
* Note that this is slightly different from DLPredicitoDecision
* as it deals with data units that may have a more than one prediction.
* i.e.
*/
public class DLDataSelector extends DataSelector {
public class DLDataSelector extends AnnotationDataSelector<DLAnnotation> {
/**
@ -52,10 +55,19 @@ public class DLDataSelector extends DataSelector {
* @param allowScores - allow all the scores.
* @param selectorType - the selector type.
*/
public DLDataSelector(DLControl dlcontrol, PamDataBlock pamDataBlock, String selectorName, boolean allowScores, String selectorType) {
super(pamDataBlock, selectorName, allowScores);
public DLDataSelector(DLControl dlcontrol, DataAnnotationType<DLAnnotation> annotationType, PamDataBlock pamDataBlock,
String selectorName, boolean allowScores) {
super(annotationType, pamDataBlock, selectorName, allowScores);
/****New data filters go here****/
dataFilters.add(new DLPredictionFilter(dlcontrol));
//create default params
dlDataSelectParams = new DLDataSelectorParams();
dlDataSelectParams.dataSelectorParams = new DataSelectParams[dataFilters.size()];
for (int i=0; i<dataFilters.size() ; i++) {
dlDataSelectParams.dataSelectorParams[i] = dataFilters.get(i).getParams();
}
}
@Override
@ -117,4 +129,14 @@ public class DLDataSelector extends DataSelector {
return score>=0 ? 1 : 0;
}
@Override
protected double scoreData(PamDataUnit pamDataUnit, DLAnnotation annotation) {
int score = dataFilters.get(dlDataSelectParams.dataSelectorIndex).scoreDLData(pamDataUnit);
//the score is the index of the class that scores highest or -1 if it does not pass threshold prediciton.
//Need to make more simple here as scores in PG are 0 for not passed rather than negative.
return score>=0 ? 1 : 0;
}
}

View File

@ -1,6 +1,7 @@
package rawDeepLearningClassifier.dataSelector;
import javax.swing.JComponent;
import javax.swing.JLabel;
import PamView.dialog.PamDialogPanel;
@ -16,7 +17,7 @@ public class DLSelectPanel implements PamDialogPanel {
@Override
public JComponent getDialogComponent() {
// TODO Auto-generated method stub
return null;
return new JLabel("Hello Annotation DL");
}
@Override
@ -28,7 +29,7 @@ public class DLSelectPanel implements PamDialogPanel {
@Override
public boolean getParams() {
// TODO Auto-generated method stub
return false;
return true;
}
}

View File

@ -5,7 +5,7 @@ import PamguardMVC.PamDataUnit;
import rawDeepLearningClassifier.dlClassification.genericModel.StandardPrediction;
/**
* A data unit created from classification results of DL model. this data unit holds one model results, i.e.
* A data unit created from classification results of DL model. This data unit holds one model results, i.e.
* corresponds to one segment of raw data.
*
* @author Jamie Macaulay

View File

@ -74,17 +74,17 @@ public class DLDetectionDataBlock extends AcousticDataBlock<DLDetection> impleme
}
/* (non-Javadoc)
* @see PamguardMVC.PamDataBlock#getDataSelectCreator()
*/
@Override
public synchronized DataSelectorCreator getDataSelectCreator() {
if (dlDataSelectCreator == null) {
dlDataSelectCreator = new DLDataSelectCreator(dlControl, this);
}
return dlDataSelectCreator;
}
// /* (non-Javadoc)
// * @see PamguardMVC.PamDataBlock#getDataSelectCreator()
// */
// @Override
// public synchronized DataSelectorCreator getDataSelectCreator() {
// if (dlDataSelectCreator == null) {
// dlDataSelectCreator = new DLDataSelectCreator(dlControl, this);
// }
// return dlDataSelectCreator;
//
// }
}

Binary file not shown.

View File

@ -1,13 +1,14 @@
package rawDeepLearningClassifier.logging;
import PamView.symbol.PamSymbolChooser;
import PamView.symbol.modifier.SymbolModifier;
import annotation.CentralAnnotationsList;
import annotation.DataAnnotationType;
import annotation.binary.AnnotationBinaryHandler;
import annotation.dataselect.AnnotationDataSelCreator;
import generalDatabase.SQLLoggingAddon;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.dataPlotFX.DLSymbolModifier;
import rawDeepLearningClassifier.dataSelector.DLDataSelectCreator;
/**
* Annotation type for data from the matched click classifier.
@ -26,6 +27,8 @@ public class DLAnnotationType extends DataAnnotationType<DLAnnotation> {
private DLAnnotationSymbolChooser dlSymbolChooser;
private DLDataSelectCreator dlDataSelectorCreator;
public DLAnnotationType(DLControl mtControl) {
this.dlControl=mtControl;
dlAnnotationSQL = new DLAnnotationSQL(this);
@ -92,6 +95,15 @@ public class DLAnnotationType extends DataAnnotationType<DLAnnotation> {
public DLControl getDlControl() {
return dlControl;
}
@Override
public AnnotationDataSelCreator getDataSelectCreator(String selectorName, boolean allowScores) {
if (dlDataSelectorCreator == null) {
dlDataSelectorCreator = new DLDataSelectCreator(dlControl, this);
}
return dlDataSelectorCreator;
}