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