The codes are still being modified, but I can illustrate this problem with some sample codes：
In the development environment where torchscript is exported, we have:
from detectron2.structures import Box

class MyModule(nn.Module) -> Box:
    some_of_codes

then we export torchscript:
model = MyModule()
torch.jit.script(model).save('scripted_model.pt')

In the deployment environment, we have:
model = torch.jit.load('scripted_model.pt')
input = some_data_of_model
output = model(input)

Since the data type ‘detectron2.structures.Box’ is not available here, the RuntimeError mentioned above will appear.
I can see that the ‘detectron2.structures.Box’ class is available in the serialized code of my TorchScript, but it seems that I can not use it to construct an instance which can receive the result from the output of torchscript.