VisionZQ edited a comment on issue #15646:
URL:
https://github.com/apache/incubator-mxnet/issues/15646#issuecomment-647126347
@kuonangzhe Hi,
Are you solve those problems?
I meet the same issue likes 'Cannot parse ONNX into TensorRT Engine' and
'Finding ancestor failed. There is probably a loop in the graph'
Thank you for you reply.
`
from gluoncv import model_zoo, data, utils
from matplotlib import pyplot as plt
from gluoncv.utils import export_block
import mxnet as mx
from mxnet.contrib import onnx as onnx_mxnet
import numpy as np
import time
OUTPUT = "./"
DATA = "./cat.png"
SIZE = 416
MODEL = "yolo3_darknet53_coco"
INPUT_SHAPE = (1, 3, SIZE, SIZE)
net = model_zoo.get_model('yolo3_darknet53_coco', pretrained=True)
net.hybridize()
x, img = data.transforms.presets.yolo.load_test("./1.jpg", short=SIZE)
#class_IDs, scores, bounding_boxs = net(x)
a=net(x)
net.export("yolo3_darknet53_coco")
sym, arg_params, aux_params = mx.model.load_checkpoint(MODEL, 0)
batch_shape = INPUT_SHAPE
input = mx.nd.zeros(batch_shape)
print('Building TensorRT engine')
trt_sym = sym.get_backend_symbol('TensorRT')
arg_params, aux_params = mx.contrib.tensorrt.init_tensorrt_params(trt_sym,
arg_params, aux_params)
mx.contrib.tensorrt.set_use_fp16(False)
executor = trt_sym.simple_bind(ctx=mx.gpu(0), data=batch_shape,
grad_req='null', force_rebind=True)
executor.copy_params_from(arg_params, aux_params)
print('Starting TensorRT timed run')
start = time.process_time()
for i in range(0, 300):
y_gen = executor.forward(is_train=False, data=input)
y_gen[0].wait_to_read()
end = time.time()
print(time.process_time() - start)
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]