Comments (3)
我无法重现这个错误,我使用的是 keras 1.2.2 和 tensorflow 1.0.1。你可以尝试升级版本。
I can not reproduce this error, I am using keras 1.2.2 and tensorflow 1.0.1.You can try to upgrade the version.
from captcha_break.
请问用的Python版本是哪一个?
from captcha_break.
使用的python是Anaconda4.2.0,keras2.0.8,tensorflow1.3.0
修改成一下没有警告的版本后运行没问题,收敛的也不错,大赞作者
from captcha.image import ImageCaptcha
import matplotlib.pyplot as plt
import numpy as np
import random
import string
characters = string.digits + string.ascii_uppercase
width, height, n_len, n_class = 170, 80, 4, len(characters)
def gen(batch_size=32):
X = np.zeros((batch_size, height, width, 3), dtype=np.uint8)
y = [np.zeros((batch_size, n_class), dtype=np.uint8) for i in range(n_len)]
generator = ImageCaptcha(width=width, height=height)
while True:
for i in range(batch_size):
random_str = ''.join([random.choice(characters) for j in range(4)])
X[i] = generator.generate_image(random_str)
for j, ch in enumerate(random_str):
y[j][i, :] = 0
y[j][i, characters.find(ch)] = 1
yield X, y
def decode(y):
y = np.argmax(np.array(y), axis=2)[:,0]
return ''.join([characters[x] for x in y])
X, y = next(gen(1))
plt.imshow(X[0])
plt.title(decode(y))
from keras.models import *
from keras.layers import *
input_tensor = Input((height, width, 3))
x = input_tensor
for i in range(4):
x = Conv2D(filters=32*2**i, kernel_size=(3, 3), activation='relu')(x)
x = Conv2D(filters=32*2**i, kernel_size=(3, 3), activation='relu')(x)
x = MaxPooling2D(pool_size=(2, 2))(x)
x = Flatten()(x)
x = Dropout(0.25)(x)
x = [Dense(n_class, activation='softmax', name='c%d'%(i+1))(x) for i in range(4)]
model = Model(inputs=input_tensor, outputs=x)
model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])
from keras.utils.vis_utils import plot_model
plot_model(model, to_file="model.png", show_shapes=True)
model.fit_generator(gen(), steps_per_epoch=1600, epochs=5, validation_data=gen(), validation_steps=40)
from captcha_break.
Related Issues (20)
- 如何把保存下来的ctc模型载入继续训练呢?
- 您可否告知下这几个文件是独立运行的吗,如何训练自己的中文验证码呢 HOT 5
- RNN分类之后, 在评估处怎么获得每个字符的概率呢 HOT 1
- 楼主您好,请问3500常用汉字的验证码识别,该模型大小够吗? HOT 5
- 多行验证码如何识别呢? HOT 4
- loss为负数且不断减小
- cannot import name '_imaging' from 'PIL'
- 变长标签怎么处理
- 如果验证码最后两位相同,似乎一定识别错误 HOT 4
- 运行winpy/main.py遇到的问题 HOT 5
- train和val的acc都可以到99%,但是eval,只有0.00265,这是怎么回事呢
- 尝试把n_class+1程序可以运行,但是不知道对不对 HOT 1
- 请问如果是不定长的验证码 可以使用吗 HOT 2
- 使用CTC, 识别时不限制4个字符长度,识别率如何? HOT 3
- CTC模型不定长输出问题 HOT 1
- 效果不理想
- 训练完了怎么用啊,纯小白 HOT 2
- cnn_2019.ipynb(防止 tensorflow 占用所有显存)tensorflow2.0要怎么改 HOT 1
- tensorflow 2.0 训练的时候 日志不显示 不知道 训练到哪一步 HOT 1
- 请问我改如何替换掉ctc_2019中的lambda方法呢 因为lambda在加载保存的模型会有错误 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from captcha_break.