Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error #22

Open
EEngl52 opened this issue Aug 18, 2020 · 1 comment
Open

runtime error #22

EEngl52 opened this issue Aug 18, 2020 · 1 comment

Comments

@EEngl52
Copy link

EEngl52 commented Aug 18, 2020

Trying to run ocrd-typegroups-classifier gives me this runtime error:

/test/data/1544_1$ ocrd-typegroups-classifier -I OCR-D-BIN -O OCR-D-TYPE -p '{"network": "/home/habocr/newinstallation/ocrd_all/ocrd_typegroups_classifier/ocrd_typegroups_classifier/models/classifier.tgc", "stride": 112}'
11:47:43.190 INFO ocrd_typegroups_classifier - Processing: 0 / P_bsb00028199_00013
Traceback (most recent call last):
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/bin/ocrd-typegroups-classifier", line 8, in <module>
    sys.exit(cli())
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd_typegroups_classifier/cli/ocrd_cli.py", line 15, in cli
    return ocrd_cli_wrap_processor(TypegroupsClassifierProcessor, *args, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd/decorators.py", line 102, in ocrd_cli_wrap_processor
    run_processor(processorClass, ocrd_tool, mets, workspace=workspace, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd/processor/base.py", line 61, in run_processor
    processor.process()
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd_typegroups_classifier/processor.py", line 41, in process
    result = classifier.run(pil_image, stride)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd_typegroups_classifier/typegroups_classifier.py", line 125, in run
    return self.classify(pil_image, stride, batch_size, score_as_key)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd_typegroups_classifier/typegroups_classifier.py", line 168, in classify
    out = self.network(tensors)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/ocrd_typegroups_classifier/network/densenet.py", line 118, in forward
    features = self.features(x)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/container.py", line 117, in forward
    input = module(input)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 419, in forward
    return self._conv_forward(input, self.weight)
  File "/home/habocr/newinstallation/ocrd_all/venv/local/sub-venv/headless-torch14/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 416, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Given groups=1, weight of size [64, 3, 7, 7], expected input[32, 1, 224, 224] to have 3 channels, but got 1 channels instead

What am I doing wrong?

@EEngl52
Copy link
Author

EEngl52 commented Aug 21, 2020

tried it again with RGB images, works perfectly fine now. thx for the hint! Could you please document in your Readme not to use binarized images as input?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant