Fix empty detection bug (#135)

Closes: #134

Fixes regression in post-processing from #129.

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>

Reviewed-on: #135
This commit is contained in:
2024-03-11 09:47:26 -07:00
parent 2cb128fd51
commit a665fb591d

View File

@@ -43,6 +43,8 @@ export default {
rawBoxes.push(boxCalc)
rawScores.push(getScores)
}
if (rawBoxes.length > 0) {
const tBoxes = tf.tensor2d(rawBoxes)
let tScores = null
let structureScores = null
@@ -62,6 +64,8 @@ export default {
}
}
tf.dispose(tBoxes)
tf.dispose(tScores)
const valid_detections_data = classes_data.length
var output = {
detections: []
@@ -77,14 +81,12 @@ export default {
"confidence": scores_data[i] * 100
})
}
}
tf.dispose(res)
tf.dispose(tBoxes)
tf.dispose(tScores)
tf.dispose(input)
console.timeEnd('post-process')
return output
return output || { detections: [] }
},
getRemoteLabels() {
var self = this