Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELAY]Frontend darknet #2773

Merged
merged 4 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion nnvm/python/nnvm/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
from . import inception_v3
from . import dcgan
from . import dqn
from . import yolo_detection
from . import check_computation
4 changes: 2 additions & 2 deletions nnvm/tests/python/frontend/darknet/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from tvm.contrib.download import download_testdata
download_testdata.__test__ = False
from nnvm import frontend
from nnvm.testing.darknet import LAYERTYPE
from nnvm.testing.darknet import __darknetffi__
from tvm.relay.testing.darknet import LAYERTYPE
from tvm.relay.testing.darknet import __darknetffi__
import nnvm.compiler

DARKNET_LIB = 'libdarknet2.0.so'
Expand Down
16 changes: 8 additions & 8 deletions nnvm/tutorials/from_darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@

import nnvm
import nnvm.frontend.darknet
import nnvm.testing.yolo_detection
import nnvm.testing.darknet
import tvm.relay.testing.yolo_detection
import tvm.relay.testing.darknet
import matplotlib.pyplot as plt
import numpy as np
import tvm
import sys

from ctypes import *
from tvm.contrib.download import download_testdata
from nnvm.testing.darknet import __darknetffi__
from tvm.relay.testing.darknet import __darknetffi__

# Model name
MODEL_NAME = 'yolov3'
Expand Down Expand Up @@ -104,7 +104,7 @@
test_image + '?raw=true'
img_path = download_testdata(img_url, test_image, "data")

data = nnvm.testing.darknet.load_image(img_path, netw, neth)
data = tvm.relay.testing.darknet.load_image(img_path, netw, neth)
######################################################################
# Execute on TVM Runtime
# ----------------------
Expand Down Expand Up @@ -153,12 +153,12 @@
# do the detection and bring up the bounding boxes
thresh = 0.5
nms_thresh = 0.45
img = nnvm.testing.darknet.load_image_color(img_path)
img = tvm.relay.testing.darknet.load_image_color(img_path)
_, im_h, im_w = img.shape
dets = nnvm.testing.yolo_detection.fill_network_boxes((netw, neth), (im_w, im_h), thresh,
dets = tvm.relay.testing.yolo_detection.fill_network_boxes((netw, neth), (im_w, im_h), thresh,
1, tvm_out)
last_layer = net.layers[net.n - 1]
nnvm.testing.yolo_detection.do_nms_sort(dets, last_layer.classes, nms_thresh)
tvm.relay.testing.yolo_detection.do_nms_sort(dets, last_layer.classes, nms_thresh)

coco_name = 'coco.names'
coco_url = 'https://github.com/siju-samuel/darknet/blob/master/data/' + coco_name + '?raw=true'
Expand All @@ -172,6 +172,6 @@

names = [x.strip() for x in content]

nnvm.testing.yolo_detection.draw_detections(font_path, img, dets, thresh, names, last_layer.classes)
tvm.relay.testing.yolo_detection.draw_detections(font_path, img, dets, thresh, names, last_layer.classes)
plt.imshow(img.transpose(1, 2, 0))
plt.show()
1 change: 1 addition & 0 deletions python/tvm/relay/frontend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
from .coreml import from_coreml
from .caffe2 import from_caffe2
from .tensorflow import from_tensorflow
from .darknet import from_darknet
2 changes: 1 addition & 1 deletion python/tvm/relay/frontend/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get_relay_op(op_name):
op = None
else:
# try search op in various modules
for candidate in (_op, _op.nn, _op.image):
for candidate in (_op, _op.nn, _op.image, _op.vision):
op = getattr(candidate, op_name, None)
if op is not None:
break
Expand Down
Loading