Bartzi / see

Code for the AAAI 2018 publication "SEE: Towards Semi-Supervised End-to-End Scene Text Recognition"
GNU General Public License v3.0
573 stars 147 forks source link

FSNS demo error #64

Closed 21toanyone-pro closed 5 years ago

21toanyone-pro commented 5 years ago

python fsns_demo.py models/model model_35000.npz test.jpg ../datasets/fsns/fsns_char_map.json

Traceback (most recent call last):
  File "fsns_demo.py", line 153, in <module>
    predictions, crops, grids = network(image[xp.newaxis, ...])
  File "/home/lim/tests/see/chainer/models/model/fsns.py", line 521, in __call__
    h = self.localization_net(images)
  File "/home/lim/tests/see/chainer/models/model/fsns.py", line 184, in __call__
    h = self.bn0(self.conv0(images))
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/link.py", line 242, in __call__
    out = forward(*args, **kwargs)
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/links/connection/convolution_2d.py", line 173, in forward
    groups=self.groups)
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/functions/connection/convolution_2d.py", line 570, in convolution_2d
    y, = fnode.apply(args)
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/function_node.py", line 245, in apply
    self._check_data_type_forward(in_data)
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/function_node.py", line 330, in _check_data_type_forward
    self.check_type_forward(in_type)
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/functions/connection/convolution_2d.py", line 66, in check_type_forward
    x_type.shape[1] == w_type.shape[1] * self.groups,
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/utils/type_check.py", line 546, in expect
    expr.expect()
  File "/home/lim/anaconda3/lib/python3.7/site-packages/chainer/utils/type_check.py", line 483, in expect
    '{0} {1} {2}'.format(left, self.inv, right))
chainer.utils.type_check.InvalidType: 
Invalid operation is performed in: Convolution2DFunction (Forward)

Expect: in_types[0].shape[1] == in_types[1].shape[1] * 1
Actual: 4 != 3
Bartzi commented 5 years ago

Hmm, it seems that your input image has too many channels. Could you try to change this line to: image = xp.asarray(the_image.convert('RGB'), dtype=np.float32)?

21toanyone-pro commented 5 years ago

Thanks, I solved it!

Bartzi commented 5 years ago

Did my provided solution help you, or was it something else?

21toanyone-pro commented 5 years ago

Your way helped! Thanks!