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
49cf1e26
Commit
49cf1e26
authored
May 19, 2018
by
vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrap computeFaceDescriptors in tf.tidy
parent
e2158565
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
42 deletions
+49
-42
face-recognition.min.js
dist/face-recognition.min.js
+0
-0
index.js
dist/faceRecognitionNet/index.js
+23
-20
index.js.map
dist/faceRecognitionNet/index.js.map
+2
-2
index.ts
src/faceRecognitionNet/index.ts
+24
-20
No files found.
dist/face-recognition.min.js
View file @
49cf1e26
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/faceRecognitionNet/index.js
View file @
49cf1e26
...
@@ -6,26 +6,28 @@ import { residual, residualDown } from './residualLayer';
...
@@ -6,26 +6,28 @@ import { residual, residualDown } from './residualLayer';
export
function
faceRecognitionNet
(
weights
)
{
export
function
faceRecognitionNet
(
weights
)
{
var
params
=
extractParams
(
weights
);
var
params
=
extractParams
(
weights
);
return
function
(
input
)
{
return
function
(
input
)
{
var
x
=
tf
.
tensor4d
(
normalize
(
input
),
[
1
,
150
,
150
,
3
]);
return
tf
.
tidy
(
function
()
{
var
out
=
convDown
(
x
,
params
.
conv32_down
);
var
x
=
tf
.
tensor4d
(
normalize
(
input
),
[
1
,
150
,
150
,
3
]);
out
=
tf
.
maxPool
(
out
,
3
,
2
,
'valid'
);
var
out
=
convDown
(
x
,
params
.
conv32_down
);
out
=
residual
(
out
,
params
.
conv32_1
);
out
=
tf
.
maxPool
(
out
,
3
,
2
,
'valid'
);
out
=
residual
(
out
,
params
.
conv32_2
);
out
=
residual
(
out
,
params
.
conv32_1
);
out
=
residual
(
out
,
params
.
conv32_3
);
out
=
residual
(
out
,
params
.
conv32_2
);
out
=
residualDown
(
out
,
params
.
conv64_down
);
out
=
residual
(
out
,
params
.
conv32_3
);
out
=
residual
(
out
,
params
.
conv64_1
);
out
=
residualDown
(
out
,
params
.
conv64_down
);
out
=
residual
(
out
,
params
.
conv64_2
);
out
=
residual
(
out
,
params
.
conv64_1
);
out
=
residual
(
out
,
params
.
conv64_3
);
out
=
residual
(
out
,
params
.
conv64_2
);
out
=
residualDown
(
out
,
params
.
conv128_down
);
out
=
residual
(
out
,
params
.
conv64_3
);
out
=
residual
(
out
,
params
.
conv128_1
);
out
=
residualDown
(
out
,
params
.
conv128_down
);
out
=
residual
(
out
,
params
.
conv128_2
);
out
=
residual
(
out
,
params
.
conv128_1
);
out
=
residualDown
(
out
,
params
.
conv256_down
);
out
=
residual
(
out
,
params
.
conv128_2
);
out
=
residual
(
out
,
params
.
conv256_1
);
out
=
residualDown
(
out
,
params
.
conv256_down
);
out
=
residual
(
out
,
params
.
conv256_2
);
out
=
residual
(
out
,
params
.
conv256_1
);
out
=
residualDown
(
out
,
params
.
conv256_down_out
);
out
=
residual
(
out
,
params
.
conv256_2
);
var
globalAvg
=
out
.
mean
([
1
,
2
]);
out
=
residualDown
(
out
,
params
.
conv256_down_out
);
var
fullyConnected
=
tf
.
matMul
(
globalAvg
,
params
.
fc
);
var
globalAvg
=
out
.
mean
([
1
,
2
]);
return
Array
.
from
(
fullyConnected
.
dataSync
());
var
fullyConnected
=
tf
.
matMul
(
globalAvg
,
params
.
fc
);
return
Array
.
from
(
fullyConnected
.
dataSync
());
});
};
};
}
}
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
\ No newline at end of file
dist/faceRecognitionNet/index.js.map
View file @
49cf1e26
{"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YAC5C,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;YACrC,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;YACrC,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAA;YAEhD,IAAM,SAAS,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAgB,CAAA;YACjD,IAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;YAEtD,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC"}
\ No newline at end of file
\ No newline at end of file
src/faceRecognitionNet/index.ts
View file @
49cf1e26
...
@@ -10,32 +10,35 @@ export function faceRecognitionNet(weights: Float32Array) {
...
@@ -10,32 +10,35 @@ export function faceRecognitionNet(weights: Float32Array) {
return
function
(
input
:
number
[])
{
return
function
(
input
:
number
[])
{
const
x
=
tf
.
tensor4d
(
normalize
(
input
),
[
1
,
150
,
150
,
3
])
return
tf
.
tidy
(()
=>
{
let
out
=
convDown
(
x
,
params
.
conv32_down
)
const
x
=
tf
.
tensor4d
(
normalize
(
input
),
[
1
,
150
,
150
,
3
])
out
=
tf
.
maxPool
(
out
,
3
,
2
,
'valid'
)
out
=
residual
(
out
,
params
.
conv32_1
)
let
out
=
convDown
(
x
,
params
.
conv32_down
)
out
=
residual
(
out
,
params
.
conv32_2
)
out
=
tf
.
maxPool
(
out
,
3
,
2
,
'valid'
)
out
=
residual
(
out
,
params
.
conv32_3
)
out
=
residualDown
(
out
,
params
.
conv64_down
)
out
=
residual
(
out
,
params
.
conv32_1
)
out
=
residual
(
out
,
params
.
conv64_1
)
out
=
residual
(
out
,
params
.
conv32_2
)
out
=
residual
(
out
,
params
.
conv64_2
)
out
=
residual
(
out
,
params
.
conv32_3
)
out
=
residual
(
out
,
params
.
conv64_3
)
out
=
residualDown
(
out
,
params
.
conv128_down
)
out
=
residualDown
(
out
,
params
.
conv64_down
)
out
=
residual
(
out
,
params
.
conv128_1
)
out
=
residual
(
out
,
params
.
conv64_1
)
out
=
residual
(
out
,
params
.
conv128_2
)
out
=
residual
(
out
,
params
.
conv64_2
)
out
=
residual
(
out
,
params
.
conv64_3
)
out
=
residualDown
(
out
,
params
.
conv256_down
)
out
=
residualDown
(
out
,
params
.
conv128_down
)
out
=
residual
(
out
,
params
.
conv256_1
)
out
=
residual
(
out
,
params
.
conv128_1
)
out
=
residual
(
out
,
params
.
conv256_2
)
out
=
residual
(
out
,
params
.
conv128_2
)
out
=
residualDown
(
out
,
params
.
conv256_down_out
)
const
globalAvg
=
out
.
mean
([
1
,
2
])
as
tf
.
Tensor2D
out
=
residualDown
(
out
,
params
.
conv256_down
)
const
fullyConnected
=
tf
.
matMul
(
globalAvg
,
params
.
fc
)
out
=
residual
(
out
,
params
.
conv256_1
)
out
=
residual
(
out
,
params
.
conv256_2
)
out
=
residualDown
(
out
,
params
.
conv256_down_out
)
return
Array
.
from
(
fullyConnected
.
dataSync
())
const
globalAvg
=
out
.
mean
([
1
,
2
])
as
tf
.
Tensor2D
const
fullyConnected
=
tf
.
matMul
(
globalAvg
,
params
.
fc
)
return
Array
.
from
(
fullyConnected
.
dataSync
())
})
}
}
}
}
\ No newline at end of file
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