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
3f40b44f
Commit
3f40b44f
authored
Mar 27, 2019
by
vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor webgl precision fixes + dispose webgl backends in between test suites to…
minor webgl precision fixes + dispose webgl backends in between test suites to free up memory from cache
parent
b3011959
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
72 additions
and
36 deletions
+72
-36
extractFaceTensors.test.ts
test/tests/dom/extractFaceTensors.test.ts
+2
-1
faceExpressionNet.test.ts
test/tests/faceExpressionNet/faceExpressionNet.test.ts
+2
-2
faceLandmark68Net.test.ts
test/tests/faceLandmarkNet/faceLandmark68Net.test.ts
+9
-4
faceLandmark68Net.uncompressed.test.ts
...ts/faceLandmarkNet/faceLandmark68Net.uncompressed.test.ts
+2
-2
faceLandmark68TinyNet.test.ts
test/tests/faceLandmarkNet/faceLandmark68TinyNet.test.ts
+2
-2
faceLandmark68TinyNet.uncompressed.test.ts
...aceLandmarkNet/faceLandmark68TinyNet.uncompressed.test.ts
+2
-2
faceRecognitionNet.test.ts
test/tests/faceRecognitionNet/faceRecognitionNet.test.ts
+2
-2
faceRecognitionNet.uncompressed.test.ts
...aceRecognitionNet/faceRecognitionNet.uncompressed.test.ts
+2
-2
mtcnn.forward.test.ts
test/tests/mtcnn/mtcnn.forward.test.ts
+2
-2
mtcnn.forward.uncompressed.test.ts
test/tests/mtcnn/mtcnn.forward.uncompressed.test.ts
+2
-2
mtcnn.test.ts
test/tests/mtcnn/mtcnn.test.ts
+2
-1
ssdMobilenetv1.locateFaces.test.ts
test/tests/ssdMobilenetv1/ssdMobilenetv1.locateFaces.test.ts
+2
-2
ssdMobilenetv1.locateFaces.uncompressed.test.ts
...bilenetv1/ssdMobilenetv1.locateFaces.uncompressed.test.ts
+2
-2
ssdMobilenetv1.test.ts
test/tests/ssdMobilenetv1/ssdMobilenetv1.test.ts
+6
-6
tinyFaceDetector.locateFaces.test.ts
...sts/tinyFaceDetector/tinyFaceDetector.locateFaces.test.ts
+2
-2
tinyFaceDetector.test.ts
test/tests/tinyFaceDetector/tinyFaceDetector.test.ts
+2
-2
utils.ts
test/utils.ts
+29
-0
No files found.
test/tests/dom/extractFaceTensors.test.ts
View file @
3f40b44f
import
{
createCanvasFromMedia
,
extractFaceTensors
,
Rect
,
tf
}
from
'../../../src'
;
import
{
createCanvasFromMedia
,
extractFaceTensors
,
Rect
,
tf
}
from
'../../../src'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
import
{
describeWithBackend
}
from
'../../utils'
;
describe
(
'extractFaceTensors'
,
()
=>
{
describe
WithBackend
(
'extractFaceTensors'
,
()
=>
{
let
imgTensor
:
tf
.
Tensor3D
let
imgTensor
:
tf
.
Tensor3D
...
...
test/tests/faceExpressionNet/faceExpressionNet.test.ts
View file @
3f40b44f
...
@@ -3,9 +3,9 @@ import * as tf from '@tensorflow/tfjs-core';
...
@@ -3,9 +3,9 @@ import * as tf from '@tensorflow/tfjs-core';
import
{
createCanvasFromMedia
,
NetInput
,
toNetInput
}
from
'../../../src'
;
import
{
createCanvasFromMedia
,
NetInput
,
toNetInput
}
from
'../../../src'
;
import
{
FaceExpressionPrediction
}
from
'../../../src/faceExpressionNet/types'
;
import
{
FaceExpressionPrediction
}
from
'../../../src/faceExpressionNet/types'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
import
{
describeWithNets
,
expectAllTensorsReleased
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
,
expectAllTensorsReleased
}
from
'../../utils'
;
describe
(
'faceExpressionNet'
,
()
=>
{
describe
WithBackend
(
'faceExpressionNet'
,
()
=>
{
let
imgElAngry
:
HTMLImageElement
let
imgElAngry
:
HTMLImageElement
let
imgElSurprised
:
HTMLImageElement
let
imgElSurprised
:
HTMLImageElement
...
...
test/tests/faceLandmarkNet/faceLandmark68Net.test.ts
View file @
3f40b44f
...
@@ -2,9 +2,14 @@ import * as tf from '@tensorflow/tfjs-core';
...
@@ -2,9 +2,14 @@ import * as tf from '@tensorflow/tfjs-core';
import
{
createCanvasFromMedia
,
IDimensions
,
isTensor3D
,
NetInput
,
Point
,
TMediaElement
,
toNetInput
}
from
'../../../src'
;
import
{
createCanvasFromMedia
,
IDimensions
,
isTensor3D
,
NetInput
,
Point
,
TMediaElement
,
toNetInput
}
from
'../../../src'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
FaceLandmark68Net
}
from
'../../../src/faceLandmarkNet/FaceLandmark68Net'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
expectMaxDelta
,
expectPointClose
}
from
'../../utils'
;
import
{
describeWithBackend
,
describeWithNets
,
expectAllTensorsReleased
,
expectMaxDelta
,
expectPointClose
,
}
from
'../../utils'
;
function
getInputDims
(
input
:
tf
.
Tensor
|
TMediaElement
):
IDimensions
{
function
getInputDims
(
input
:
tf
.
Tensor
|
TMediaElement
):
IDimensions
{
if
(
input
instanceof
tf
.
Tensor
)
{
if
(
input
instanceof
tf
.
Tensor
)
{
...
@@ -14,7 +19,7 @@ function getInputDims (input: tf.Tensor | TMediaElement): IDimensions {
...
@@ -14,7 +19,7 @@ function getInputDims (input: tf.Tensor | TMediaElement): IDimensions {
return
input
return
input
}
}
describe
(
'faceLandmark68Net'
,
()
=>
{
describe
WithBackend
(
'faceLandmark68Net'
,
()
=>
{
let
imgEl1
:
HTMLImageElement
let
imgEl1
:
HTMLImageElement
let
imgEl2
:
HTMLImageElement
let
imgEl2
:
HTMLImageElement
...
@@ -44,7 +49,7 @@ describe('faceLandmark68Net', () => {
...
@@ -44,7 +49,7 @@ describe('faceLandmark68Net', () => {
expect
(
result
.
shift
.
y
).
toEqual
(
0
)
expect
(
result
.
shift
.
y
).
toEqual
(
0
)
result
.
positions
.
forEach
((
pt
,
i
)
=>
{
result
.
positions
.
forEach
((
pt
,
i
)
=>
{
const
{
x
,
y
}
=
faceLandmarkPositions1
[
i
]
const
{
x
,
y
}
=
faceLandmarkPositions1
[
i
]
expectPointClose
(
pt
,
{
x
,
y
},
2
)
expectPointClose
(
pt
,
{
x
,
y
},
3
)
})
})
})
})
...
...
test/tests/faceLandmarkNet/faceLandmark68Net.uncompressed.test.ts
View file @
3f40b44f
import
{
Point
}
from
'../../../src'
;
import
{
Point
}
from
'../../../src'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
,
expectPointClose
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
,
expectPointClose
}
from
'../../utils'
;
describe
(
'faceLandmark68Net, uncompressed'
,
()
=>
{
describe
WithBackend
(
'faceLandmark68Net, uncompressed'
,
()
=>
{
let
imgEl1
:
HTMLImageElement
let
imgEl1
:
HTMLImageElement
let
imgElRect
:
HTMLImageElement
let
imgElRect
:
HTMLImageElement
...
...
test/tests/faceLandmarkNet/faceLandmark68TinyNet.test.ts
View file @
3f40b44f
...
@@ -3,7 +3,7 @@ import * as tf from '@tensorflow/tfjs-core';
...
@@ -3,7 +3,7 @@ import * as tf from '@tensorflow/tfjs-core';
import
{
createCanvasFromMedia
,
IDimensions
,
isTensor3D
,
NetInput
,
Point
,
TMediaElement
,
toNetInput
}
from
'../../../src'
;
import
{
createCanvasFromMedia
,
IDimensions
,
isTensor3D
,
NetInput
,
Point
,
TMediaElement
,
toNetInput
}
from
'../../../src'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
expectPointClose
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
,
expectAllTensorsReleased
,
expectPointClose
}
from
'../../utils'
;
function
getInputDims
(
input
:
tf
.
Tensor
|
TMediaElement
):
IDimensions
{
function
getInputDims
(
input
:
tf
.
Tensor
|
TMediaElement
):
IDimensions
{
if
(
input
instanceof
tf
.
Tensor
)
{
if
(
input
instanceof
tf
.
Tensor
)
{
...
@@ -13,7 +13,7 @@ function getInputDims (input: tf.Tensor | TMediaElement): IDimensions {
...
@@ -13,7 +13,7 @@ function getInputDims (input: tf.Tensor | TMediaElement): IDimensions {
return
input
return
input
}
}
describe
(
'faceLandmark68TinyNet'
,
()
=>
{
describe
WithBackend
(
'faceLandmark68TinyNet'
,
()
=>
{
let
imgEl1
:
HTMLImageElement
let
imgEl1
:
HTMLImageElement
let
imgEl2
:
HTMLImageElement
let
imgEl2
:
HTMLImageElement
...
...
test/tests/faceLandmarkNet/faceLandmark68TinyNet.uncompressed.test.ts
View file @
3f40b44f
import
{
Point
}
from
'../../../src'
;
import
{
Point
}
from
'../../../src'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
FaceLandmarks68
}
from
'../../../src/classes/FaceLandmarks68'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
,
expectPointClose
}
from
'../../utils'
;
import
{
describeWithNets
,
expectPointClose
,
describeWithBackend
}
from
'../../utils'
;
describe
(
'faceLandmark68TinyNet, uncompressed'
,
()
=>
{
describe
WithBackend
(
'faceLandmark68TinyNet, uncompressed'
,
()
=>
{
let
imgEl1
:
HTMLImageElement
let
imgEl1
:
HTMLImageElement
let
imgElRect
:
HTMLImageElement
let
imgElRect
:
HTMLImageElement
...
...
test/tests/faceRecognitionNet/faceRecognitionNet.test.ts
View file @
3f40b44f
...
@@ -3,9 +3,9 @@ import * as tf from '@tensorflow/tfjs-core';
...
@@ -3,9 +3,9 @@ import * as tf from '@tensorflow/tfjs-core';
import
{
createCanvasFromMedia
,
NetInput
,
toNetInput
}
from
'../../../src'
;
import
{
createCanvasFromMedia
,
NetInput
,
toNetInput
}
from
'../../../src'
;
import
{
euclideanDistance
}
from
'../../../src/euclideanDistance'
;
import
{
euclideanDistance
}
from
'../../../src/euclideanDistance'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
,
expectAllTensorsReleased
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
,
expectAllTensorsReleased
}
from
'../../utils'
;
describe
(
'faceRecognitionNet'
,
()
=>
{
describe
WithBackend
(
'faceRecognitionNet'
,
()
=>
{
let
imgEl1
:
HTMLCanvasElement
let
imgEl1
:
HTMLCanvasElement
let
imgEl2
:
HTMLCanvasElement
let
imgEl2
:
HTMLCanvasElement
...
...
test/tests/faceRecognitionNet/faceRecognitionNet.uncompressed.test.ts
View file @
3f40b44f
import
{
createCanvasFromMedia
}
from
'../../../src'
;
import
{
createCanvasFromMedia
}
from
'../../../src'
;
import
{
euclideanDistance
}
from
'../../../src/euclideanDistance'
;
import
{
euclideanDistance
}
from
'../../../src/euclideanDistance'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
}
from
'../../utils'
;
describe
(
'faceRecognitionNet, uncompressed'
,
()
=>
{
describe
WithBackend
(
'faceRecognitionNet, uncompressed'
,
()
=>
{
let
imgEl1
:
HTMLCanvasElement
let
imgEl1
:
HTMLCanvasElement
let
imgElRect
:
HTMLCanvasElement
let
imgElRect
:
HTMLCanvasElement
...
...
test/tests/mtcnn/mtcnn.forward.test.ts
View file @
3f40b44f
import
{
IPoint
}
from
'../../../src'
;
import
{
IPoint
}
from
'../../../src'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
}
from
'../../utils'
;
import
{
expectMtcnnResults
}
from
'./expectMtcnnResults'
;
import
{
expectMtcnnResults
}
from
'./expectMtcnnResults'
;
describe
(
'mtcnn.forward'
,
()
=>
{
describe
WithBackend
(
'mtcnn.forward'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
let
expectedMtcnnLandmarks
:
IPoint
[][]
let
expectedMtcnnLandmarks
:
IPoint
[][]
...
...
test/tests/mtcnn/mtcnn.forward.uncompressed.test.ts
View file @
3f40b44f
import
{
IPoint
}
from
'../../../src'
;
import
{
IPoint
}
from
'../../../src'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
loadImage
,
loadJson
}
from
'../../env'
;
import
{
describeWithNets
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWith
Nets
}
from
'../../utils'
;
import
{
expectMtcnnResults
}
from
'./expectMtcnnResults'
;
import
{
expectMtcnnResults
}
from
'./expectMtcnnResults'
;
describe
(
'mtcnn.forward'
,
()
=>
{
describe
WithBackend
(
'mtcnn.forward'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
let
expectedMtcnnLandmarks
:
IPoint
[][]
let
expectedMtcnnLandmarks
:
IPoint
[][]
...
...
test/tests/mtcnn/mtcnn.test.ts
View file @
3f40b44f
...
@@ -6,13 +6,14 @@ import { expectFaceDetectionsWithLandmarks } from '../../expectFaceDetectionsWit
...
@@ -6,13 +6,14 @@ import { expectFaceDetectionsWithLandmarks } from '../../expectFaceDetectionsWit
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
import
{
import
{
assembleExpectedFullFaceDescriptions
,
assembleExpectedFullFaceDescriptions
,
describeWithBackend
,
describeWithNets
,
describeWithNets
,
expectAllTensorsReleased
,
expectAllTensorsReleased
,
ExpectedFullFaceDescription
,
ExpectedFullFaceDescription
,
}
from
'../../utils'
;
}
from
'../../utils'
;
import
{
expectedMtcnnBoxes
}
from
'./expectMtcnnResults'
;
import
{
expectedMtcnnBoxes
}
from
'./expectMtcnnResults'
;
describe
(
'mtcnn'
,
()
=>
{
describe
WithBackend
(
'mtcnn'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
...
...
test/tests/ssdMobilenetv1/ssdMobilenetv1.locateFaces.test.ts
View file @
3f40b44f
import
*
as
faceapi
from
'../../../src'
;
import
*
as
faceapi
from
'../../../src'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
describeWith
Nets
,
expectAllTensorsReleased
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWithNets
}
from
'../../utils'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
describe
(
'ssdMobilenetv1.locateFaces'
,
()
=>
{
describe
WithBackend
(
'ssdMobilenetv1.locateFaces'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
...
...
test/tests/ssdMobilenetv1/ssdMobilenetv1.locateFaces.uncompressed.test.ts
View file @
3f40b44f
import
*
as
faceapi
from
'../../../src'
;
import
*
as
faceapi
from
'../../../src'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
describeWith
Nets
,
expectAllTensorsReleased
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWithNets
}
from
'../../utils'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
describe
(
'ssdMobilenetv1.locateFaces, uncompressed'
,
()
=>
{
describe
WithBackend
(
'ssdMobilenetv1.locateFaces, uncompressed'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
...
...
test/tests/ssdMobilenetv1/ssdMobilenetv1.test.ts
View file @
3f40b44f
import
*
as
faceapi
from
'../../../src'
;
import
*
as
faceapi
from
'../../../src'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
assembleExpectedFullFaceDescriptions
,
ExpectedFullFaceDescription
}
from
'../../utils'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
assembleExpectedFullFaceDescriptions
,
ExpectedFullFaceDescription
,
describeWithBackend
}
from
'../../utils'
;
import
{
fetchImage
,
SsdMobilenetv1Options
}
from
'../../../src'
;
import
{
SsdMobilenetv1Options
}
from
'../../../src'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
import
{
expectFaceDetectionsWithLandmarks
}
from
'../../expectFaceDetectionsWithLandmarks'
;
import
{
expectFaceDetectionsWithLandmarks
}
from
'../../expectFaceDetectionsWithLandmarks'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
import
{
expectedSsdBoxes
}
from
'./expectedBoxes'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
describe
(
'ssdMobilenetv1'
,
()
=>
{
describe
WithBackend
(
'ssdMobilenetv1'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
...
@@ -45,7 +45,7 @@ describe('ssdMobilenetv1', () => {
...
@@ -45,7 +45,7 @@ describe('ssdMobilenetv1', () => {
const
deltas
=
{
const
deltas
=
{
maxScoreDelta
:
0.05
,
maxScoreDelta
:
0.05
,
maxBoxDelta
:
5
,
maxBoxDelta
:
5
,
maxLandmarksDelta
:
2
maxLandmarksDelta
:
3
}
}
expect
(
results
.
length
).
toEqual
(
6
)
expect
(
results
.
length
).
toEqual
(
6
)
expectFaceDetectionsWithLandmarks
(
results
,
expectedFullFaceDescriptions
,
expectedScores
,
deltas
)
expectFaceDetectionsWithLandmarks
(
results
,
expectedFullFaceDescriptions
,
expectedScores
,
deltas
)
...
@@ -64,7 +64,7 @@ describe('ssdMobilenetv1', () => {
...
@@ -64,7 +64,7 @@ describe('ssdMobilenetv1', () => {
const
deltas
=
{
const
deltas
=
{
maxScoreDelta
:
0.05
,
maxScoreDelta
:
0.05
,
maxBoxDelta
:
5
,
maxBoxDelta
:
5
,
maxLandmarksDelta
:
2
,
maxLandmarksDelta
:
3
,
maxDescriptorDelta
:
0.2
maxDescriptorDelta
:
0.2
}
}
expect
(
results
.
length
).
toEqual
(
6
)
expect
(
results
.
length
).
toEqual
(
6
)
...
@@ -84,7 +84,7 @@ describe('ssdMobilenetv1', () => {
...
@@ -84,7 +84,7 @@ describe('ssdMobilenetv1', () => {
const
deltas
=
{
const
deltas
=
{
maxScoreDelta
:
0.05
,
maxScoreDelta
:
0.05
,
maxBoxDelta
:
5
,
maxBoxDelta
:
5
,
maxLandmarksDelta
:
2
,
maxLandmarksDelta
:
3
,
maxDescriptorDelta
:
0.2
maxDescriptorDelta
:
0.2
}
}
...
...
test/tests/tinyFaceDetector/tinyFaceDetector.locateFaces.test.ts
View file @
3f40b44f
import
*
as
faceapi
from
'../../../src'
;
import
*
as
faceapi
from
'../../../src'
;
import
{
loadImage
}
from
'../../env'
;
import
{
loadImage
}
from
'../../env'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
describeWith
Nets
,
expectAllTensorsReleased
}
from
'../../utils'
;
import
{
describeWith
Backend
,
describeWithNets
}
from
'../../utils'
;
import
{
expectedTinyFaceDetectorBoxes
}
from
'./expectedBoxes'
;
import
{
expectedTinyFaceDetectorBoxes
}
from
'./expectedBoxes'
;
describe
(
'tinyFaceDetector.locateFaces'
,
()
=>
{
describe
WithBackend
(
'tinyFaceDetector.locateFaces'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
...
...
test/tests/tinyFaceDetector/tinyFaceDetector.test.ts
View file @
3f40b44f
import
*
as
faceapi
from
'../../../src'
;
import
*
as
faceapi
from
'../../../src'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
assembleExpectedFullFaceDescriptions
,
ExpectedFullFaceDescription
}
from
'../../utils'
;
import
{
describeWithNets
,
expectAllTensorsReleased
,
assembleExpectedFullFaceDescriptions
,
ExpectedFullFaceDescription
,
describeWithBackend
}
from
'../../utils'
;
import
{
TinyFaceDetectorOptions
}
from
'../../../src'
;
import
{
TinyFaceDetectorOptions
}
from
'../../../src'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFaceDetections
}
from
'../../expectFaceDetections'
;
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
import
{
expectFullFaceDescriptions
}
from
'../../expectFullFaceDescriptions'
;
...
@@ -24,7 +24,7 @@ function expectFaceExpressions(results: WithFaceExpressions<{}>[]) {
...
@@ -24,7 +24,7 @@ function expectFaceExpressions(results: WithFaceExpressions<{}>[]) {
})
})
}
}
describe
(
'tinyFaceDetector'
,
()
=>
{
describe
WithBackend
(
'tinyFaceDetector'
,
()
=>
{
let
imgEl
:
HTMLImageElement
let
imgEl
:
HTMLImageElement
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
let
expectedFullFaceDescriptions
:
ExpectedFullFaceDescription
[]
...
...
test/utils.ts
View file @
3f40b44f
...
@@ -132,6 +132,35 @@ export type DescribeWithNetsOptions = {
...
@@ -132,6 +132,35 @@ export type DescribeWithNetsOptions = {
withTinyYolov2
?:
WithTinyYolov2Options
withTinyYolov2
?:
WithTinyYolov2Options
}
}
const
gpgpu
=
tf
.
ENV
.
backend
[
'gpgpu'
]
export
function
describeWithBackend
(
description
:
string
,
specDefinitions
:
()
=>
void
)
{
if
(
!
(
gpgpu
instanceof
tf
.
webgl
.
GPGPUContext
))
{
describe
(
description
,
specDefinitions
)
return
}
const
defaultBackendName
=
tf
.
getBackend
()
const
newBackendName
=
'testBackend'
const
backend
=
new
tf
.
webgl
.
MathBackendWebGL
(
gpgpu
)
describe
(
description
,
()
=>
{
beforeAll
(()
=>
{
tf
.
ENV
.
registerBackend
(
newBackendName
,
()
=>
backend
)
tf
.
setBackend
(
newBackendName
)
})
afterAll
(()
=>
{
tf
.
setBackend
(
defaultBackendName
)
tf
.
ENV
.
removeBackend
(
newBackendName
)
backend
.
dispose
()
})
specDefinitions
()
})
}
export
function
describeWithNets
(
export
function
describeWithNets
(
description
:
string
,
description
:
string
,
options
:
DescribeWithNetsOptions
,
options
:
DescribeWithNetsOptions
,
...
...
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