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
bc6014d5
Unverified
Commit
bc6014d5
authored
Jun 27, 2018
by
justadudewhohacks
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #24 from justadudewhohacks/#21
wait for model being loaded before processing video frames
parents
c9a1e5f7
6e39666b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
faceDetectionVideo.html
examples/views/faceDetectionVideo.html
+5
-2
No files found.
examples/views/faceDetectionVideo.html
View file @
bc6014d5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<div
class=
"indeterminate"
></div>
<div
class=
"indeterminate"
></div>
</div>
</div>
<div
style=
"position: relative"
class=
"margin"
>
<div
style=
"position: relative"
class=
"margin"
>
<video
src=
"media/bbt.mp4"
onplay=
"onPlay(this)"
autoplay
muted
></video>
<video
src=
"media/bbt.mp4"
onplay=
"onPlay(this)"
id=
"inputVideo"
autoplay
muted
></video>
<canvas
id=
"overlay"
/>
<canvas
id=
"overlay"
/>
</div>
</div>
<div
class=
"row side-by-side"
>
<div
class=
"row side-by-side"
>
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
<script>
<script>
let
minConfidence
=
0.7
let
minConfidence
=
0.7
let
modelLoaded
=
false
let
result
let
result
function
onIncreaseThreshold
()
{
function
onIncreaseThreshold
()
{
...
@@ -68,7 +69,7 @@
...
@@ -68,7 +69,7 @@
}
}
async
function
onPlay
(
videoEl
)
{
async
function
onPlay
(
videoEl
)
{
if
(
videoEl
.
paused
||
videoEl
.
ended
)
if
(
videoEl
.
paused
||
videoEl
.
ended
||
!
modelLoaded
)
return
false
return
false
const
input
=
await
faceapi
.
toNetInput
(
videoEl
)
const
input
=
await
faceapi
.
toNetInput
(
videoEl
)
...
@@ -87,6 +88,8 @@
...
@@ -87,6 +88,8 @@
async
function
run
()
{
async
function
run
()
{
await
faceapi
.
loadFaceDetectionModel
(
'/'
)
await
faceapi
.
loadFaceDetectionModel
(
'/'
)
modelLoaded
=
true
onPlay
(
$
(
'#inputVideo'
).
get
(
0
))
$
(
'#loader'
).
hide
()
$
(
'#loader'
).
hide
()
}
}
...
...
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