VisionZQ commented on issue #18231:
URL:
https://github.com/apache/incubator-mxnet/issues/18231#issuecomment-647108067
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 ?
----------------------------------------------------------------
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]