tensorflow车牌号码识别源码
tensorflow车牌号码识别源码,tensorflow文字识别扩展发挥
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-03 14:09 tf_car_license_dataset
文件 19563 2018-04-03 13:57 tf_car_license_dataset20171119075105263.jpg
目录 0 2017-11-18 20:08 tf_car_license_dataset est_images
文件 2358 2017-12-05 20:21 tf_car_license_dataset est_images1.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_953_1.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_954_2.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_954_3.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_955_4.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_955_5.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_956_6.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_956_7.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_823_1.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_824_3.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_4.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_5.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_6.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_826_7.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_753_1.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_755_3.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_755_4.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_5.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_6.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_7.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_454_1.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_455_2.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_456_4.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_456_5.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_457_6.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_457_7.bmp
文件 2358 2017-11-08 01:37 tf_car_license_dataset est_images1510076240_73_1.bmp
文件 2358 2017-11-08 01:37 tf_car_license_dataset est_images1510076240_75_3.bmp
............此处省略9366个文件信息
#!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import sys
import os
import time
import random
import numpy as np
import tensorflow as tf
from PIL import Image
SIZE = 1280
WIDTH = 32
HEIGHT = 40
NUM_CLASSES = 34
iterations = 1000
SAVER_DIR = “train-saver/digits/“
LETTERS_DIGITS = (“0““1““2““3““4““5““6““7““8““9““A““B““C““D““E““F““G““H““J““K““L““M““N““P““Q““R““S““T““U““V““W““X““Y““Z“)
license_num = ““
time_begin = time.time()
# 定义输入节点,对应于图片像素值矩阵集合和图片标签(即所代表的数字)
x = tf.placeholder(tf.float32 shape=[None SIZE])
y_ = tf.placeholder(tf.float32 shape=[None NUM_CLASSES])
x_image = tf.reshape(x [-1 WIDTH HEIGHT 1])
# 定义卷积函数
def conv_layer(inputs W b conv_strides kernel_size pool_strides padding):
L1_conv = tf.nn.conv2d(inputs W strides=conv_strides padding=padding)
L1_relu = tf.nn.relu(L1_conv + b)
return tf.nn.max_pool(L1_relu ksize=kernel_size strides=pool_strides padding=‘SAME‘)
# 定义全连接层函数
def full_connect(inputs W b):
return tf.nn.relu(tf.matmul(inputs W) + b)
if __name__ ==‘__main__‘ and sys.argv[1]==‘train‘:
# 第一次遍历图片目录是为了获取图片总数
input_count = 0
for i in range(0NUM_CLASSES):
dir = ‘./train_images/training-set/%s/‘ % i # 这里可以改成你自己的图片目录,i为分类标签
for rt dirs files in os.walk(dir):
for filename in files:
input_count += 1
# 定义对应维数和各维长度的数组
input_images = np.array([[0]*SIZE for i in range(input_count)])
input_labels = np.array([[0]*NUM_CLASSES for i in range(input_count)])
# 第二次遍历图片目录是为了生成图片数据和标签
index = 0
for i in range(0NUM_CLASSES):
dir = ‘./train_images/training-set/%s/‘ % i # 这里可以改成你自己的图片目录,i为分类标签
for rt dirs files in os.walk(dir):
for filename in files:
filename = dir + filename
img = Image.open(filename)
width = img.size[0]
height = img.size[1]
for h in range(0 height):
for w in range(0 width):
# 通过这样的处理,使数字的线条变细,有利于提高识别准确率
if img.getpixel((w h)) > 230:
input_images[index][w+h*width] = 0
else:
input_images[index][w+h*width] = 1
input_labels[index][i] = 1
index += 1
# 第一次遍历图片目录是为了获取图片总数
val_count = 0
for i in range(0NUM_CLASSES):
dir = ‘./train_images/validation-set/%s/‘ % i # 这里可以改成你自己的图片目录,i为分类标签
for rt dirs files in os.walk(dir):
for filename in files:
val_count += 1
# 定义对应维数和各维长度的数组
val_images = np.array([[0]*SIZE for i in range(val_count)])
val_labels = np.array([[0]*NUM_CLASSES for i in range(val_count)])
# 第二次遍历图片目录是为了生成图片数据和标签
index = 0
for i in range(0NUM_CLASSES):
dir = ‘.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-03 14:09 tf_car_license_dataset
文件 19563 2018-04-03 13:57 tf_car_license_dataset20171119075105263.jpg
目录 0 2017-11-18 20:08 tf_car_license_dataset est_images
文件 2358 2017-12-05 20:21 tf_car_license_dataset est_images1.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_953_1.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_954_2.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_954_3.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_955_4.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_955_5.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_956_6.bmp
文件 2358 2017-11-08 01:34 tf_car_license_dataset est_images1510076083_956_7.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_823_1.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_824_3.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_4.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_5.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_825_6.bmp
文件 2358 2017-11-08 01:35 tf_car_license_dataset est_images1510076148_826_7.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_753_1.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_755_3.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_755_4.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_5.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_6.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076183_756_7.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_454_1.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_455_2.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_456_4.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_456_5.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_457_6.bmp
文件 2358 2017-11-08 01:36 tf_car_license_dataset est_images1510076213_457_7.bmp
文件 2358 2017-11-08 01:37 tf_car_license_dataset est_images1510076240_73_1.bmp
文件 2358 2017-11-08 01:37 tf_car_license_dataset est_images1510076240_75_3.bmp
............此处省略9366个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)