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
4968e0fc
Commit
4968e0fc
authored
Mar 14, 2019
by
Javier Ledo Vázquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change more arraySync
parent
7fbc49c1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
SsdMobilenetv1.ts
src/ssdMobilenetv1/SsdMobilenetv1.ts
+5
-4
nonMaxSuppression.ts
src/ssdMobilenetv1/nonMaxSuppression.ts
+9
-8
No files found.
src/ssdMobilenetv1/SsdMobilenetv1.ts
View file @
4968e0fc
...
...
@@ -85,15 +85,16 @@ export class SsdMobilenetv1 extends NeuralNetwork<NetParams> {
const
padX
=
inputSize
/
reshapedDims
.
width
const
padY
=
inputSize
/
reshapedDims
.
height
const
boxesData
=
boxes
.
arraySync
()
const
results
=
indices
.
map
(
idx
=>
{
const
[
top
,
bottom
]
=
[
Math
.
max
(
0
,
boxes
.
arraySync
()
[
idx
][
0
]),
Math
.
min
(
1.0
,
boxes
.
arraySync
()
[
idx
][
2
])
Math
.
max
(
0
,
boxes
Data
[
idx
][
0
]),
Math
.
min
(
1.0
,
boxes
Data
[
idx
][
2
])
].
map
(
val
=>
val
*
padY
)
const
[
left
,
right
]
=
[
Math
.
max
(
0
,
boxes
.
arraySync
()
[
idx
][
1
]),
Math
.
min
(
1.0
,
boxes
.
arraySync
()
[
idx
][
3
])
Math
.
max
(
0
,
boxes
Data
[
idx
][
1
]),
Math
.
min
(
1.0
,
boxes
Data
[
idx
][
3
])
].
map
(
val
=>
val
*
padX
)
return
new
FaceDetection
(
scoresData
[
idx
],
...
...
src/ssdMobilenetv1/nonMaxSuppression.ts
View file @
4968e0fc
...
...
@@ -49,14 +49,15 @@ export function nonMaxSuppression(
}
function
IOU
(
boxes
:
tf
.
Tensor2D
,
i
:
number
,
j
:
number
)
{
const
yminI
=
Math
.
min
(
boxes
.
arraySync
()[
i
][
0
],
boxes
.
arraySync
()[
i
][
2
])
const
xminI
=
Math
.
min
(
boxes
.
arraySync
()[
i
][
1
],
boxes
.
arraySync
()[
i
][
3
])
const
ymaxI
=
Math
.
max
(
boxes
.
arraySync
()[
i
][
0
],
boxes
.
arraySync
()[
i
][
2
])
const
xmaxI
=
Math
.
max
(
boxes
.
arraySync
()[
i
][
1
],
boxes
.
arraySync
()[
i
][
3
])
const
yminJ
=
Math
.
min
(
boxes
.
arraySync
()[
j
][
0
],
boxes
.
arraySync
()[
j
][
2
])
const
xminJ
=
Math
.
min
(
boxes
.
arraySync
()[
j
][
1
],
boxes
.
arraySync
()[
j
][
3
])
const
ymaxJ
=
Math
.
max
(
boxes
.
arraySync
()[
j
][
0
],
boxes
.
arraySync
()[
j
][
2
])
const
xmaxJ
=
Math
.
max
(
boxes
.
arraySync
()[
j
][
1
],
boxes
.
arraySync
()[
j
][
3
])
const
boxesData
=
boxes
.
arraySync
()
const
yminI
=
Math
.
min
(
boxesData
[
i
][
0
],
boxesData
[
i
][
2
])
const
xminI
=
Math
.
min
(
boxesData
[
i
][
1
],
boxesData
[
i
][
3
])
const
ymaxI
=
Math
.
max
(
boxesData
[
i
][
0
],
boxesData
[
i
][
2
])
const
xmaxI
=
Math
.
max
(
boxesData
[
i
][
1
],
boxesData
[
i
][
3
])
const
yminJ
=
Math
.
min
(
boxesData
[
j
][
0
],
boxesData
[
j
][
2
])
const
xminJ
=
Math
.
min
(
boxesData
[
j
][
1
],
boxesData
[
j
][
3
])
const
ymaxJ
=
Math
.
max
(
boxesData
[
j
][
0
],
boxesData
[
j
][
2
])
const
xmaxJ
=
Math
.
max
(
boxesData
[
j
][
1
],
boxesData
[
j
][
3
])
const
areaI
=
(
ymaxI
-
yminI
)
*
(
xmaxI
-
xminI
)
const
areaJ
=
(
ymaxJ
-
yminJ
)
*
(
xmaxJ
-
xminJ
)
if
(
areaI
<=
0
||
areaJ
<=
0
)
{
...
...
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