Open ran337287 opened 6 years ago
That's a very good question. I can not reproduce this error on my machine.
The error tells you that your model (i.e. the parameters) has not been copied to the GPU, but your data is.
The model should be copied to the GPU automatically, if you set the command line argument --gpu
to 0
Did you change anything in text_recognition_demo.py
?
Thank U for your reply. @Bartzi I didn't change anything in text_recognition_demo.py. The only thing I changed is gpu=-1 or gpu=0. I installed pipenv, and ran the code in virtual environment. The version of requirements is satisfied.
Could you provide the exact command you used to invoke the script and also the exact error you get? As I said, I can not reproduce the error here...
I download the text_recognition_model.zip from https://bartzi.de/research/see, and unzip it to folder 'see'.
When I execute
python ~/see/chainer/text_recognition_demo.py ~/see/text_recognition_model/model \ ~/see/text_recognition_model/model/model_190000.npz ~/see/demo/19.png \ ~/see/datasets/textrec/ctc_char_map.json --gpu=-1
It returns
I download the text_recognition_model.zip from https://bartzi.de/research/see, and unzip it to folder 'see
When I execute
python ~/see/chainer/text_recognition_demo.py ~/see/text_recognition_model/model \ ~/see/text_recognition_model/model/model_190000.npz ~/see/demo/19.png \ ~/see/datasets/textrec/ctc_char_map.json --gpu=0
it returns
I'm not sure, whether this will fix it, but I your command-line should look like this:
python ~/see/chainer/text_recognition_demo.py ~/see/text_recognition_model/model \
model_190000.npz ~/see/demo/19.png \
~/see/datasets/textrec/ctc_char_map.json --gpu=0
HI @Bartzi
I am facing a similar issue as well, the output i get always returns an ordered Dictionary.
Am i missing any steps here?
Regards Sekar
An ordered dictionary is the expected output =)
The keys of this dictionary are the predicted words and the values are ordered dictionaries with the bboxes predicted for this word.
HI Bartzi,
My understanding was the same, however for the same file i ran i got the below output.
prediction [26 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] word1 [26 15] word2 pe
python text_recognition_demo.py ~/TextOcr/SEE/text_recognition_model/model \model_190000.npz ~/Pictures/select_003.png ~/TextOcr/SEE/see-master/datasets/textrec/ctc_char_map.json
Which does not match the image. Can you let me know where am i going wrong?
Regards Sekar
You are using an image, where the network does not know how to handle it. It has only been trained on images with one line of cropped-text, and not two. You can not use this model for such predictions. That is the problem you are facing here.
Thanks Bartzi,
That really helped, appreciate your timely help.
When I run text_recognition_demo.py with parameters gpu=-1(that is cpu), it can return the results. But if I set gpu=0, there is something wrong. The error is
ValueError:numpy and cupy must not be used together type(W):<class 'numpy.ndarray'>, type(x):<class 'cupy.core.core.ndarray'>,type(b):<class 'numpy.ndarray'>
I know nothing about Chainer, what should I do to solve it?