Open handoku opened 4 years ago
Are you solved this issue? I meet the same problem. But, I run the official case is successful. `print("downloading sample input") input_data = get_image(url) gluon_resnet18 = vision.resnet18_v2(pretrained=True) gluon_resnet18.hybridize() gluon_resnet18.forward(input_data) gluon_resnet18.export(model_file_name) sym, arg_params, aux_params = mx.model.load_checkpoint(model_file_name, 0)
executor = sym.simple_bind(ctx=mx.gpu(), data=batch_shape,
grad_req='null', force_rebind=True)
executor.copy_params_from(arg_params, aux_params)
s0 = time.time()
y = executor.forward(is_train=False, data=input_data)
print('t0 = %.6f'%(time.time()-s0))
trt_sym = sym.get_backend_symbol('TensorRT')
arg_params, aux_params = mx.contrib.tensorrt.init_tensorrt_params(trt_sym, arg_params, aux_params)
original_precision_value = mx.contrib.tensorrt.get_use_fp16()
try:
mx.contrib.tensorrt.set_use_fp16(False)
executor = trt_sym.simple_bind(ctx=mx.gpu(), data=batch_shape,
grad_req='null', force_rebind=True)
executor.copy_params_from(arg_params, aux_params)
s1 = time.time()
y_trt = executor.forward(is_train=False, data=input_data)
print('t1 = %.6f' % (time.time() - s1))
mx.contrib.tensorrt.set_use_fp16(False)
executor = trt_sym.simple_bind(ctx=mx.gpu(), data=batch_shape,
grad_req='null', force_rebind=True)
executor.copy_params_from(arg_params, aux_params)
y_trt_fp32 = executor.forward(is_train=False, data=input_data)
no_trt_output = y[0].asnumpy()[0]
trt_output = y_trt[0].asnumpy()[0]
trt_fp32_output = y_trt_fp32[0].asnumpy()[0]
assert_almost_equal(no_trt_output, trt_output, 1e-1, 1e-2)
assert_almost_equal(no_trt_output, trt_fp32_output, 1e-4, 1e-4)
finally:
mx.contrib.tensorrt.set_use_fp16(original_precision_value)`
So, because detection model exist multi output branch ?
Description
I was using ngc docker image mxnet-19.12. And I'm trying to use tensorrt to speed up gluoncv yolov3 following Optimizing Deep Learning Computation Graphs with TensorRT.
I replaced the
resnet-18
model withyolo3_darknet53_coco
, but when building the tensorrt engine, the program broke down. its output saidFound a cycle when BFS from node darknetv30_darknetbasicblockv31__plus0
Error Message
To Reproduce
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)
Steps to reproduce
(Paste the commands you ran that produced the error.)
1.prepare the script
yolo3_trt.py
python ./yolo3_trt.py
What have you tried to solve it?