Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
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
wenyuanbo
tic
Commits
5968eef2
Commit
5968eef2
authored
Jul 31, 2019
by
Balint Cristian
Committed by
Thierry Moreau
Jul 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add yolov3-tiny to the tutorial. (#3674)
parent
f0b4c46f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
2 deletions
+25
-2
tutorials/frontend/from_darknet.py
+25
-2
No files found.
tutorials/frontend/from_darknet.py
View file @
5968eef2
...
...
@@ -45,6 +45,11 @@ from tvm.relay.testing.darknet import __darknetffi__
import
tvm.relay.testing.yolo_detection
import
tvm.relay.testing.darknet
######################################################################
# Choose the model
# -----------------------
# Models are: 'yolov2', 'yolov3' or 'yolov3-tiny'
# Model name
MODEL_NAME
=
'yolov3'
...
...
@@ -124,6 +129,11 @@ m.set_input(**params)
# execute
print
(
"Running the test image..."
)
# detection
# thresholds
thresh
=
0.5
nms_thresh
=
0.45
m
.
run
()
# get outputs
tvm_out
=
[]
...
...
@@ -155,9 +165,22 @@ elif MODEL_NAME == 'yolov3':
layer_out
[
'classes'
]
=
layer_attr
[
4
]
tvm_out
.
append
(
layer_out
)
elif
MODEL_NAME
==
'yolov3-tiny'
:
for
i
in
range
(
2
):
layer_out
=
{}
layer_out
[
'type'
]
=
'Yolo'
# Get the yolo layer attributes (n, out_c, out_h, out_w, classes, total)
layer_attr
=
m
.
get_output
(
i
*
4
+
3
)
.
asnumpy
()
layer_out
[
'biases'
]
=
m
.
get_output
(
i
*
4
+
2
)
.
asnumpy
()
layer_out
[
'mask'
]
=
m
.
get_output
(
i
*
4
+
1
)
.
asnumpy
()
out_shape
=
(
layer_attr
[
0
],
layer_attr
[
1
]
//
layer_attr
[
0
],
layer_attr
[
2
],
layer_attr
[
3
])
layer_out
[
'output'
]
=
m
.
get_output
(
i
*
4
)
.
asnumpy
()
.
reshape
(
out_shape
)
layer_out
[
'classes'
]
=
layer_attr
[
4
]
tvm_out
.
append
(
layer_out
)
thresh
=
0.560
# do the detection and bring up the bounding boxes
thresh
=
0.5
nms_thresh
=
0.45
img
=
tvm
.
relay
.
testing
.
darknet
.
load_image_color
(
img_path
)
_
,
im_h
,
im_w
=
img
.
shape
dets
=
tvm
.
relay
.
testing
.
yolo_detection
.
fill_network_boxes
((
netw
,
neth
),
(
im_w
,
im_h
),
thresh
,
...
...
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