Skip to content

Commit

Permalink
Add dnn tab and start poking at backend
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Dec 20, 2023
1 parent 04ef325 commit 8faa391
Show file tree
Hide file tree
Showing 12 changed files with 502 additions and 287 deletions.
17 changes: 12 additions & 5 deletions photon-client/src/components/dashboard/ConfigOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import OutputTab from "@/components/dashboard/tabs/OutputTab.vue";
import TargetsTab from "@/components/dashboard/tabs/TargetsTab.vue";
import PnPTab from "@/components/dashboard/tabs/PnPTab.vue";
import Map3DTab from "@/components/dashboard/tabs/Map3DTab.vue";
import DnnTab from "@/components/dashboard/tabs/DnnTab.vue";
import { WebsocketPipelineType } from "@/types/WebsocketDataTypes";
interface ConfigOption {
Expand Down Expand Up @@ -55,7 +56,11 @@ const allTabs = Object.freeze({
map3dTab: {
tabName: "3D",
component: Map3DTab
}
},
dnnTab: {
tabName: "DNN",
component: DnnTab
},
});
const selectedTabs = ref([0, 0, 0, 0]);
Expand All @@ -75,21 +80,22 @@ const getTabGroups = (): ConfigOption[][] => {
allTabs.contoursTab,
allTabs.apriltagTab,
allTabs.arucoTab,
allTabs.dnnTab,
allTabs.outputTab
],
[allTabs.targetsTab, allTabs.pnpTab, allTabs.map3dTab]
];
} else if (lgAndDown) {
return [
[allTabs.inputTab],
[allTabs.thresholdTab, allTabs.contoursTab, allTabs.apriltagTab, allTabs.arucoTab, allTabs.outputTab],
[allTabs.thresholdTab, allTabs.contoursTab, allTabs.apriltagTab, allTabs.arucoTab, allTabs.dnnTab, allTabs.outputTab],
[allTabs.targetsTab, allTabs.pnpTab, allTabs.map3dTab]
];
} else if (xl) {
return [
[allTabs.inputTab],
[allTabs.thresholdTab],
[allTabs.contoursTab, allTabs.apriltagTab, allTabs.arucoTab, allTabs.outputTab],
[allTabs.contoursTab, allTabs.apriltagTab, allTabs.arucoTab, allTabs.dnnTab, allTabs.outputTab],
[allTabs.targetsTab, allTabs.pnpTab, allTabs.map3dTab]
];
}
Expand All @@ -103,15 +109,16 @@ const tabGroups = computed<ConfigOption[][]>(() => {
const allow3d = useCameraSettingsStore().currentPipelineSettings.solvePNPEnabled;
const isAprilTag = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.AprilTag;
const isAruco = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Aruco;
const isDNN = useCameraSettingsStore().currentWebsocketPipelineType === WebsocketPipelineType.Dnn;
return getTabGroups()
.map((tabGroup) =>
tabGroup.filter(
(tabConfig) =>
!(!allow3d && tabConfig.tabName === "3D") && //Filter out 3D tab any time 3D isn't calibrated
!((!allow3d || isAprilTag || isAruco) && tabConfig.tabName === "PnP") && //Filter out the PnP config tab if 3D isn't available, or we're doing AprilTags
!((isAprilTag || isAruco) && tabConfig.tabName === "Threshold") && //Filter out threshold tab if we're doing AprilTags
!((isAprilTag || isAruco) && tabConfig.tabName === "Contours") && //Filter out contours if we're doing AprilTags
!((isAprilTag || isAruco || isDNN) && tabConfig.tabName === "Threshold") && //Filter out threshold tab if we're doing AprilTags
!((isAprilTag || isAruco || isDNN) && tabConfig.tabName === "Contours") && //Filter out contours if we're doing AprilTags
!(!isAprilTag && tabConfig.tabName === "AprilTag") && //Filter out apriltag unless we actually are doing AprilTags
!(!isAruco && tabConfig.tabName === "Aruco") //Filter out aruco unless we actually are doing Aruco
)
Expand Down
48 changes: 48 additions & 0 deletions photon-client/src/components/dashboard/tabs/DnnTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script setup lang="ts">
import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore";
import { PipelineType } from "@/types/PipelineTypes";
import PvSelect from "@/components/common/pv-select.vue";
import PvSlider from "@/components/common/pv-slider.vue";
import PvSwitch from "@/components/common/pv-switch.vue";

Check warning on line 6 in photon-client/src/components/dashboard/tabs/DnnTab.vue

View workflow job for this annotation

GitHub Actions / PhotonClient Lint and Formatting

'PvSwitch' is defined but never used
import { computed, getCurrentInstance } from "vue";
import { useStateStore } from "@/stores/StateStore";
// TODO fix pipeline typing in order to fix this, the store settings call should be able to infer that only valid pipeline type settings are exposed based on pre-checks for the entire config section
// Defer reference to store access method
const currentPipelineSettings = useCameraSettingsStore().currentPipelineSettings;
const interactiveCols = computed(
() =>
(getCurrentInstance()?.proxy.$vuetify.breakpoint.mdAndDown || false) &&
(!useStateStore().sidebarFolded || useCameraSettingsStore().isDriverMode)
)
? 9
: 8;
const models = () => {
return ["a", "bcd"]
}
</script>

<template>
<div v-if="currentPipelineSettings.pipelineType === PipelineType.Dnn">
<pv-select
v-model="currentPipelineSettings.modelIndex"
label="Target family"
:items = models
:select-cols="interactiveCols"
@input="(value) => useCameraSettingsStore().changeCurrentPipelineSetting({ tagFamily: value }, false)"
/>
<pv-slider
v-model="currentPipelineSettings.confidence"
class="pt-2"
:slider-cols="interactiveCols"
label="Confidence"
tooltip="asdf"
:min="0"
:max="1"
:step="-1"
@input="(value) => useCameraSettingsStore().changeCurrentPipelineSetting({ decimate: value }, false)"
/>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public abstract class CVPipe<I, O, P> {
public void setParams(P params) {
this.params = params;
}
public P getParams() {
return this.params;
}

/**
* Runs the process for the pipe.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.photonvision.vision.pipe.impl;

import org.opencv.core.Rect2d;

public class NeuralNetworkPipeResult {
public NeuralNetworkPipeResult(Rect2d box2, Integer integer, Float float1) {
box = box2;
classIdx = integer;
confidence = float1;
}
public final int classIdx;
public final Rect2d box;
public final double confidence;
}
Loading

0 comments on commit 8faa391

Please sign in to comment.