Hi!
I am trying to use the pretrained Mask RCNN model directly from PyTorch. However, I would like to separate the backbone part from the RPN and the head part, i.e, I want to create two models from the initial model. I have seen many people ask this but, could not find a solution:
If I divide the model using modules = list(model.children()) and try to create an nn.Sequential() using this, I get this error: TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not tuple.
Some people also faced this issue, but I couldn’t solve this. Some examples are:
https://stackoverflow.com/questions/59816287/how-to-remove-certain-layers-from-fastern-rcnn-in-pytorch?answertab=oldest#tab-top 7
https://stackoverflow.com/questions/56455302/use-only-certain-layers-of-pretrained-torchvision-network 6
The problem is caused due to the GeneralizedRCNNTransform() returning an torchvision.models.detection.image_list.ImageList object.
Would be grateful for any kind of hints/help.
Thanks in advance.