vacancy / PreciseRoIPooling

Precise RoI Pooling with coordinate gradient support, proposed in the paper "Acquisition of Localization Confidence for Accurate Object Detection" (https://arxiv.org/abs/1807.11590).
MIT License
772 stars 152 forks source link

Is this code available for pytorch 0.3.1? #18

Closed ran337287 closed 5 years ago

ran337287 commented 5 years ago

Hi, Is this code available for pytorch 0.3.1?

vacancy commented 5 years ago

No. It only works for 0.4 and 1.0 for now. However, you could try to use the pytorch-0.4 branch under pytorch 0.3.1, since their APIs are similar...

ran337287 commented 5 years ago

Can I modify prroi_pool.py to apply for pytorch 0.3.1? And my cuda version is 9.0

vacancy commented 5 years ago

Is there be any error if you directly use the code from the branch pytorch0.4 under pytorch0.3.1?

ran337287 commented 5 years ago

My test code is as follows, and modify -arch=sm_61, then the error is "
File "/home/ran/PreciseRoIPooling/pytorch/prroi_pool/functional.py", line 40, in forward dtype=features.dtype, device=features.device AttributeError: 'torch.cuda.FloatTensor' object has no attribute 'dtype'"

import torch
from torch.autograd import Variable
from pytorch.prroi_pool import PrRoIPool2D
pool = PrRoIPool2D(7,7, spatial_scale=0.5)
features = Variable(torch.rand((4,16,24,32)).cuda())
rois = torch.FloatTensor([
                          [0,0,0,14,14],
                          [1,14,14,28,28]])
rois = Variable(rois.cuda())

out = pool(features, rois)
vacancy commented 5 years ago

I see. Then you can try the old-style API:

output = features.new((nr_rois, nr_channels, pooled_height, pooled_width)).zero_()
ran337287 commented 5 years ago

It works!! Thank you very much!

vacancy commented 5 years ago

Great!