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
407314ae
Commit
407314ae
authored
Jun 17, 2018
by
vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some typos
parent
0657ac2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
README.md
README.md
+5
-5
No files found.
README.md
View file @
407314ae
...
@@ -179,7 +179,7 @@ Or simply obtain the tensor (tensor has to be disposed manually):
...
@@ -179,7 +179,7 @@ Or simply obtain the tensor (tensor has to be disposed manually):
const
t
=
recognitionNet
.
forward
(
'myImg'
)
const
t
=
recognitionNet
.
forward
(
'myImg'
)
```
```
Compute the Face Descriptors for Detected Faces
Compute the Face Descriptors for Detected Faces
:
```
javascript
```
javascript
const
detections
=
await
detectionNet
.
locateFaces
(
input
)
const
detections
=
await
detectionNet
.
locateFaces
(
input
)
...
@@ -217,14 +217,14 @@ Draw the detected face landmarks to a canvas:
...
@@ -217,14 +217,14 @@ Draw the detected face landmarks to a canvas:
```
javascript
```
javascript
// adjust the landmark positions in case your displayed image has a different size then the original
// adjust the landmark positions in case your displayed image has a different size then the original
const
landmarksForSize
=
landmarks
.
forSize
(
myImg
.
width
,
myImg
.
height
)
)
const
landmarksForSize
=
landmarks
.
forSize
(
myImg
.
width
,
myImg
.
height
)
const
canvas
=
document
.
getElementById
(
'overlay'
)
const
canvas
=
document
.
getElementById
(
'overlay'
)
canvas
.
width
=
myImg
.
width
canvas
.
width
=
myImg
.
width
canvas
.
height
=
myImg
.
height
canvas
.
height
=
myImg
.
height
faceapi
.
drawLandmarks
(
canvas
,
landmarksForSize
,
{
drawLines
:
true
})
faceapi
.
drawLandmarks
(
canvas
,
landmarksForSize
,
{
drawLines
:
true
})
```
```
Retrieve the face landmark positions
Retrieve the face landmark positions
:
```
javascript
```
javascript
const
landmarkPositions
=
landmarks
.
getPositions
()
const
landmarkPositions
=
landmarks
.
getPositions
()
...
@@ -239,14 +239,14 @@ const leftEyeBbrow = landmarks.getLeftEyeBrow()
...
@@ -239,14 +239,14 @@ const leftEyeBbrow = landmarks.getLeftEyeBrow()
const
rightEyeBrow
=
landmarks
.
getRightEyeBrow
()
const
rightEyeBrow
=
landmarks
.
getRightEyeBrow
()
```
```
Compute the Face Landmarks for Detected Faces
Compute the Face Landmarks for Detected Faces
:
```
javascript
```
javascript
const
detections
=
await
detectionNet
.
locateFaces
(
input
)
const
detections
=
await
detectionNet
.
locateFaces
(
input
)
// get the face tensors from the image (have to be disposed manually)
// get the face tensors from the image (have to be disposed manually)
const
faceTensors
=
await
faceapi
.
extractFaceTensors
(
input
,
detections
)
const
faceTensors
=
await
faceapi
.
extractFaceTensors
(
input
,
detections
)
const
landmarksByFace
=
await
Promise
.
all
(
faceTensors
.
map
(
t
=>
landmarks
Net
.
detectLandmarks
(
t
)))
const
landmarksByFace
=
await
Promise
.
all
(
faceTensors
.
map
(
t
=>
faceLandmark
Net
.
detectLandmarks
(
t
)))
// free memory for face image tensors after we computed their descriptors
// free memory for face image tensors after we computed their descriptors
faceTensors
.
forEach
(
t
=>
t
.
dispose
())
faceTensors
.
forEach
(
t
=>
t
.
dispose
())
...
...
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