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
a97cd220
Commit
a97cd220
authored
Aug 17, 2018
by
vincent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qunatized tiny_yolov2_separable_conv_model
parent
3f4aa56d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
server.js
tools/quantize/server.js
+4
-2
quantizeModel.html
tools/quantize/views/quantizeModel.html
+6
-4
tiny_yolov2_separable_conv_model-shard1
weights/tiny_yolov2_separable_conv_model-shard1
+0
-0
tiny_yolov2_separable_conv_model-weights_manifest.json
...ts/tiny_yolov2_separable_conv_model-weights_manifest.json
+2
-0
No files found.
tools/quantize/server.js
View file @
a97cd220
...
...
@@ -9,9 +9,10 @@ app.use(express.static(path.join(__dirname, './public')))
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'./node_modules/file-saver'
)))
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'../../examples/public'
)))
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'../../weights'
)))
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'../../weights_uncompressed'
)))
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'../../dist'
)))
app
.
get
(
'/'
,
(
req
,
res
)
=>
res
.
redirect
(
'/quantize_
tiny_yolov2
'
))
app
.
get
(
'/quantize_
tiny_yolov2'
,
(
req
,
res
)
=>
res
.
sendFile
(
path
.
join
(
viewsDir
,
'quantizeTinyYolov2
.html'
)))
app
.
get
(
'/'
,
(
req
,
res
)
=>
res
.
redirect
(
'/quantize_
model
'
))
app
.
get
(
'/quantize_
model'
,
(
req
,
res
)
=>
res
.
sendFile
(
path
.
join
(
viewsDir
,
'quantizeModel
.html'
)))
app
.
listen
(
3000
,
()
=>
console
.
log
(
'Listening on port 3000!'
))
\ No newline at end of file
tools/quantize/views/quantize
TinyYolov2
.html
→
tools/quantize/views/quantize
Model
.html
View file @
a97cd220
...
...
@@ -10,6 +10,10 @@
<script>
tf
=
faceapi
.
tf
const
modelName
=
'tiny_yolov2_separable_conv'
const
uncompressedWeightsUri
=
`tiny_yolov2_separable_conv_model_v1.weights`
const
net
=
new
faceapi
.
TinyYolov2
(
true
)
async
function
loadNetWeights
(
uri
)
{
return
new
Float32Array
(
await
(
await
fetch
(
uri
)).
arrayBuffer
())
}
...
...
@@ -36,15 +40,13 @@
}
async
function
quantizeAndSave
()
{
const
modelName
=
'tiny_yolov2'
const
tinyYolov2
=
new
faceapi
.
TinyYolov2
()
await
tinyYolov2
.
load
(
await
loadNetWeights
(
`uncompressed/tiny_yolov2_model.weights`
))
await
net
.
load
(
await
loadNetWeights
(
uncompressedWeightsUri
))
const
quantizedTensorArrays
=
[]
const
weightEntries
=
[]
tinyYolov2
.
getParamList
().
forEach
(({
path
,
tensor
})
=>
{
net
.
getParamList
().
forEach
(({
path
,
tensor
})
=>
{
const
{
scale
,
min
,
qdata
}
=
quantizeWeights
(
tensor
)
const
weightEntry
=
{
...
...
weights/tiny_yolov2_separable_conv_model-shard1
0 → 100644
View file @
a97cd220
File added
weights/tiny_yolov2_separable_conv_model-weights_manifest.json
0 → 100644
View file @
a97cd220
[{
"weights"
:[{
"name"
:
"conv0/depthwise_filter"
,
"shape"
:[
3
,
3
,
3
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004699238725737029
,
"min"
:
-0.7471789573921876
}},{
"name"
:
"conv0/pointwise_filter"
,
"shape"
:[
1
,
1
,
3
,
16
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.008118405529097015
,
"min"
:
-1.071629529840806
}},{
"name"
:
"conv0/bias"
,
"shape"
:[
16
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0024678509609372006
,
"min"
:
-0.28873856242965246
}},{
"name"
:
"conv1/depthwise_filter"
,
"shape"
:[
3
,
3
,
16
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004553892331964829
,
"min"
:
-0.5737904338275684
}},{
"name"
:
"conv1/pointwise_filter"
,
"shape"
:[
1
,
1
,
16
,
32
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.00980057996862075
,
"min"
:
-1.3230782957638012
}},{
"name"
:
"conv1/bias"
,
"shape"
:[
32
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0011220066278588537
,
"min"
:
-0.20644921952602907
}},{
"name"
:
"conv2/depthwise_filter"
,
"shape"
:[
3
,
3
,
32
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0032098570290733787
,
"min"
:
-0.38839270051787883
}},{
"name"
:
"conv2/pointwise_filter"
,
"shape"
:[
1
,
1
,
32
,
64
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.008682825051101984
,
"min"
:
-1.154815731796564
}},{
"name"
:
"conv2/bias"
,
"shape"
:[
64
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0015120926440930834
,
"min"
:
-0.21471715546121783
}},{
"name"
:
"conv3/depthwise_filter"
,
"shape"
:[
3
,
3
,
64
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.003597520496331009
,
"min"
:
-0.4317024595597211
}},{
"name"
:
"conv3/pointwise_filter"
,
"shape"
:[
1
,
1
,
64
,
128
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.010341314240997913
,
"min"
:
-1.3650534798117246
}},{
"name"
:
"conv3/bias"
,
"shape"
:[
128
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.002109630785736383
,
"min"
:
-0.4113780032185947
}},{
"name"
:
"conv4/depthwise_filter"
,
"shape"
:[
3
,
3
,
128
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004783747476689955
,
"min"
:
-0.6171034244930043
}},{
"name"
:
"conv4/pointwise_filter"
,
"shape"
:[
1
,
1
,
128
,
256
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.009566552498761345
,
"min"
:
-1.2627849298364977
}},{
"name"
:
"conv4/bias"
,
"shape"
:[
256
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0020002245903015135
,
"min"
:
-0.3860433459281921
}},{
"name"
:
"conv5/depthwise_filter"
,
"shape"
:[
3
,
3
,
256
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004355777244941861
,
"min"
:
-0.4791354969436047
}},{
"name"
:
"conv5/pointwise_filter"
,
"shape"
:[
1
,
1
,
256
,
512
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.010036561068366555
,
"min"
:
-1.2545701335458193
}},{
"name"
:
"conv5/bias"
,
"shape"
:[
512
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0023248311935686597
,
"min"
:
-0.42776893961663337
}},{
"name"
:
"conv6/depthwise_filter"
,
"shape"
:[
3
,
3
,
512
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004659063442080629
,
"min"
:
-0.5963601205863205
}},{
"name"
:
"conv6/pointwise_filter"
,
"shape"
:[
1
,
1
,
512
,
1024
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.010061494509379069
,
"min"
:
-1.2576868136723836
}},{
"name"
:
"conv6/bias"
,
"shape"
:[
1024
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.0029680932269376867
,
"min"
:
-0.3947563991827123
}},{
"name"
:
"conv7/depthwise_filter"
,
"shape"
:[
3
,
3
,
1024
,
1
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.003887363508635876
,
"min"
:
-0.48980780208812036
}},{
"name"
:
"conv7/pointwise_filter"
,
"shape"
:[
1
,
1
,
1024
,
1024
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.009973861189449535
,
"min"
:
-1.2766542322495404
}},{
"name"
:
"conv7/bias"
,
"shape"
:[
1024
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.004667898486642276
,
"min"
:
-0.6955168745096991
}},{
"name"
:
"conv8/filters"
,
"shape"
:[
1
,
1
,
1024
,
25
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.01573958116419175
,
"min"
:
-2.5340725674348716
}},{
"name"
:
"conv8/bias"
,
"shape"
:[
25
],
"dtype"
:
"float32"
,
"quantization"
:{
"dtype"
:
"uint8"
,
"scale"
:
0.009396760662396749
,
"min"
:
-2.2552225589752197
}}],
"paths"
:[
"tiny_yolov2_separable_conv_model-shard1"
]}]
\ 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