sceneReco icon indicating copy to clipboard operation
sceneReco copied to clipboard

TypeError:only length-1 arrays can be converted to python scalars

Open HerShawn opened this issue 7 years ago • 6 comments

@bear63 Did you get this error when run demo.py?

"partImg=dumpRotateImage(im,degrees(atan2(...))) TypeError:only length-1 arrays can be converted to python scalars "

Thanks a lot!

HerShawn avatar Jun 15 '17 15:06 HerShawn

I didn't have this problem, Is there something wrong with your input

bear63 avatar Jun 18 '17 08:06 bear63

@bear63 I also faced the problem, the error is as follows:

<ipython-input-17-823099543ec4> in <module>()
----> 1 partImg = dumpRotateImage(im,degrees(atan2(pt2[1]-pt1[1],pt2[0]-pt1[0])),pt1,pt2,pt3,pt4)

TypeError: only length-1 arrays can be converted to Python scalars

the text_recs is an array:

In [7]: text_recs
Out[7]:
array([[[126, 145, 153],
        [137, 156, 164],
        [138, 157, 165],
        ...,
        [ 69,  82,  68],
        [ 72,  85,  71],
        [ 71,  84,  70]],

       [[132, 153, 161],
        [139, 160, 168],
        [138, 158, 165],
        ...,
        [ 58,  71,  57],
        [ 61,  74,  60],
        [ 61,  74,  60]],

       [[130, 151, 159],
        [137, 158, 166],
        [135, 156, 164],
        ...,
        [ 57,  70,  56],
        [ 61,  74,  60],
        [ 62,  75,  61]],

Indexing the first element gets the followings:

In [11]: rec = text_recs[0]

In [12]: rec
Out[12]:
array([[126, 145, 153],
       [137, 156, 164],
       [138, 157, 165],
       ...,
       [ 69,  82,  68],
       [ 72,  85,  71],
       [ 71,  84,  70]], dtype=uint8)

I'm just on the way to get it running and has not fully read the project code.

willard-yuan avatar Jun 19 '17 16:06 willard-yuan

After updated the other.py file, it ran success on my laptop. Thanks.

willard-yuan avatar Jun 26 '17 14:06 willard-yuan

@bear63 I have the same problem, It looks like that the function math.atan2 can not accept parameters with list type. and may i ask How do you handle the detection results (such as tilt box)?

vivounicorn avatar Jul 04 '17 07:07 vivounicorn

@willard-yuan I have the same problem,can you tell me how to updated the other.py file ,ths

dq-soulie avatar Oct 20 '17 12:10 dq-soulie

use this other.py would be ok, It is different from the code in tianzhi0549/CTPN

Melody12ab avatar Nov 24 '17 13:11 Melody12ab