longcw / RoIAlign.pytorch

RoIAlign & crop_and_resize for PyTorch
555 stars 103 forks source link

TypeError from crop_and_resize.py : "initializer for ctype 'struct THCudaTensor *' must be a pointer to same type, not cdata 'struct THFloatTensor *" #26

Open kathydo opened 5 years ago

kathydo commented 5 years ago

Hi, I am trying to use the CropAndResize function on a GPU and am getting the following error. Does anyone have any suggestions? I am running with Python 3.7 and Pytorch 0.4.1.

X_conv451_crop = CropAndResizeFunction(self.crop_height, self.crop_width, 0)(X_conv451_torch, boxes, box_index) File "/home/kdo/anaconda3/envs/honours/lib/python3.7/site-packages/roi_align-0.0.1-py3.7.egg/roi_align/crop_and_resize.py", line 23, in forward self.extrapolation_value, self.crop_height, self.crop_width, crops) File "/home/kdo/anaconda3/envs/honours/lib/python3.7/site-packages/torch/utils/ffi/__init__.py", line 202, in safe_call result = torch._C._safe_call(*args, **kwargs) TypeError: initializer for ctype 'struct THCudaTensor *' must be a pointer to same type, not cdata 'struct THFloatTensor *'

zhongyingji commented 5 years ago

Did you solve the problem, I get stuck with the same issue

kathydo commented 5 years ago

Hey, if I remember correctly it was a Pytorch version issue. Using this version of crop an resize only allows pytorch 0.4.0 and before actually (not Pytorch 0.4.1). I ended up using the function from https://github.com/multimodallearning/pytorch-mask-rcnn which supports pytorch 0.4.1