Getting DelphinID working and changes to the JavaFX detectin displays

This commit is contained in:
Jamie Mac 2024-04-26 17:01:34 +01:00
parent 7ee8562c0c
commit c6d422d999
27 changed files with 681 additions and 126 deletions

View File

@ -303,14 +303,14 @@
<dependency>
<groupId>io.github.macster110</groupId>
<artifactId>jpamutils</artifactId>
<version>0.0.57</version>
<version>0.0.58</version>
</dependency>
<!--jpam project - Deep learning java library -->
<dependency>
<groupId>io.github.macster110</groupId>
<artifactId>jdl4pam</artifactId>
<version>0.0.97</version>
<version>0.0.98</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150mm"
height="150mm"
viewBox="0 0 150 150"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
sodipodi:docname="logo01.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.74564394"
inkscape:cx="379.53772"
inkscape:cy="512.97943"
inkscape:window-width="1242"
inkscape:window-height="1008"
inkscape:window-x="649"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<inkscape:path-effect
effect="bspline"
id="path-effect3117"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-7"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-6"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-size:3.175px;fill:#000000;stroke-width:0.264583"
x="11.709678"
y="81.967743"
id="text113"><tspan
sodipodi:role="line"
id="tspan111"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="11.709678"
y="81.967743"><tspan
style="fill:#6f916f"
id="tspan167">delphin</tspan><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#0b2817"
id="tspan165">ID</tspan></tspan></text>
<path
style="fill:#6f916f;stroke-width:0.264583"
d="m 27.322579,38.322579 6.741938,2.838712"
id="path535" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 120.67435,61.080456 c 1.55411,1.367612 3.10801,2.735039 4.219,4.735608 1.11098,2.00057 1.77914,4.634082 1.8024,7.356282 0.0232,2.7222 -0.5983,5.53298 -1.65497,7.685367 -1.05667,2.152388 -2.5484,3.646416 -4.0401,5.140414"
id="path3115"
inkscape:path-effect="#path-effect3117"
inkscape:original-d="m 120.67435,61.080456 c 1.55406,1.367671 3.10796,2.735101 4.66173,4.102301 0.66832,2.63386 1.33649,5.26737 2.00453,7.90072 -0.62143,2.81111 -1.24298,5.62189 -1.86469,8.43252 -1.49163,1.49428 -2.98336,2.98831 -4.47524,4.48213" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 115.99401,66.369877 c 0.93292,0.812059 1.86573,1.624027 2.53264,2.81193 0.66692,1.187903 1.06802,2.751664 1.08197,4.368074 0.014,1.61641 -0.35915,3.285393 -0.99347,4.563459 -0.63431,1.278066 -1.52976,2.165182 -2.42524,3.052317"
id="path3115-4"
inkscape:path-effect="#path-effect3117-6"
inkscape:original-d="m 115.99401,66.369877 c 0.93289,0.81209 1.8657,1.62406 2.79841,2.43588 0.4012,1.56394 0.8023,3.1277 1.20331,4.69134 -0.37304,1.66922 -0.74616,3.3382 -1.11936,5.00712 -0.89543,0.88729 -1.79089,1.7744 -2.68646,2.66144" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 125.65039,55.168033 c 2.46165,2.066818 4.923,4.133391 6.68278,7.156798 1.75977,3.023407 2.81814,7.003389 2.85497,11.117374 0.0368,4.113986 -0.9477,8.361845 -2.62144,11.614689 -1.67374,3.252844 -4.03659,5.51072 -6.39943,7.768583"
id="path3115-8"
inkscape:path-effect="#path-effect3117-7"
inkscape:original-d="m 125.65039,55.168033 c 2.46157,2.06691 4.92292,4.133487 7.38405,6.199707 1.05862,3.980467 2.11699,7.960447 3.17515,11.940157 -0.98434,4.24836 -1.96886,8.49622 -2.95363,12.74383 -2.36272,2.2583 -4.72558,4.51617 -7.08869,6.77375" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="150mm"
height="150mm"
viewBox="0 0 150 150"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
sodipodi:docname="logo01.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.74564394"
inkscape:cx="379.53772"
inkscape:cy="512.97943"
inkscape:window-width="1242"
inkscape:window-height="1008"
inkscape:window-x="649"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs2">
<inkscape:path-effect
effect="bspline"
id="path-effect3117"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-7"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
<inkscape:path-effect
effect="bspline"
id="path-effect3117-6"
is_visible="true"
lpeversion="1"
weight="33.333333"
steps="2"
helper_size="0"
apply_no_weight="true"
apply_with_weight="true"
only_selected="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<text
xml:space="preserve"
style="font-size:3.175px;fill:#000000;stroke-width:0.264583"
x="11.709678"
y="81.967743"
id="text113"><tspan
sodipodi:role="line"
id="tspan111"
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Light';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="11.709678"
y="81.967743"><tspan
style="fill:#6f916f"
id="tspan167">delphin</tspan><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:25.4px;font-family:Calibri;-inkscape-font-specification:'Calibri, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#0b2817"
id="tspan165">ID</tspan></tspan></text>
<path
style="fill:#6f916f;stroke-width:0.264583"
d="m 27.322579,38.322579 6.741938,2.838712"
id="path535" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 120.67435,61.080456 c 1.55411,1.367612 3.10801,2.735039 4.219,4.735608 1.11098,2.00057 1.77914,4.634082 1.8024,7.356282 0.0232,2.7222 -0.5983,5.53298 -1.65497,7.685367 -1.05667,2.152388 -2.5484,3.646416 -4.0401,5.140414"
id="path3115"
inkscape:path-effect="#path-effect3117"
inkscape:original-d="m 120.67435,61.080456 c 1.55406,1.367671 3.10796,2.735101 4.66173,4.102301 0.66832,2.63386 1.33649,5.26737 2.00453,7.90072 -0.62143,2.81111 -1.24298,5.62189 -1.86469,8.43252 -1.49163,1.49428 -2.98336,2.98831 -4.47524,4.48213" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 115.99401,66.369877 c 0.93292,0.812059 1.86573,1.624027 2.53264,2.81193 0.66692,1.187903 1.06802,2.751664 1.08197,4.368074 0.014,1.61641 -0.35915,3.285393 -0.99347,4.563459 -0.63431,1.278066 -1.52976,2.165182 -2.42524,3.052317"
id="path3115-4"
inkscape:path-effect="#path-effect3117-6"
inkscape:original-d="m 115.99401,66.369877 c 0.93289,0.81209 1.8657,1.62406 2.79841,2.43588 0.4012,1.56394 0.8023,3.1277 1.20331,4.69134 -0.37304,1.66922 -0.74616,3.3382 -1.11936,5.00712 -0.89543,0.88729 -1.79089,1.7744 -2.68646,2.66144" />
<path
style="fill:none;stroke:#000000;stroke-width:0.85;stroke-dasharray:none;stroke-opacity:1"
d="m 125.65039,55.168033 c 2.46165,2.066818 4.923,4.133391 6.68278,7.156798 1.75977,3.023407 2.81814,7.003389 2.85497,11.117374 0.0368,4.113986 -0.9477,8.361845 -2.62144,11.614689 -1.67374,3.252844 -4.03659,5.51072 -6.39943,7.768583"
id="path3115-8"
inkscape:path-effect="#path-effect3117-7"
inkscape:original-d="m 125.65039,55.168033 c 2.46157,2.06691 4.92292,4.133487 7.38405,6.199707 1.05862,3.980467 2.11699,7.960447 3.17515,11.940157 -0.98434,4.24836 -1.96886,8.49622 -2.95363,12.74383 -2.36272,2.2583 -4.72558,4.51617 -7.08869,6.77375" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -398,15 +398,15 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX {
@Override
public void newSelectedDetectionGroup(DetectionGroupSummary detectionGroup, TDGraphFX tdGraph) {
System.out.println("New selected detection group: " + detectionGroup);
// System.out.println("New selected detection group: " + detectionGroup);
tdDisplayController.getDisplayDataBlock().clearAll();
if (detectionGroup==null || detectionGroup.getDataList().size()<=0) return;
System.out.println("Add pam data: " + detectionGroup + " " + tdDisplayController.getDisplayDataBlock().countObservers());
for (int i=0; i<tdDisplayController.getDisplayDataBlock().countObservers() ; i++) {
System.out.println("Observer : " + tdDisplayController.getDisplayDataBlock().getPamObserver(i));
}
// System.out.println("Add pam data: " + detectionGroup + " " + tdDisplayController.getDisplayDataBlock().countObservers());
// for (int i=0; i<tdDisplayController.getDisplayDataBlock().countObservers() ; i++) {
// System.out.println("Observer : " + tdDisplayController.getDisplayDataBlock().getPamObserver(i));
// }
tdDisplayController.getDisplayDataBlock().addPamData(detectionGroup.getDataList().get(detectionGroup.getFocusedIndex()));
if (isViewer()) tdDisplayController.getDisplayDataBlock().notifyNornalObservers(detectionGroup.getDataList().get(detectionGroup.getFocusedIndex()));

View File

@ -30,6 +30,7 @@ import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamButton;
import pamViewFX.fxNodes.PamHBox;
import pamViewFX.fxNodes.PamStackPane;
import pamViewFX.fxNodes.PamTabPane;
import pamViewFX.fxNodes.hidingPane.HidingPane;
import pamViewFX.fxStyles.PamStylesManagerFX;
@ -43,8 +44,14 @@ import pamViewFX.fxStyles.PamStylesManagerFX;
@SuppressWarnings("rawtypes")
public class DetectionGroupDisplay extends PamBorderPane {
/**
* Show the settings within hiding panes within the display.
*/
public static final int DISPLAY_COMPACT = 0;
/**
* Show settings on top and to the right of the display
*/
public static final int DISPLAY_EXTENDED = 1;
/**
@ -211,21 +218,32 @@ public class DetectionGroupDisplay extends PamBorderPane {
detectionDisplayHolder = new PamStackPane();
TabPane settingsPane = new TabPane();
settingsPane.setStyle(Styles.TABS_FLOATING);
settingsPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
// settingsPane.getStylesheets().addAll(PamStylesManagerFX.getPamStylesManagerFX().getCurStyle().getSlidingDialogCSS());
PamTabPane settingsPane = new PamTabPane();
settingsPane.setTabMinHeight(60);
settingsPane.setMinHeight(60);
// settingsPane.repackTabs();
settingsPane.getTabs().add(new Tab("Data",detectionDisplay.getDataTypePane()));
settingsPane.getTabs().add(new Tab("Settings",detectionDisplay.getSettingsHolder()));
settingsPane.setAddTabButton(false);
// settingsPane.getStyleClass().add(Styles.TABS_FLOATING);
settingsPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
//settingsPane.getStylesheets().addAll(PamStylesManagerFX.getPamStylesManagerFX().getCurStyle().getSlidingDialogCSS());
Tab dataTab = new Tab("Data",detectionDisplay.getDataTypePane());
Tab settingsTab = new Tab("Settings -BLAH",detectionDisplay.getSettingsHolder());
settingsPane.getTabs().add(dataTab);
settingsPane.getTabs().add(settingsTab);
hidingPane = new HidingPane(Side.RIGHT, settingsPane, detectionDisplayHolder, layoutType==DISPLAY_COMPACT, 0);
hidingPane.removeHideButton();
hidingPane.getHideButton().setMinWidth(40);
settingsPane.setTabStartRegion(hidingPane.getHideButton());
//now everything to pane.
detectionDisplayHolder.getChildren().add(detectionDisplay);
StackPane.setAlignment(detectionDisplay, Pos.CENTER);
settingsPane.setPadding(new Insets(35,0,0,0));
//settingsPane.setPadding(new Insets(35,0,0,0));
Node icon = PamGlyphDude.createPamIcon("mdi2c-cog", PamGuiManagerFX.iconSize);
detectionDisplay.getPlotPane().setHidePane(new PamBorderPane(settingsPane), icon, Side.RIGHT);

View File

@ -16,7 +16,7 @@ import userDisplayFX.UserDisplayNodeFX;
/**
* A group detection display with all the bits added to allow the display to be used in the FX GUI as
* a stand alone user display.
* a stand-alone user display.
*
* @author Jamie Macaulay
*
@ -211,8 +211,8 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
public boolean setDataUnit(PamDataUnit<?, ?> dataUnit){
/**
* The extra stuff here is to make sure that the plot types for a specific detectin are saved. So for example
* if viewing click spectrum then the spectrum plot is selected whenever 1) PAMGuard is opned again or 2) switching from
* The extra stuff here is to make sure that the plot types for a specific detection are saved. So for example
* if viewing click spectrum then the spectrum plot is selected whenever 1) PAMGuard is opened again or 2) switching from
* one type of detection ot another e.g. whistle to click, then the click does nto revert to shwoing a waveform instead
* of spectrum.
*/
@ -220,7 +220,7 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
if (currentDetection!=null) {
//save the current selected detection plot for the particular type of data unit.
String detectionPlotName = this.getDetectionDisplay().getCurrentDataInfo().getCurrentDetectionPlot().getName();
// System.out.println("SET CURRENT DETECTION PLOT TO USE IS: " + detectionPlotName);
//System.out.println("SET CURRENT DETECTION PLOT TO USE IS: " + detectionPlotName);
detectionPlotParams.dataAxisMap.put(currentDetection.getParentDataBlock().getLongDataName(), detectionPlotName);
}

View File

@ -20,7 +20,7 @@ public class DetectionPlotParams extends UserDisplayNodeParams implements Clonea
/**
*
*/
static final long serialVersionUID = 2L;
static final long serialVersionUID = 3L;
/**
* The data source for the detection plot.

View File

@ -63,8 +63,14 @@ public class PamSVGIcon {
}
return instance;
}
@Deprecated
public PamSVGIcon create(URL path, Color color, double lineWidth) throws Exception {
return create(path);
}
public PamSVGIcon create(URL path) throws Exception {
// System.out.println("Create icon start");
@ -145,7 +151,7 @@ public class PamSVGIcon {
for (int ii=0; ii<map.getLength(); ii++) {
String col;
// System.out.println(map.item(ii).getNodeName() + " " + map.item(ii).getFirstChild().getNodeValue());
//System.out.println(map.item(ii).getNodeName() + " " + map.item(ii).getFirstChild().getNodeValue());
switch (map.item(ii).getNodeName()) {
case "fill":

View File

@ -156,7 +156,9 @@ public class PlotPane extends PamBorderPane {
//create the plot pane.
canvasHolder=new PamBorderPane();
canvasHolder.setMaxWidth(4000);
canvasHolder.setMaxHeight(4000);
canvas = new Canvas(50, 50);
canvas.heightProperty().bind(canvasHolder.heightProperty());
canvas.widthProperty().bind(canvasHolder.widthProperty());

View File

@ -35,6 +35,7 @@ import rawDeepLearningClassifier.dlClassification.DLClassifierChooser;
import rawDeepLearningClassifier.dlClassification.DLClassifyProcess;
import rawDeepLearningClassifier.dlClassification.animalSpot.SoundSpotClassifier;
import rawDeepLearningClassifier.dlClassification.archiveModel.PamZipModelClassifier;
import rawDeepLearningClassifier.dlClassification.delphinID.DelphinIDClassifier;
import rawDeepLearningClassifier.dlClassification.genericModel.GenericDLClassifier;
import rawDeepLearningClassifier.dlClassification.ketos.KetosClassifier2;
import rawDeepLearningClassifier.dlClassification.koogu.KooguClassifier;
@ -257,6 +258,7 @@ public class DLControl extends PamControlledUnit implements PamSettings {
dlModels.add(new KetosClassifier2(this));
dlModels.add(new KooguClassifier(this));
dlModels.add(new PamZipModelClassifier(this));
dlModels.add(new DelphinIDClassifier(this));
//it is important the Generic Model is last because we need to check
//for PG metadata in all other models before resorting to manually

View File

@ -10,6 +10,7 @@ import org.jamdev.jdl4pam.transforms.SimpleTransform;
import org.jamdev.jdl4pam.transforms.SimpleTransformParams;
import PamguardMVC.PamDataUnit;
import javafx.scene.Node;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.DLStatus;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
@ -127,6 +128,7 @@ public interface DLClassiferModel {
return dlTransformParams;
}

View File

@ -59,10 +59,10 @@ public class DLClassifierChooser {
String frameworkString = frameworkObject.getString("framework");
for (DLClassiferModel model: dlControl.getDLModels()) {
//System.out.println("frameworkString: " + frameworkString + " " + model.getName());
System.out.println("frameworkString: " + frameworkString + " " + model.getName());
if (model.getName().toLowerCase().equals(frameworkString.trim().toLowerCase())) return model;
}
}
else {
System.err.println("DLClassifierChooser: Unable to extract the metadata file even though it exists in the zip archive:??");
@ -86,7 +86,7 @@ public class DLClassifierChooser {
if (model.isModelType(modelURI)) return model;
}
//return the generic model.
//return the generic model as default
return dlControl.getDLModels().get(dlControl.getDLModels().size()-1);
}

View File

@ -72,7 +72,8 @@ public abstract class StandardClassifierModel implements DLClassiferModel, PamSe
*/
if ((PamCalendar.isSoundFile() && !forceQueue) || dlControl.isViewer()) {
//run the model
ArrayList<GenericPrediction> modelResult = getDLWorker().runModel(groupedRawData,
@SuppressWarnings("unchecked")
ArrayList<GenericPrediction> modelResult = (ArrayList<GenericPrediction>) getDLWorker().runModel(groupedRawData,
groupedRawData.get(0).getParentDataBlock().getSampleRate(), 0);
if (modelResult==null) {
@ -134,7 +135,7 @@ public abstract class StandardClassifierModel implements DLClassiferModel, PamSe
* Get the sound spot worker.
* @return the sound spot worker.
*/
public abstract DLModelWorker<GenericPrediction> getDLWorker();
public abstract DLModelWorker<? extends PredictionResult> getDLWorker();
/**
* Get the sound spot worker.

View File

@ -6,6 +6,7 @@ import java.util.List;
import javax.swing.JPanel;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
@ -83,4 +84,10 @@ public class SoundSpotUI implements DLCLassiferModelUI {
return extensionFilters;
}
@Override
public Node getIcon() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -128,11 +128,20 @@ public abstract class StandardModelPane extends SettingsPane<StandardModelParams
private PamBorderPane createPane() {
PamBorderPane mainPane = new PamBorderPane();
Label classiferInfoLabel = new Label(dlClassifierModel.getName() + " Classifier");
//PamGuiManagerFX.titleFont2style(classiferInfoLabel);
//font to use for title labels.
Font font= Font.font(null, FontWeight.BOLD, 11);
classiferInfoLabel.setFont(font);
Node classifierIcon;
if (dlClassifierModel.getModelUI()!=null && dlClassifierModel.getModelUI().getIcon()!=null) {
classifierIcon = dlClassifierModel.getModelUI().getIcon();
}
else {
Label classiferInfoLabel = new Label(dlClassifierModel.getName() + " Classifier");
//PamGuiManagerFX.titleFont2style(classiferInfoLabel);
classiferInfoLabel.setFont(font);
classifierIcon=classiferInfoLabel;
}
// PamButton advButton = new PamButton("", PamGlyphDude.createPamGlyph(MaterialDesignIcon.SETTINGS, PamGuiManagerFX.iconSize));
PamButton advButton = new PamButton("", PamGlyphDude.createPamIcon("mdi2c-cog", PamGuiManagerFX.iconSize));
@ -238,7 +247,7 @@ public abstract class StandardModelPane extends SettingsPane<StandardModelParams
vBoxHolder = new PamVBox();
vBoxHolder.setSpacing(5);
vBoxHolder.getChildren().addAll(classiferInfoLabel, advSettings, classiferInfoLabel2, gridPane);
vBoxHolder.getChildren().addAll(classifierIcon, advSettings, classiferInfoLabel2, gridPane);
mainPane.setCenter(vBoxHolder);
@ -322,7 +331,7 @@ public abstract class StandardModelPane extends SettingsPane<StandardModelParams
if (currentSelectedFile==null) {
//uuurgh need to sort this out with FX stuff
WarnOnce.showWarningFX(null, "No Model File", "There is no model file selected in the path: Please select a compatible model" , AlertType.ERROR);
WarnOnce.showWarningFX(null, "No Model File", "There is no model file selected in the path: Please select a compatible model" , AlertType.ERROR);
}
else {

View File

@ -138,9 +138,7 @@ public abstract class ArchiveModelClassifier extends StandardClassifierModel {
ArrayList<DLTransfromParams> dlTransformParams = DLClassiferModel.getDLTransformParams(standardDLParams.dlTransfroms);
standardDLParams.dlTransfromParams=dlTransformParams;
// System.out.println("KetosParams have been saved. : " + standardDLParams.dlTransfromParams);
return standardDLParams;
}
@ -161,8 +159,10 @@ public abstract class ArchiveModelClassifier extends StandardClassifierModel {
standardDLParams.dlTransfroms = DLTransformsFactory
.makeDLTransforms((ArrayList<DLTransfromParams>) standardDLParams.dlTransfromParams);
}
} else
}
else {
standardDLParams = makeParams();
}
return true;
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import javax.swing.JPanel;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelPane;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
@ -90,6 +91,12 @@ public class ArchiveModelUI implements DLCLassiferModelUI {
this.extensionFilters = extensionFilters;
}
@Override
public Node getIcon() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -229,9 +229,9 @@ public class ArchiveModelWorker extends GenericModelWorker {
@Override
public GenericPrediction makeModelResult(float[] prob, double time) {
GenericPrediction soundSpotResult = new GenericPrediction(prob);
soundSpotResult.setAnalysisTime(time);
return soundSpotResult;
GenericPrediction prediction = new GenericPrediction(prob);
prediction.setAnalysisTime(time);
return prediction;
}

View File

@ -4,18 +4,14 @@ import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import org.jamdev.jdl4pam.transforms.DLTransformsFactory;
import org.jamdev.jdl4pam.transforms.DLTransfromParams;
import PamController.PamControlledUnitSettings;
import PamController.PamSettings;
import PamguardMVC.PamDataUnit;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.DLStatus;
import rawDeepLearningClassifier.dlClassification.DLClassName;
import rawDeepLearningClassifier.dlClassification.DLClassiferModel;
import rawDeepLearningClassifier.dlClassification.PredictionResult;
import rawDeepLearningClassifier.dlClassification.StandardClassifierModel;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
import rawDeepLearningClassifier.dlClassification.archiveModel.ArchiveModelClassifier;
import rawDeepLearningClassifier.dlClassification.archiveModel.ArchiveModelWorker;
import rawDeepLearningClassifier.dlClassification.genericModel.DLModelWorker;
import rawDeepLearningClassifier.dlClassification.genericModel.GenericPrediction;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
@ -28,76 +24,108 @@ import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
*
*/
public class DelphinIDClassifier extends StandardClassifierModel {
private DelphinIDParams delphinIDParams = new DelphinIDParams();
private DelphinUI delphinUI;
private DelphinIDWorker delphinIDWorker;
public DelphinIDClassifier(DLControl dlControl) {
super(dlControl);
// TODO Auto-generated constructor stub
}
@Override
public boolean isModelType(URI model) {
// TODO Auto-generated method stub
return false;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
return "delphinID";
}
@Override
public DLCLassiferModelUI getModelUI() {
// TODO Auto-generated method stub
return null;
if (delphinUI==null) {
delphinUI = new DelphinUI(this);
}
return delphinUI;
}
@Override
public Serializable getDLModelSettings() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getUnitType() {
// TODO Auto-generated method stub
return null;
}
@Override
public Serializable getSettingsReference() {
// TODO Auto-generated method stub
return null;
}
@Override
public long getSettingsVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
// TODO Auto-generated method stub
return false;
return delphinIDParams;
}
@Override
public String getUnitName() {
// TODO Auto-generated method stub
return null;
return dlControl.getUnitName()+"_" + getName();
}
@Override
public String getUnitType() {
return dlControl.getUnitType()+"_" + getName();
}
@Override
public Serializable getSettingsReference() {
if (delphinIDParams==null) {
delphinIDParams = new DelphinIDParams();
}
ArrayList<DLTransfromParams> dlTransformParams = DLClassiferModel.getDLTransformParams(delphinIDParams.dlTransfroms);
delphinIDParams.dlTransfromParams=dlTransformParams;
//System.out.println("SoundSpot have been saved. : " + soundSpotParmas.classNames);
return delphinIDParams;
}
@Override
public long getSettingsVersion() {
return StandardModelParams.serialVersionUID;
}
@Override
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
DelphinIDParams newParameters = (DelphinIDParams) pamControlledUnitSettings.getSettings();
if (newParameters!=null) {
delphinIDParams = (DelphinIDParams) newParameters.clone();
//System.out.println("SoundSpot have been restored. : " + soundSpotParmas.classNames);
if (delphinIDParams.dlTransfromParams!=null) {
delphinIDParams.dlTransfroms = DLTransformsFactory.makeDLTransforms((ArrayList<DLTransfromParams>) delphinIDParams.dlTransfromParams);
}
}
else delphinIDParams = new DelphinIDParams();
return true;
}
@Override
public DLModelWorker<GenericPrediction> getDLWorker() {
// TODO Auto-generated method stub
return null;
if (delphinIDWorker==null) {
delphinIDWorker = new DelphinIDWorker();
}
return delphinIDWorker;
}
@Override
public StandardModelParams getDLParams() {
// TODO Auto-generated method stub
return null;
public DelphinIDParams getDLParams() {
return delphinIDParams;
}
public void setDLParams(DelphinIDParams params) {
this.delphinIDParams=params;
}
}

View File

@ -0,0 +1,88 @@
package rawDeepLearningClassifier.dlClassification.delphinID;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.Pane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import pamViewFX.fxNodes.PamVBox;
/**
* Settings pane for delphin ID.
*
* @author Jamie Macaulay
*
*/
public class DelphinIDPane extends SettingsPane<DelphinIDParams> {
/**
* The main pane.
*/
private Pane mainPane;
/**
* Reference to the delphinID classifier
*/
private DelphinIDClassifier delphinUIClassifier;
public DelphinIDPane(DelphinIDClassifier delphinUIClassifier) {
super(null);
this.delphinUIClassifier = delphinUIClassifier;
mainPane = createPane();
}
private Pane createPane() {
//font to use for title labels.
Font font= Font.font(null, FontWeight.BOLD, 11);
Node classifierIcon;
classifierIcon = delphinUIClassifier.getModelUI().getIcon();
PamVBox vBox = new PamVBox();
vBox.setSpacing(5.);
/**Classification thresholds etc to set.**/
Label classiferInfoLabel2 = new Label("Decision Threshold");
classiferInfoLabel2.setTooltip(new Tooltip("Set the minimum prediciton value for selected classes. If a prediction exceeds this value "
+ "a detection will be saved."));
classiferInfoLabel2.setFont(font);
vBox.getChildren().addAll(classifierIcon, classiferInfoLabel2);
return vBox;
}
@Override
public DelphinIDParams getParams(DelphinIDParams currParams) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setParams(DelphinIDParams input) {
// TODO Auto-generated method stub
}
@Override
public String getName() {
return "delphinIDParams";
}
@Override
public Node getContentNode() {
return mainPane;
}
@Override
public void paneInitialized() {
// TODO Auto-generated method stub
}
}

View File

@ -1,55 +1,74 @@
package rawDeepLearningClassifier.dlClassification.delphinID;
import java.util.ArrayList;
import org.jamdev.jdl4pam.transforms.DLTransform;
import PamguardMVC.PamDataUnit;
import rawDeepLearningClassifier.DLControl;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
import rawDeepLearningClassifier.dlClassification.genericModel.DLModelWorker;
import rawDeepLearningClassifier.dlClassification.archiveModel.ArchiveModelWorker;
import rawDeepLearningClassifier.segmenter.GroupedRawData;
public class DelphinIDWorker extends DLModelWorker<DelphinIDPrediction>{
@Override
public float[] runModel(float[][][] transformedDataStack) {
// TODO Auto-generated method stub
return null;
}
public class DelphinIDWorker extends ArchiveModelWorker {
@Override
public boolean isModelNull() {
// TODO Auto-generated method stub
return false;
}
@Override
public DelphinIDPrediction makeModelResult(float[] prob, double time) {
// TODO Auto-generated method stub
return null;
}
@Override
public void prepModel(StandardModelParams delphinIDParams, DLControl dlControl) {
// TODO Auto-generated method stub
}
@Override
public void closeModel() {
// TODO Auto-generated method stub
}
@Override
public float[][][] dataUnits2ModelInput(ArrayList<? extends PamDataUnit> dataUnits, float sampleRate, int iChan){
//Our data units are groups of whistles.
return null;
}
ArrayList<DLTransform> modelTransforms = getModelTransforms();
@SuppressWarnings("unchecked")
ArrayList<GroupedRawData> whistleGroups = (ArrayList<GroupedRawData>) dataUnits;
//the number of chunks.
int numChunks = whistleGroups.size();
//data input into the model - a stack of spectrogram images.
float[][][] transformedDataStack = new float[numChunks][][];
//
// //generate the spectrogram stack.
// AudioData soundData;
// double[][] transformedData2; //spec data
// double[] transformedData1; //waveform data
// for (int j=0; j<numChunks; j++) {
//
// soundData = new AudioData(rawDataUnits.get(j).getRawData()[iChan], sampleRate);
//
// // for (int i=0; i<modelTransforms.size(); i++) {
// // System.out.println("Transfrom type: " + modelTransforms.get(i).getDLTransformType());
// // }
// //set the sound in the first transform.
// ((WaveTransform) modelTransforms.get(0)).setWaveData(soundData);
//
//// System.out.println("Model transforms:no. " + modelTransforms.size()+ " input sounds len: " + soundData.getLengthInSeconds()
//// + " Decimate Params: " + ((WaveTransform) modelTransforms.get(0)).getParams()[0] + "max amplitude sound: " + PamArrayUtils.max(soundData.samples));
//
// DLTransform transform = modelTransforms.get(0);
// for (int i =0; i<modelTransforms.size(); i++) {
// transform = modelTransforms.get(i).transformData(transform);
//// //TEMP
//// if (transform instanceof FreqTransform) {
//// transformedData = ((FreqTransform) transform).getSpecTransfrom().getTransformedData();
//// System.out.println("DLModelWorker: transform : " + modelTransforms.get(i).getDLTransformType() + " "+ i + transformedData.length + " " + transformedData[0].length + " minmax: " + PamArrayUtils.minmax(transformedData)[0] + " " + PamArrayUtils.minmax(transformedData)[1]);
//// }
// }
//
// if (transform instanceof FreqTransform) {
// //add a spectrogram to the stacl
// transformedData2 = ((FreqTransform) transform).getSpecTransfrom().getTransformedData();
// transformedDataStack[j] = DLUtils.toFloatArray(transformedData2);
// }
// else {
// //add wavefrom to the stack = we make the 2nd dimesnion 1.
// transformedData1 = ((WaveTransform) transform).getWaveData().getScaledSampleAmplitudes();
// transformedDataStack[j] = new float[1][transformedData1.length];
// transformedDataStack[j][0] = DLUtils.toFloatArray(transformedData1);
// }
// }
return transformedDataStack;
}
}

View File

@ -0,0 +1,106 @@
package rawDeepLearningClassifier.dlClassification.delphinID;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import pamViewFX.fxGlyphs.PamSVGIcon;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
/**
* DelphinID user interface components.
*
* @author Jamie Macaulay
*
*/
public class DelphinUI implements DLCLassiferModelUI {
/**
* The icon.
*/
private Node icon;
/**
* Reference to the delphinID classifier.
*/
private DelphinIDClassifier delphinUIClassifier;
/**
* The delphinID settings pane.
*/
private DelphinIDPane delphinIDSettings;
/**
* List of extension filters for this type of model.
*/
private ArrayList<ExtensionFilter> extensionFilters;
public DelphinUI(DelphinIDClassifier delphinUIClassifier) {
this.delphinUIClassifier=delphinUIClassifier;
extensionFilters = new ArrayList<ExtensionFilter>();
//import the settings holder
extensionFilters.add(new ExtensionFilter("Zip Model", "*.zip"));
}
@Override
public SettingsPane<DelphinIDParams> getSettingsPane() {
if (delphinIDSettings==null) {
delphinIDSettings = new DelphinIDPane(delphinUIClassifier);
}
return delphinIDSettings;
}
@Override
public void getParams() {
DelphinIDParams params = getSettingsPane().getParams(delphinUIClassifier.getDLParams());
delphinUIClassifier.setDLParams(params);
}
@Override
public void setParams() {
// System.out.println("Set model params: " + genericModelClassifier.getGenericDLParams().dlTransfromParams.size());
getSettingsPane().setParams(delphinUIClassifier.getDLParams());
}
@Override
public List<ExtensionFilter> getModelFileExtensions() {
//this is a bit redundant because zip files
return extensionFilters;
}
@Override
public JPanel getSidePanel() {
// TODO Auto-generated method stub
return null;
}
@Override
public Node getIcon() {
if (icon==null) {
PamSVGIcon iconMaker= new PamSVGIcon();
PamSVGIcon svgsprite;
try {
svgsprite = iconMaker.create(getClass().getResource("/Resources/delphinid_logo01.svg").toURI().toURL());
icon = svgsprite.getSpriteNode();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return icon;
}
}

View File

@ -9,6 +9,7 @@ import PamController.SettingsPane;
import PamView.dialog.warn.WarnOnce;
import PamView.dialog.warn.WarnOnceDialog;
import javafx.application.Platform;
import javafx.scene.Node;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.FileChooser.ExtensionFilter;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
@ -88,4 +89,10 @@ public class GenericModelUI implements DLCLassiferModelUI {
public List<ExtensionFilter> getModelFileExtensions() {
return extensionFilters;
}
@Override
public Node getIcon() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import javax.swing.JPanel;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import rawDeepLearningClassifier.dlClassification.animalSpot.StandardModelParams;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
@ -76,6 +77,12 @@ public class KetosUI implements DLCLassiferModelUI {
return extensionFilters;
}
@Override
public Node getIcon() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.swing.SwingUtilities;
import PamController.SettingsPane;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import rawDeepLearningClassifier.layoutFX.DLCLassiferModelUI;
@ -79,4 +80,10 @@ public class OrcaSpotClassifierUI implements DLCLassiferModelUI {
return null;
}
@Override
public Node getIcon() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -3,6 +3,8 @@ package rawDeepLearningClassifier.layoutFX;
import java.util.List;
import javax.swing.JPanel;
import javafx.scene.Node;
import javafx.stage.FileChooser.ExtensionFilter;
import PamController.SettingsPane;
@ -42,5 +44,12 @@ public interface DLCLassiferModelUI {
*/
public JPanel getSidePanel();
/**
* Get an icon for the model. Note that this can be null in
* which case the icon in the UI will be a label with the mdoel name.
* @return teh model icon.
*/
public Node getIcon();
}

View File

@ -380,9 +380,11 @@ public class DLSettingsPane extends SettingsPane<RawDLParams>{
* Set the classifier pane.
*/
protected void setClassifierPane() {
//set the classifier Pane.class
if (modelSelectPane.currentClassifierModel!=null && modelSelectPane.currentClassifierModel.getModelUI()!=null) {
classifierPane.setCenter(modelSelectPane.currentClassifierModel.getModelUI().getSettingsPane().getContentNode());
if (modelSelectPane.currentClassifierModel!=null) {