-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
实际项目中的验证码图片如何放入接口识别呢? #17
Comments
这是说明你给的验证码图片和训练的以及模型本身定义的图片大小不符合,建议是1:可以resize你要投入的图片,2:用你当前的图片重新打码训练模型 |
InvalidArgumentError (see above for traceback): Incompatible shapes: [38,378] vs. [64,378] |
哦, 重新更改图片尺寸没有报错。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if name == 'main':
# text, image = gen_captcha_text_and_image()
text = '1dxz'
captcha = 'y.jpg'
image = Image.open(captcha)
# image.show()
image = np.array(image)
image = convert2gray(image)
image = image.flatten() / 255
predict_text = crack_captcha(image)
print("正确: {} 预测: {}".format(text, predict_text))
报错:
验证码图像channel: (36, 70, 3)
验证码文本最长字符数 4
2017-11-28 22:35:53.116468: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
Traceback (most recent call last):
File "/Users/menggui/Desktop/project/zhuanli_spider/cnipr/other_operate/test_2/tensorflow_cnn.py", line 229, in
predict_text = crack_captcha(image)
File "/Users/menggui/Desktop/project/zhuanli_spider/cnipr/other_operate/test_2/tensorflow_cnn.py", line 209, in crack_captcha
text_list = sess.run(predict, feed_dict={X: [captcha_image], keep_prob: 1})
File "/Users/menggui/.pyenv/versions/env_comm_Ana3-4.3.0/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 889, in run
run_metadata_ptr)
File "/Users/menggui/.pyenv/versions/env_comm_Ana3-4.3.0/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1096, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (1, 36, 70) for Tensor 'Placeholder:0', which has shape '(?, 9600)'
The text was updated successfully, but these errors were encountered: