Commit 0b4470af by vincent

faceapi.round -> faceapi.utils.round

parent 5df8e27a
......@@ -26,13 +26,13 @@ function getFaceDetectorOptions() {
}
function onIncreaseMinConfidence() {
minConfidence = Math.min(faceapi.round(minConfidence + 0.1), 1.0)
minConfidence = Math.min(faceapi.utils.round(minConfidence + 0.1), 1.0)
$('#minConfidence').val(minConfidence)
updateResults()
}
function onDecreaseMinConfidence() {
minConfidence = Math.max(faceapi.round(minConfidence - 0.1), 0.1)
minConfidence = Math.max(faceapi.utils.round(minConfidence - 0.1), 0.1)
$('#minConfidence').val(minConfidence)
updateResults()
}
......@@ -51,24 +51,24 @@ function changeInputSize(size) {
}
function onIncreaseScoreThreshold() {
scoreThreshold = Math.min(faceapi.round(scoreThreshold + 0.1), 1.0)
scoreThreshold = Math.min(faceapi.utils.round(scoreThreshold + 0.1), 1.0)
$('#scoreThreshold').val(scoreThreshold)
updateResults()
}
function onDecreaseScoreThreshold() {
scoreThreshold = Math.max(faceapi.round(scoreThreshold - 0.1), 0.1)
scoreThreshold = Math.max(faceapi.utils.round(scoreThreshold - 0.1), 0.1)
$('#scoreThreshold').val(scoreThreshold)
updateResults()
}
function onIncreaseMinFaceSize() {
minFaceSize = Math.min(faceapi.round(minFaceSize + 20), 300)
minFaceSize = Math.min(faceapi.utils.round(minFaceSize + 20), 300)
$('#minFaceSize').val(minFaceSize)
}
function onDecreaseMinFaceSize() {
minFaceSize = Math.max(faceapi.round(minFaceSize - 20), 50)
minFaceSize = Math.max(faceapi.utils.round(minFaceSize - 20), 50)
$('#minFaceSize').val(minFaceSize)
}
......
......@@ -161,8 +161,8 @@
const { age, gender, genderProbability } = result
new faceapi.draw.DrawTextField(
[
`${faceapi.round(age, 0)} years`,
`${gender} (${faceapi.round(genderProbability)})`
`${faceapi.utils.round(age, 0)} years`,
`${gender} (${faceapi.utils.round(genderProbability)})`
],
result.detection.box.bottomLeft
).draw(canvas)
......
......@@ -96,7 +96,7 @@
function displayTimeStats(timeInMs) {
$('#time').val(`${timeInMs} ms`)
$('#fps').val(`${faceapi.round(1000 / timeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / timeInMs)}`)
}
function displayImage(src) {
......
......@@ -39,7 +39,7 @@
let descriptors = { desc1: null, desc2: null }
function updateResult() {
const distance = faceapi.round(
const distance = faceapi.utils.round(
faceapi.euclideanDistance(descriptors.desc1, descriptors.desc2)
)
let text = distance
......
......@@ -156,7 +156,7 @@
forwardTimes = [timeInMs].concat(forwardTimes).slice(0, 30)
const avgTimeInMs = forwardTimes.reduce((total, t) => total + t) / forwardTimes.length
$('#time').val(`${Math.round(avgTimeInMs)} ms`)
$('#fps').val(`${faceapi.round(1000 / avgTimeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / avgTimeInMs)}`)
}
async function onPlay(videoEl) {
......
......@@ -152,7 +152,7 @@
forwardTimes = [timeInMs].concat(forwardTimes).slice(0, 30)
const avgTimeInMs = forwardTimes.reduce((total, t) => total + t) / forwardTimes.length
$('#time').val(`${Math.round(avgTimeInMs)} ms`)
$('#fps').val(`${faceapi.round(1000 / avgTimeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / avgTimeInMs)}`)
}
function interpolateAgePredictions(age) {
......@@ -192,8 +192,8 @@
const interpolatedAge = interpolateAgePredictions(age)
new faceapi.draw.DrawTextField(
[
`${faceapi.round(interpolatedAge, 0)} years`,
`${gender} (${faceapi.round(genderProbability)})`
`${faceapi.utils.round(interpolatedAge, 0)} years`,
`${gender} (${faceapi.utils.round(genderProbability)})`
],
result.detection.box.bottomLeft
).draw(canvas)
......
......@@ -139,7 +139,7 @@
forwardTimes = [timeInMs].concat(forwardTimes).slice(0, 30)
const avgTimeInMs = forwardTimes.reduce((total, t) => total + t) / forwardTimes.length
$('#time').val(`${Math.round(avgTimeInMs)} ms`)
$('#fps').val(`${faceapi.round(1000 / avgTimeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / avgTimeInMs)}`)
}
async function onPlay() {
......
......@@ -151,7 +151,7 @@
forwardTimes = [timeInMs].concat(forwardTimes).slice(0, 30)
const avgTimeInMs = forwardTimes.reduce((total, t) => total + t) / forwardTimes.length
$('#time').val(`${Math.round(avgTimeInMs)} ms`)
$('#fps').val(`${faceapi.round(1000 / avgTimeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / avgTimeInMs)}`)
}
async function onPlay() {
......
......@@ -151,7 +151,7 @@
forwardTimes = [timeInMs].concat(forwardTimes).slice(0, 30)
const avgTimeInMs = forwardTimes.reduce((total, t) => total + t) / forwardTimes.length
$('#time').val(`${Math.round(avgTimeInMs)} ms`)
$('#fps').val(`${faceapi.round(1000 / avgTimeInMs)}`)
$('#fps').val(`${faceapi.utils.round(1000 / avgTimeInMs)}`)
}
async function onPlay() {
......
......@@ -19,8 +19,8 @@ async function run() {
const { age, gender, genderProbability } = result
new faceapi.draw.DrawTextField(
[
`${faceapi.round(age, 0)} years`,
`${gender} (${faceapi.round(genderProbability)})`
`${faceapi.utils.round(age, 0)} years`,
`${gender} (${faceapi.utils.round(genderProbability)})`
],
result.detection.box.bottomLeft
).draw(out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment