dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
4.98k stars 1.32k forks source link

Run Yolact++ on cpu #579

Open sree3333 opened 3 years ago

sree3333 commented 3 years ago

HI @dbolya, I have been trying to run eval.py using CPU for yolact++.

I successfully ran eval.py for normal yolact on CPU but I couldn't do the same for Yolact ++. It's giving a weird error backbone.py", line 86, in _make_layer print(block.expansion) AttributeError: 'int' object has no attribute 'expansion'

It has no issue when I m running it on yolact but this error pops up when I m using yolact plus weight

BayerGleb commented 3 years ago

I'm afraid original version doesn't support CPU. There is version of @dbolya's yolact++ made by @hakillha which is adapted for CPU https://github.com/hakillha/yolact_yx

sree3333 commented 3 years ago

Hi @BayerGleb, thanks for your quick reply. But I think https://github.com/hakillha/yolact_yx is just for yolact as it doesn't have DCNv2 package which is a dependency for yolact++. Even I converted yolact code to run on CPU and it runs perfectly. I only have an issue running the yolact++weight with my CPU based code.

This is my fork https://github.com/sree3333/yolact if you want to try it, it works perfectly on CPU for yolact.

I am getting this error when I am trying to run yolact++ weight on CPU

RuntimeError: Error(s) in loading state_dict for Yolact: size mismatch for prediction_layers.0.bbox_layer.weight: copying a param with shape torch.Size([36, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([12, 256, 3, 3]). size mismatch for prediction_layers.0.bbox_layer.bias: copying a param with shape torch.Size([36]) from checkpoint, the shape in current model is torch.Size([12]). size mismatch for prediction_layers.0.conf_layer.weight: copying a param with shape torch.Size([729, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([243, 256, 3, 3]). size mismatch for prediction_layers.0.conf_layer.bias: copying a param with shape torch.Size([729]) from checkpoint, the shape in current model is torch.Size([243]). size mismatch for prediction_layers.0.mask_layer.weight: copying a param with shape torch.Size([288, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([96, 256, 3, 3]). size mismatch for prediction_layers.0.mask_layer.bias: copying a param with shape torch.Size([288]) from checkpoint, the shape in current model is torch.Size([96]).

feivelliu commented 3 years ago

@sree3333 Do you sloved this problem?