Torch.jit.trace is not working with mask rcnn

Could you check, if passing the inputs as a list would solve the error, as claimed in the error message for scripting?
This code works for me:

import torch
import torchvision
model = torchvision.models.detection.maskrcnn_resnet50_fpn(pretrained=False)
model.eval()
scripted_model = torch.jit.script(model)
out = scripted_model([torch.randn(3, 224, 224), torch.randn(3, 400, 400)])
1 Like