Tramac / awesome-semantic-segmentation-pytorch

Semantic Segmentation on PyTorch (include FCN, PSPNet, Deeplabv3, Deeplabv3+, DANet, DenseASPP, BiSeNet, EncNet, DUNet, ICNet, ENet, OCNet, CCNet, PSANet, CGNet, ESPNet, LEDNet, DFANet)
Apache License 2.0
2.79k stars 580 forks source link

Made CGNet scriptable #197

Open nassir90 opened 2 years ago

nassir90 commented 2 years ago

In it's current state, you cannot convert CGNet to torchscript using torch.jit.script. This is due to how torchscript handles variable resolution. I have changed some of the control flow in forward and I have also modified the constructor of ContextGuidedBlock slightly to fix these problems. This will be useful for those who want to compile their model using TensoRT for embedded devices.

nassir90 commented 2 years ago

This change is backwards compatible with existing cgnet weights.