I want to quantize pytorch maskrcnn, I have found some way that quantize maskrcnn by pytorch api. I got an error when I use tvm quantize api tvm.realy.quantize
. I think the reason of this problem is that maskrcnn is a dynamic model which builded by relay.vm.
So, I exported pytorch to onnx model and the onnx model can get correct output, I got another error when I builded the onnx model and evaluate it .
onnx_model = onnx.load(model_path)
input_name = 'images'
shape_dict = {input_name:img.shape}
with tvm.transform.PassContext(opt_level=3):
intrp = relay.build_module.create_executor("graph", mod, dev, target)
#
out = intrp.evaluate()(tvm.nd.array(img.astype('float32')), **params).numpy()