Closed sevenHsu closed 5 years ago
Just to clarify, you believe that the resulting array should be (32, 100) or (32, 133)?
Using a slice like in the code pictured should produce a (32, 100) array as expected and desired.
@sevenHsu 我看这里的代码也有这个疑惑,test的时候这里就报错了。我改成如果长度太长,只取前面100列,感觉这样还是有问题的,不能识别后面的文字了。 还有一个问题,我把放入session run之前的batchx图片保存下来,它是被reshape了的,宽和高纬度交换的时候,所以保存出来的看不出字的形状,感觉很奇怪啊
@Belval I can't understand your answer, when i try a picture in (22,92), will be (32,133) in your code , then will error in next code. another question, when you prepare training data, from raw_batch_x to batch_x in function "__generate_all_test_batches", you just reshape, i think you should use transpose to change the width and height axis. save the batch_x in this step is not a readable picture anymore.
@xxlxx1 I reproduced the problem. We could simply change the line to:
final_arr[:, 0:min(input_width, np.shape(im_arr_resized)[1]] = im_arr_resized[:, 0:input_width]
Please tell me if it works on your size. I got this result:
Before:
After:
from utils import resize_image
from scipy.misc import imsave
im = resize_image('test3.png', 100)
print(len(im[0]))
imsave('result.png', im[0])
I'm investigating your other question.
For your second question:
There indeed seems to be a big problem with the reshaping, I changed it to np.swapaxes, which gives the desired result.
I'm currently retraining the whole thing, I'll keep you updated.
Thank you!
Please check my last commit, it should fix both the issues mentionned here.
Closing for lack of activity.
Question describe
Bug position: data_manage.py->resize_omage function
code:
detail: if the shape of im_arr is (22,92),the programe will run code in 'else',so the shape of im_arr_resized will be(32,int(c(32/r))) i.e (32,int(92(32/22)))=(32,133).
At this code :
final_arr[:, 0:np.shape(im_arr_resized)[1]] = im_arr_resized
.You just make the fina_arr[ : ,0 : 133]=im_arr_resized,but the max_width of final_arr is 100