Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 230 additions & 35 deletions src/components/ProcessingPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { showError, showSuccess } = useNotifier()
const { hasMore, isLoading, searchResults, searchStatus, handleSearchResults } = useSearch()
const { activeTileId, currentBBox, currentBBoxValid, secondActiveTileId, currentMgrsTileId } =
useAreaOfInterest()
const { settings, availableModels, modelIsSingleShot } = useSettings()
const { processingSettings, settings, availableModels, modelIsSingleShot } = useSettings()
const { isBatchProcessing } = useProcessingMode()
const { placeSearch, isLoadingPlaces, suggestedPlaces, handleLocationSelected } = useGeocoding()
const { processBatch, processSmallArea, isProcessing } = useBatchProcessing()
Expand Down Expand Up @@ -89,6 +89,25 @@ const isSelectingScenes = computed(
() => sceneSelectionStatus.value === null && settings.value.autoSceneSelection,
)

const patchSizes = [32, 64, 128, 256, 512, 1024, 2048, 4096]
const patchSizeEnabled = ref(true)
watch(patchSizeEnabled, (newValue) => {
if (newValue) {
processingSettings.value.inference_patch_size = null
} else {
processingSettings.value.inference_patch_size = 256
}
})

const paddingEnabled = ref(true)
watch(paddingEnabled, (newValue) => {
if (newValue) {
processingSettings.value.inference_padding = null
} else {
processingSettings.value.inference_padding = 64
}
})

let abortController: AbortController | null = null
watch(
[currentBBox, settings],
Expand Down Expand Up @@ -341,24 +360,6 @@ const loadMore = async () => {
}
}

const updateCloudCoverInput = () => {
// Ensure the value is a number and not below 1
const value = Number(settings.value.cloudCover)
settings.value.cloudCover = Math.max(1, value)
}

const updateAreaCoverageInput = () => {
// Ensure the value is a number and not below 1
const value = Number(settings.value.areaCoverage)
settings.value.areaCoverage = Math.max(1, value)
}

const updateBufferInput = () => {
// Ensure the value is a number and not below 1
const value = Number(settings.value.buffer)
settings.value.buffer = Math.max(1, value)
}

