Kindai-OCR icon indicating copy to clipboard operation
Kindai-OCR copied to clipboard

Code does not work

Open polm opened this issue 4 years ago • 4 comments

Thank you for putting this online, but I could not run the code as provided.

I am not sure how you generated requirements.txt. "Python" is not a valid entry there. If you have a working environment you could generate it with pip freeze > requirements.txt.

I worked around that and ran into an issue with multiprocessing - you're setting cuda on the model to be a boolean from the config object, but multiprocessing tried to use cuda to convert parameters, and that didn't work. I fixed that by changing the cuda attribue to use_cuda wherever I found it, but then had errors with some parameters being cuda and some non-cuda. At that point I gave up.

Let me know if there's some information I could provide that would help.

polm avatar Aug 24 '20 07:08 polm

Me too. At first, same error , while tring to uses cpu only. To avoid the error, I install the torch with cuda, but it still not working .

`./pretrain/vgg16_bn-6c64b313.pth Loading text detection model from checkpoint ./pretrain/synweights_4600.pth total words/phones 5748 ./data/test\1.jpg/data/test\1.jpg

infer/postproc time : 9.427/0.210 Traceback (most recent call last): File "D:\Green\Kindai-OCR-master\test.py", line 349, in test(args.trained_model, args.model_path, args.dictionary_target) File "D:\Green\Kindai-OCR-master\test.py", line 295, in test sample, score, alpha_past_list = gen_sample(OCR, xx_pad, params, args.cuda, k=10, maxlen=600) File "D:\Green\Kindai-OCR-master\utils.py", line 150, in gen_sample next_state, ctx0 = model.module.f_init(x) File "D:\Green\Kindai-OCR-master\encoder_decoder.py", line 80, in f_init ctx, _ctx_mask = self.encoder(x, x_mask) File "D:\Program Files\Python39\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "D:\Green\Kindai-OCR-master\encoder.py", line 96, in forward out = self.conv1(x) File "D:\Program Files\Python39\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "D:\Program Files\Python39\lib\site-packages\torch\nn\modules\conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "D:\Program Files\Python39\lib\site-packages\torch\nn\modules\conv.py", line 395, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same`

CLY88 avatar Mar 18 '21 02:03 CLY88

Same Error to me! image

kdrkdrkdr avatar Jun 10 '21 02:06 kdrkdrkdr

Same error

Kromtar avatar Sep 11 '21 23:09 Kromtar

Same issue. It's like the versions they gave us just aren't made to work.

641i130 avatar Jan 20 '24 03:01 641i130