detectRecog / CCPD

[ECCV 2018] CCPD: a diverse and well-annotated dataset for license plate detection and recognition
MIT License
2.21k stars 564 forks source link

error self.backends[name].load() with pyTorch 1.0.0 #17

Open czero69 opened 5 years ago

czero69 commented 5 years ago

I got error in roi pooling for return self.backends[name].load(), while trying to run demo.py. my env:

CUDA 10.0 Python 2.7.15 |Anaconda, Inc.

print(torch.version) 1.0.0

replacing self._backend = type2backend[type(input)]with self._backend = type2backend[input.type()] solved the problem

I suspect I have newer pytorch. See also: https://discuss.pytorch.org/t/keyerror-class-torch-tensor/22560

full error code:

True Traceback (most recent call last): File "demo.py", line 273, in fps_pred, y_pred = model_conv(x) File "/home/kamil/miniconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/home/kamil/miniconda2/lib/python2.7/site-packages/torch/nn/parallel/data_parallel.py", line 141, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/kamil/miniconda2/lib/python2.7/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) File "demo.py", line 229, in forward roi1 = roi_pooling_ims(_x1, boxNew.mm(p1), size=(16, 8)) File "/home/kamil/programy/CCPD/rpnet/roi_pooling.py", line 73, in roi_pooling_ims output.append(adaptive_max_pool(im, size)) File "/home/kamil/programy/CCPD/rpnet/roi_pooling.py", line 35, in adaptive_max_pool return AdaptiveMaxPool2d(size[0], size[1])(input) File "/home/kamil/programy/CCPD/rpnet/roi_pooling.py", line 18, in forward self._backend = type2backend[type(input)] File "/home/kamil/miniconda2/lib/python2.7/site-packages/torch/_thnn/init.py", line 15, in getitem return self.backends[name].load() KeyError: <class 'torch.Tensor'>

HuangSanLi commented 5 years ago

i have meet the same problem,are you solved it ?

czero69 commented 5 years ago

replacing self._backend = type2backend[type(input)]with self._backend = type2backend[input.type()] solved the problem

HuangSanLi commented 5 years ago

thanks so much .

gqjia commented 5 years ago

Ty

ww451575464 commented 5 years ago

thanks

liuqc11 commented 5 years ago

thanks

Fansgithub2019 commented 5 years ago

Did it like you did, but there was a new error.

True Traceback (most recent call last): File "demo.py", line 275, in fps_pred, y_pred = model_conv(x) File "/home/fan/anaconda3/envs/tf/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/fan/anaconda3/envs/tf/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/fan/anaconda3/envs/tf/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "demo.py", line 230, in forward roi1 = roi_pooling_ims(_x1, boxNew.mm(p1), size=(16, 8)) File "/home/fan/CCPD-master/rpnet/roi_pooling.py", line 74, in roi_pooling_ims output.append(adaptive_max_pool(im, size)) File "/home/fan/CCPD-master/rpnet/roi_pooling.py", line 36, in adaptive_max_pool return AdaptiveMaxPool2d(size[0], size[1])(input) File "/home/fan/CCPD-master/rpnet/roi_pooling.py", line 20, in forward self._backend.SpatialAdaptiveMaxPooling_updateOutput( File "/home/fan/anaconda3/envs/tf/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in getattr raise NotImplementedError NotImplementedError

Is this the need to define the subclass SpatialAdaptiveMaxPooling_updateOutput? Could anybody help me?

ggsggs commented 5 years ago

I also have the same problem with Pytorch 1.1 and Windows. Perhaps downgrading to pytorch 0.4 solves the problem.

Fansgithub2019 commented 5 years ago

How to downgrade to pytorch 0.4?Remove Pytorch 1.1 and install pytorch 0.4 ?

ggsggs commented 5 years ago

I am not the best person to recommend but: I would create a new virtual environment and install all required packages.

If you are using conda, conda create - n yourenvname python=x.x source activate yourenvname and then install all packages you need with conda install yourpackage1

And then install the pytorch version that are used in this repo.

On Wed, 17 Jul 2019, 08:49 Fansgithub2019, notifications@github.com wrote:

How to downgrade to pytorch 0.4?Remove Pytorch 1.1 and install pytorch 0.4 ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/detectRecog/CCPD/issues/17?email_source=notifications&email_token=AKOJJ3DBFXSKOVDTDTIE2PTP73FIRA5CNFSM4GL3T3T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2DLD3Q#issuecomment-512143854, or mute the thread https://github.com/notifications/unsubscribe-auth/AKOJJ3GKVIRSEISWE4G2ATLP73FIRANCNFSM4GL3T3TQ .