// Handle tile selection from search modal
const handleTileSelected = (tileName: string) => {
// Find the tile feature on the map and trigger the tile selection
Expand Down Expand Up @@ -694,7 +695,6 @@ const getStatus = (condition: any, warn: boolean = false) => {
:items="months"
label=" Start Month"
variant="outlined"
density="compact"
hide-details
:disabled="settings.autoSceneSelection"
item-value="value"
Expand All @@ -707,7 +707,6 @@ const getStatus = (condition: any, warn: boolean = false) => {
:items="months"
label="End Month"
variant="outlined"
density="compact"
hide-details
:disabled="settings.autoSceneSelection"
item-value="value"
Expand Down Expand Up @@ -768,12 +767,11 @@ const getStatus = (condition: any, warn: boolean = false) => {
<!-- Cloud Coverage -->
<v-row>
<v-col cols="6">
<v-label class="text-subtitle-2">Cloud Cover (%)</v-label>
<v-label>Cloud Cover (%)</v-label>
</v-col>
<v-col cols="6" class="d-flex justify-end">
<v-number-input
v-model="settings.cloudCover"
@update:model-value="updateCloudCoverInput"
v-model.number="settings.cloudCover"
:min="1"
:max="100"
:step="1"
Expand All @@ -789,15 +787,14 @@ const getStatus = (condition: any, warn: boolean = false) => {
<v-row>
<v-col>
<v-slider
v-model="settings.cloudCover"
v-model.number="settings.cloudCover"
:min="1"
:max="100"
:step="1"
color="teal"
track-color="grey-darken-2"
thumb-color="teal"
hide-details
@update:model-value="updateCloudCoverInput"
/>
</v-col>
</v-row>
Expand All @@ -812,7 +809,7 @@ const getStatus = (condition: any, warn: boolean = false) => {
<!-- Area Coverage -->
<v-row>
<v-col cols="6">
<v-label class="text-subtitle-2">
<v-label>
<template v-if="settings.autoSceneSelection">Search Buffer (days)</template>
<template v-else>Area Coverage (%)</template>
</v-label>
Expand All @@ -821,8 +818,7 @@ const getStatus = (condition: any, warn: boolean = false) => {
<v-col cols="6" class="d-flex justify-end">
<v-number-input
v-if="settings.autoSceneSelection"
v-model="settings.buffer"
@update:model-value="updateBufferInput"
v-model.number="settings.buffer"
:min="1"
:max="60"
:step="1"
Expand All @@ -835,8 +831,7 @@ const getStatus = (condition: any, warn: boolean = false) => {
></v-number-input>
<v-number-input
v-else
v-model="settings.areaCoverage"
@update:model-value="updateAreaCoverageInput"
v-model.number="settings.areaCoverage"
:min="1"
:max="100"
:step="1"
Expand All @@ -853,8 +848,7 @@ const getStatus = (condition: any, warn: boolean = false) => {
<v-col>
<v-slider
v-if="settings.autoSceneSelection"
v-model="settings.buffer"
@update:model-value="updateBufferInput"
v-model.number="settings.buffer"
:min="1"
:max="60"
:step="1"
Expand All @@ -865,8 +859,7 @@ const getStatus = (condition: any, warn: boolean = false) => {
/>
<v-slider
v-else
v-model="settings.areaCoverage"
@update:model-value="updateAreaCoverageInput"
v-model.number="settings.areaCoverage"
:min="1"
:max="100"
:step="1"
Expand Down Expand Up @@ -1076,6 +1069,208 @@ const getStatus = (condition: any, warn: boolean = false) => {
</v-btn>
</div>
</v-expansion-panel>
<!-- Inference -->
<v-expansion-panel v-if="settings.expertMode && currentMgrsTileId" value="inference">
<v-expansion-panel-title>
<span class="header-text">
<v-badge v-bind="getStatus(true)"></v-badge>
Inference Settings
</span>
</v-expansion-panel-title>
<v-expansion-panel-text>
<!-- resize_factor -->
<v-row>
<v-col cols="7">
<v-label>Resize factor</v-label>
</v-col>
<v-col cols="5" class="d-flex justify-end">
<v-number-input
v-model.number="processingSettings.inference_resize_factor"
:min="1"
:max="5"
:step="1"
:precision="0"
density="compact"
variant="outlined"
control-variant="stacked"
hide-details
class="coverage-input"
></v-number-input>
</v-col>
</v-row>
<v-row>
<v-col>
<v-slider
v-model.number="processingSettings.inference_resize_factor"
:min="1"
:max="5"
:step="1"
color="teal"
track-color="grey-darken-2"
thumb-color="teal"
hide-details
/>
</v-col>
</v-row>
<!-- patch_size -->
<v-row>
<v-col>
<v-checkbox v-model="patchSizeEnabled" density="compact" hide-details
><template v-slot:label>Automatic patch size</template>
</v-checkbox>
</v-col>
</v-row>
<v-row v-if="!patchSizeEnabled">
<v-col>
<v-select
v-model.number="processingSettings.inference_patch_size"
label="Patch Size (must be a power of 2)"
:items="patchSizes"
variant="outlined"
hide-details
></v-select>
</v-col>
</v-row>
<!-- padding -->
<template v-if="!modelTitle?.includes('DelineateAnything')">
<v-row>
<v-col :cols="paddingEnabled ? 12 : 7">
<v-checkbox v-model="paddingEnabled" density="compact" hide-details
><template v-slot:label>Automatic padding</template>
</v-checkbox>
</v-col>
<v-col
v-if="processingSettings.inference_padding !== null"
cols="5"
class="d-flex justify-end"
>
<v-number-input
v-model.number="processingSettings.inference_padding"
:min="0"
:max="1024"
:step="1"
:precision="0"
density="compact"
variant="outlined"
control-variant="stacked"
hide-details
class="coverage-input"
></v-number-input>
</v-col>
</v-row>
<v-row v-if="processingSettings.inference_padding !== null">
<v-col>
<v-slider
v-model.number="processingSettings.inference_padding"
:min="0"
:max="1024"
:step="1"
color="teal"
track-color="grey-darken-2"
thumb-color="teal"
hide-details
/>
</v-col>
</v-row>
</template>
</v-expansion-panel-text>
</v-expansion-panel>
<!-- Polygonization -->
<v-expansion-panel
v-if="
settings.expertMode && currentMgrsTileId && !modelTitle?.includes('DelineateAnything')
"
value="polygonization"
>
<v-expansion-panel-title>
<span class="header-text">
<v-badge v-bind="getStatus(true)"></v-badge>
Polygonization Settings
</span>
</v-expansion-panel-title>
<v-expansion-panel-text>
<!-- close_interiors -->
<v-row>
<v-col>
<v-checkbox
v-model="processingSettings.polygons_close_interiors"
density="compact"
hide-details
>
<template v-slot:label>Remove interior holes in the polygons</template>
</v-checkbox>
</v-col>
</v-row>
<!-- min_size -->
<v-row>
<v-col cols="7">
<v-label>Min. field size in m²</v-label>
</v-col>
<v-col cols="5" class="d-flex justify-end">
<v-number-input
v-model.number="processingSettings.polygons_min_size"
:min="100"
:max="10000"
:step="10"
:precision="0"
density="compact"
variant="outlined"
control-variant="stacked"
hide-details
class="coverage-input"
></v-number-input>
</v-col>
</v-row>
<v-row>
<v-col>
<v-slider
v-model.number="processingSettings.polygons_min_size"
:min="100"
:max="10000"
:step="10"
color="teal"
track-color="grey-darken-2"
thumb-color="teal"
hide-details
/>
</v-col>
</v-row>
<!-- simplify -->
<v-row>
<v-col cols="7">
<v-label>Simplification factor in meters</v-label>
</v-col>
<v-col cols="5" class="d-flex justify-end">
<v-number-input
v-model.number="processingSettings.polygons_simplify"
:min="5"
:max="100"
:step="1"
:precision="0"
density="compact"
variant="outlined"
control-variant="stacked"
hide-details
class="coverage-input"
></v-number-input>
</v-col>
</v-row>
<v-row>
<v-col>
<v-slider
v-model.number="processingSettings.polygons_simplify"
:min="5"
:max="100"
:step="1"
color="teal"
track-color="grey-darken-2"
thumb-color="teal"
hide-details
/>
</v-col>
</v-row>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>

Expand Down
Loading