diff --git a/src/pages/detect.vue b/src/pages/detect.vue index e8fc2c9..db2ceaa 100644 --- a/src/pages/detect.vue +++ b/src/pages/detect.vue @@ -14,7 +14,16 @@
- +
@@ -99,6 +108,10 @@ align-self: stretch; } + .chip-media { + background-color: var(--chip-media-background) !important; + } + .chip-results { display: flex; flex-wrap: wrap; @@ -271,13 +284,24 @@ computed: { debugDisplay () { return this.debugText.join('
') + }, + showResults () { + var filteredResults = this.resultData.detections + var allSelect = this.detectorLabels.every( s => { return s.detect } ) + var selectedLabels = this.detectorLabels + .filter( l => { return l.detect }) + .map( l => { return l.name }) + filteredResults.forEach( (d, i) => { + filteredResults[i].resultIndex = i + filteredResults[i].aboveThreshold = d.confidence >= this.detectorLevel + filteredResults[i].isSearched = allSelect || selectedLabels.includes(d.label) + }) + return filteredResults } }, methods: { - chipColor (confVal) { - if (confVal >= 90) return 'green' - if (confVal >= 70) return 'lime' - return 'yellow' + chipGradient (confVal) { + return `--chip-media-background: hsl(${confVal / 100 * 120}deg 100% 50%)` }, setData () { var self = this @@ -298,6 +322,7 @@ self.resultData = JSON.parse(xhr.response) } + /* var detectStructures = {} if (this.detectorLabels.every( s => { return s.detect } )) { detectStructures['*'] = this.detectorLevel @@ -311,6 +336,14 @@ "detect": detectStructures, "data": this.reader.result.split(',')[1] } + */ + var doodsData = { + "detector_name": this.detectorName, + "detect": { + "*": 1 + }, + "data": this.reader.result.split(',')[1] + } xhr.send(JSON.stringify(doodsData)) } else { @@ -329,14 +362,14 @@ var loadResult = this.$refs.image_chooser.click() }, selectChip ( iChip ) { - var imgWidth - var imgHeight - if (this.selectedChip == iChip) { this.resetView() return } + var imgWidth + var imgHeight + this.selectedChip = iChip const box = this.$refs.structure_box const img = this.$refs.image_src