当前位置:网站首页>Tensorflow realizes verification code recognition (I)
Tensorflow realizes verification code recognition (I)
2022-07-03 15:16:00 【alw_ one hundred and twenty-three】
effect
Let's see what the finished product looks like first , Finished products , With randomly generated 5W Zhang verification code for training , Training one 40 Multiple epoch, With randomly generated 2W The accuracy of Zhang Zuo's verification code is 98% The appearance of . With simple UI It's like this :
If you want to complete the code, you can enter the portal :https://github.com/aolingwen/fuck_verifycode
Generate verification code
To identify the verification code , Of course, the first thing is to get the verification code data ~~, If the verification code data is available, you can write the crawler to catch it , But after catching it, I have to type the verification code myself label, A troubling group . If you don't want to be so troublesome, you can go and find out if there is one ready-made label Good verification code data , Or make it yourself label Good verification code data . Here , I choose to generate it myself . So here is the code generated by the verification code . A simple batch . Just use ImageCaptcha To randomly generate .
# Generate captcha image ,gen_dir It is the directory where the verification code should be landing ,total_size Is the total number of verification codes to be generated ,chars_set Is the character set of the verification code ,chars_num Is the number of characters in a verification code
def gen_verifycode_img(gen_dir, total_size, chars_set, chars_num, img_height, img_width, font_sizes):
if not os.path.exists(gen_dir):
os.makedirs(gen_dir)
image = ImageCaptcha(width=img_width, height=img_height, font_sizes=font_sizes)
for i in range(total_size):
label = ''.join(random.sample(chars_set, chars_num))
image.write(label, os.path.join(gen_dir, label+'_num'+str(i)+'.png'))
Generate a good verification code , It's like this , Before file name 5 A character is the verification code label:
Now with the verification code , Next, we need to consider how to feed the data to tensorflow 了 , Because of the big data 5W Map , So I used tfrecord Of IO The way , Write next tfrecode How to play .
边栏推荐
- Mmdetection learning rate and batch_ Size relationship
- Influxdb2 sources add data sources
- Redis lock Optimization Practice issued by gaobingfa
- Global and Chinese market of solder bars 2022-2028: Research Report on technology, participants, trends, market size and share
- Solve the problem that pushgateway data will be overwritten by multiple push
- Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
- Matplotlib drawing label cannot display Chinese problems
- 5.2-5.3
- TPS61170QDRVRQ1
- Global and Chinese market of lighting control components 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢
Jvm-06-execution engine
Byte practice plane longitude 2
Introduction, use and principle of synchronized
Functional modules and application scenarios covered by the productization of user portraits
【Transform】【实践】使用Pytorch的torch.nn.MultiheadAttention来实现self-attention
Construction of operation and maintenance system
Introduction to redis master-slave, sentinel and cluster mode
视觉上位系统设计开发(halcon-winform)-5.相机
[transform] [NLP] first proposed transformer. The 2017 paper "attention is all you need" by Google brain team
Matplotlib drawing label cannot display Chinese problems
随机推荐
【云原生训练营】模块八 Kubernetes 生命周期管理和服务发现
Markdown file titles are all reduced by one level
Global and Chinese market of lighting control components 2022-2028: Research Report on technology, participants, trends, market size and share
Zero copy underlying analysis
【日常训练】395. 至少有 K 个重复字符的最长子串
基础SQL教程
The state does not change after the assignment of El switch
"Seven weapons" in the "treasure chest" of machine learning: Zhou Zhihua leads the publication of the new book "machine learning theory guide"
Kubernetes vous emmène du début à la fin
5.4-5.5
Jvm-04-runtime data area heap, method area
The method of parameter estimation of user-defined function in MATLAB
Byte practice plane longitude 2
Finally, someone explained the financial risk management clearly
Tencent internship interview sorting
406. Reconstruct the queue according to height
官网MapReduce实例代码详细批注
Web server code parsing - thread pool
什么是one-hot encoding?Pytorch中,将label变成one hot编码的两种方式
[set theory] inclusion exclusion principle (complex example)