image2text icon indicating copy to clipboard operation
image2text copied to clipboard

Error in changing datatype of numpy array

Open tushalien opened this issue 7 years ago • 3 comments

ValueError: setting an array element with a sequence as ::

type(np.float32)

Traceback (most recent call last): File "app.py", line 29, in prediction = predictionApp.predict(input_image) File "/home/abc//services/prediction.py", line 65, in predict predicted_words = predicted_words.astype(np.float32) ValueError: setting an array element with a sequence.

tushalien avatar Oct 30 '17 18:10 tushalien

@tushalien You pbbly need to shape the predicted_words in box shape. Is it from my code or your customized code?

KleinYuan avatar Oct 30 '17 19:10 KleinYuan

It's from your code only. I tried setting it to type=object. But then the line _, num_words = predicted_words.shape

throws error saying it expects more argument. The tuple being returned here is (342, ) which is obviously not expected.

tushalien avatar Oct 31 '17 01:10 tushalien

I also meet the problem , after google,know that code line above list(chunks()) and np.array does not have same shape, eg: [1,2,[1,2,[4,1]]],the config file =>num_word2describe = 80 must be devieded evenly

cableyang avatar Apr 11 '18 22:04 cableyang