Could you try to torch.jit.script the model instead of tracing it? I haven’t checked the model implementation, but note that tracing a model would not capture any data-dependent control flow etc. so unsure if it’s a good fit for a detection model.