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

I can't run the code you provided. #29

Open ANewAnonymous opened 5 years ago

ANewAnonymous commented 5 years ago

I tried to run demo.py. Here is the complete code: python demo.py -i ./demo -m ../fh02.pth But the following error is prompted: Traceback (most recent call last): File "demo.py", line 280, in fps_pred, y_pred = model_conv(x) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 489, in call result = self.forward(*input, kwargs) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\nn\parallel\data_parallel.py", line 141, in forward return self.module(*inputs[0], *kwargs[0]) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\nn\modules\module.py", line 489, in call result = self.forward(input, kwargs) File "demo.py", line 210, in forward roi1 = roi_pooling_ims(_x1, boxNew.mm(p1), size=(16, 8)) File "D:\Development\DevelopmentProject\Python\CCPD-master\rpnet\roi_pooling.py", line 73, in roi_pooling_ims output.append(adaptive_max_pool(im, size)) File "D:\Development\DevelopmentProject\Python\CCPD-master\rpnet\roi_pooling.py", line 35, in adaptive_max_pool return AdaptiveMaxPool2d(size[0], size[1])(input) File "D:\Development\DevelopmentProject\Python\CCPD-master\rpnet\roi_pooling.py", line 18, in forward self._backend = type2backend[type(input)] File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch_thnn__init.py", line 15, in getitem__ return self.backends[name].load() KeyError: <class 'torch.Tensor'>

I run: python wR2.py -i ./CCPD_2019/CCPD2019 -b 4 The following error occurred: Traceback (most recent call last):

File "wR2.py", line 226, in trainloader = DataLoader(dst, batch_size=batchSize, shuffle=True, num_workers=4) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\utils\data\dataloader.py", line 802, in init sampler = RandomSampler(dataset) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\utils\data\sampler.py", line 64, in init "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integeral value, but got num_samples=0

I run python rpnet.py -i ./CCPD_2019/CCPD2019 -b 4 -se 0 -f ./wR2 -t ./demo and error: Traceback (most recent call last): File "rpnet.py", line 406, in trainloader = DataLoader(dst, batch_size=batchSize, shuffle=True, num_workers=8) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\utils\data\dataloader.py", line 802, in init sampler = RandomSampler(dataset) File "D:\Development\DevelopmentEnvironment\Miniconda3\lib\site-packages\torch\utils\data\sampler.py", line 64, in init "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integeral value, but got num_samples=0

Can you help me solve this problem? I will appreciate your help very much.

zhangwang0537 commented 5 years ago

File "demo.py", line 273, in fps_pred, y_pred = model_conv(x) File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, kwargs) File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/parallel/data_parallel.py", line 123, in forward outputs = self.parallel_apply(replicas, inputs, kwargs) File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/parallel/data_parallel.py", line 133, in parallel_apply return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)]) File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/parallel/parallel_apply.py", line 77, in parallel_apply raise output File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/parallel/parallel_apply.py", line 53, in _worker output = module(*input, *kwargs) File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, 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/Masx/CCPD/rpnet/roi_pooling.py", line 73, in roi_pooling_ims output.append(adaptive_max_pool(im, size)) File "/home/Masx/CCPD/rpnet/roi_pooling.py", line 35, in adaptive_max_pool return AdaptiveMaxPool2d(size[0], size[1])(input) File "/home/Masx/CCPD/rpnet/roi_pooling.py", line 18, in forward self._backend = type2backend[type(input)] File "/usr/local/pytorch-3/lib/python3.5/site-packages/torch/_thnn/init.py", line 15, in getitem return self.backends[name].load() KeyError: <class 'torch.Tensor'>

ninghongbo123 commented 5 years ago

You guys need to modify type(input) as input.type() in roi_pooling.py, line 18 ,then it works. This error caused by api changes of different pytorch version

zhqx511 commented 5 years ago

ninghongbo123 is right , up

Naveenkhasyap commented 5 years ago

@ninghongbo123 yes it solved one error but later got other error once we fix this, may i know the pytorch version in which it runs.

home/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in getattr raise NotImplementedError NotImplementedError

Naveenkhasyap commented 5 years ago

@ninghongbo123 yes it solved one error but later got other error once we fix this, may i know the pytorch version in which it runs.

home/miniconda3/envs/pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in getattr raise NotImplementedError NotImplementedError

Figured out that i was using latest pytorch 1.1 and the model has been built on 0.3 so downgraded the package it worked, for anyone trying this out I recommend them to have a environment with below versions strictly so that they wont face any issue. python: pytorch(0.3.1), numpy(1.14.3), cv2(2.4.9.1). system: Cuda(release 9.1, V9.1.85)

Fansgithub2019 commented 5 years ago

@Naveenkhasyap The same error occurred. Can't solve the problem without modifying or reducing the environment? Is there any other way?

adityajadhav1401 commented 4 years ago

@Naveenkhasyap Hey, can you let me know how exactly did you install python: pytorch(0.3.1), numpy(1.14.3), cv2(2.4.9.1). system: Cuda(release 9.1, V9.1.85) I am trying to use conda to install but facing a lot of issues. Please let me know. I have been stuck on this for a week now.