Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
face
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Кубота
face
Commits
0a469331
Commit
0a469331
authored
Aug 17, 2018
by
vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the improved fps meter in all examples
parent
84909181
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
18 deletions
+30
-18
faceDetectionVideo.html
examples/views/faceDetectionVideo.html
+10
-6
tinyYolov2FaceDetectionVideo.html
examples/views/tinyYolov2FaceDetectionVideo.html
+10
-6
tinyYolov2FaceDetectionWebcam.html
examples/views/tinyYolov2FaceDetectionWebcam.html
+10
-6
No files found.
examples/views/faceDetectionVideo.html
View file @
0a469331
...
...
@@ -53,6 +53,15 @@
let
modelLoaded
=
false
let
result
let
forwardTimes
=
[]
function
updateTimeStats
(
timeInMs
)
{
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
)}
`
)
}
function
onIncreaseThreshold
()
{
minConfidence
=
Math
.
min
(
faceapi
.
round
(
minConfidence
+
0.1
),
1.0
)
$
(
'#minConfidence'
).
val
(
minConfidence
)
...
...
@@ -63,11 +72,6 @@
$
(
'#minConfidence'
).
val
(
minConfidence
)
}
function
displayTimeStats
(
timeInMs
)
{
$
(
'#time'
).
val
(
`
${
timeInMs
}
ms`
)
$
(
'#fps'
).
val
(
`
${
faceapi
.
round
(
1000
/
timeInMs
)}
`
)
}
async
function
onPlay
(
videoEl
)
{
if
(
videoEl
.
paused
||
videoEl
.
ended
||
!
modelLoaded
)
return
false
...
...
@@ -79,7 +83,7 @@
const
ts
=
Date
.
now
()
result
=
await
faceapi
.
locateFaces
(
videoEl
,
minConfidence
)
display
TimeStats
(
Date
.
now
()
-
ts
)
update
TimeStats
(
Date
.
now
()
-
ts
)
faceapi
.
drawDetection
(
'overlay'
,
result
.
map
(
det
=>
det
.
forSize
(
width
,
height
)))
setTimeout
(()
=>
onPlay
(
videoEl
))
...
...
examples/views/tinyYolov2FaceDetectionVideo.html
View file @
0a469331
...
...
@@ -63,6 +63,15 @@
let
sizeType
=
'md'
let
modelLoaded
=
false
let
forwardTimes
=
[]
function
updateTimeStats
(
timeInMs
)
{
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
)}
`
)
}
function
onIncreaseThreshold
()
{
scoreThreshold
=
Math
.
min
(
faceapi
.
round
(
scoreThreshold
+
0.1
),
1.0
)
$
(
'#scoreThreshold'
).
val
(
scoreThreshold
)
...
...
@@ -78,11 +87,6 @@
$
(
'#sizeType'
).
val
(
sizeType
)
}
function
displayTimeStats
(
timeInMs
)
{
$
(
'#time'
).
val
(
`
${
timeInMs
}
ms`
)
$
(
'#fps'
).
val
(
`
${
faceapi
.
round
(
1000
/
timeInMs
)}
`
)
}
async
function
onPlay
(
videoEl
)
{
if
(
videoEl
.
paused
||
videoEl
.
ended
||
!
modelLoaded
)
return
false
...
...
@@ -99,7 +103,7 @@
const
ts
=
Date
.
now
()
result
=
await
faceapi
.
tinyYolov2
(
videoEl
,
forwardParams
)
display
TimeStats
(
Date
.
now
()
-
ts
)
update
TimeStats
(
Date
.
now
()
-
ts
)
faceapi
.
drawDetection
(
'overlay'
,
result
.
map
(
det
=>
det
.
forSize
(
width
,
height
)))
setTimeout
(()
=>
onPlay
(
videoEl
))
...
...
examples/views/tinyYolov2FaceDetectionWebcam.html
View file @
0a469331
...
...
@@ -64,6 +64,15 @@
let
sizeType
=
'160'
let
modelLoaded
=
false
let
forwardTimes
=
[]
function
updateTimeStats
(
timeInMs
)
{
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
)}
`
)
}
function
onIncreaseThreshold
()
{
scoreThreshold
=
Math
.
min
(
faceapi
.
round
(
scoreThreshold
+
0.1
),
1.0
)
$
(
'#scoreThreshold'
).
val
(
scoreThreshold
)
...
...
@@ -79,11 +88,6 @@
$
(
'#sizeType'
).
val
(
sizeType
)
}
function
displayTimeStats
(
timeInMs
)
{
$
(
'#time'
).
val
(
`
${
timeInMs
}
ms`
)
$
(
'#fps'
).
val
(
`
${
faceapi
.
round
(
1000
/
timeInMs
)}
`
)
}
async
function
onPlay
(
videoEl
)
{
if
(
videoEl
.
paused
||
videoEl
.
ended
||
!
modelLoaded
)
return
false
...
...
@@ -100,7 +104,7 @@
const
ts
=
Date
.
now
()
result
=
await
faceapi
.
tinyYolov2
(
videoEl
,
forwardParams
)
display
TimeStats
(
Date
.
now
()
-
ts
)
update
TimeStats
(
Date
.
now
()
-
ts
)
faceapi
.
drawDetection
(
'overlay'
,
result
.
map
(
det
=>
det
.
forSize
(
width
,
height
)))
setTimeout
(()
=>
onPlay
(
videoEl
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment