MXNet之CNN:自定义CNN-OCR算法训练车牌数据集(umpy.ndarray格式数据)实现车牌照片字符识别并评估模型
MXNet之CNN:自定义CNN-OCR算法训练车牌数据集(umpy.ndarray格式数据)实现车牌照片字符识别并评估模型
导读
利用CNN-OCR算法训练车牌数据集评估模型并实现车牌照片字符识别,训练中的车牌数据集是Numpy.ndarray格式数据,当然也可以进一步生成图片,方便直接查看。
目录
输出结果
gen_sample之后
1、训练感悟
22:58训练记录:我勒个去,跑了半天,准确度还没上来,啊啊啊,要疯了……
相关文章:
生成图片,CV:设计自动生成汽车车牌图片算法(cv2+PIL)根据指定七个字符自动生成逼真车牌图片数据集(带各种噪声效果)
MXNet之CNN:自定义CNN-OCR算法训练车牌数据集(umpy.ndarray格式数据)实现车牌照片字符识别并评估模型
设计思路
第一次
第二次
总思路
核心代码
后期更新……
-
class GenPlate:
-
def __init__(self,fontCh,fontEng,NoPlates):
-
self.fontC = ImageFont.truetype(fontCh,43,0);
-
self.fontE = ImageFont.truetype(fontEng,60,0);
-
self.img=np.array(Image.new("RGB", (226,70),(255,255,255)))
-
-
……
-
-
-
def draw(self,val):
-
offset= 2 ;
-
-
self.img[0:70,offset+8:offset+8+23]= GenCh(self.fontC,val[0]);
-
-
……
-
-
return self.img
-
-
def generate(self,text): #generate()方法,
-
# print('text', text, len(text))
-
if len(text) == 7: # 9
-
# print('开始运行if语句')
-
fg = self.draw(text);
-
……
-
-
def genPlateString(self,pos,val): #定义genPlateString函数
-
……
-
-
for unit,cpos in zip(box,range(len(box))):
-
if unit == 1:
-
plateStr += val
-
else:
-
if cpos == 0:
-
plateStr += chars[r(31)]
-
elif cpos == 1:
-
plateStr += chars[41+r(24)]
-
else:
-
plateStr += chars[31 + r(34)]
-
-
return plateStr;
-
-
def genBatch(self, batchSize,pos,charRange, outputPath,size):
-
if (not os.path.exists(outputPath)):
-
os.mkdir(outputPath)
-
l_plateStr = []
-
l_plateImg = []
-
for i in range(batchSize):
-
plateStr = G.genPlateString(-1,-1)
-
img = G.generate(plateStr);
-
img = cv2.resize(img,size);
-
-
l_plateStr.append(plateStr)
-
l_plateImg.append(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
-
return l_plateStr,l_plateImg
更多输出
-
start
-
start
-
[21:56:28] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:189: Using target_shape will be deprecated.
-
2019-05-04 21:56:28,024 Start training with [cpu(0)]
-
[21:56:28] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:189: Using target_shape will be deprecated.
-
[21:56:28] c:\jenkins\workspace\mxnet-tag\mxnet\src\operator\tensor\./matrix_op-inl.h:189: Using target_shape will be deprecated.
-
2019-05-04 21:56:50,213 Epoch[0] Batch [0-50] Speed: 18.52 samples/sec Accuracy=0.000000
-
2019-05-04 21:57:11,041 Epoch[0] Batch [50-100] Speed: 19.21 samples/sec Accuracy=0.000000
-
2019-05-04 21:57:37,527 Epoch[0] Batch [100-150] Speed: 15.10 samples/sec Accuracy=0.000000
-
2019-05-04 21:58:04,827 Epoch[0] Batch [150-200] Speed: 14.65 samples/sec Accuracy=0.000000
-
2019-05-04 21:58:31,717 Epoch[0] Batch [200-250] Speed: 14.88 samples/sec Accuracy=0.000000
-
2019-05-04 21:58:57,243 Epoch[0] Batch [250-300] Speed: 15.67 samples/sec Accuracy=0.000000
-
2019-05-04 21:59:21,087 Epoch[0] Batch [300-350] Speed: 16.78 samples/sec Accuracy=0.000000
-
2019-05-04 21:59:45,344 Epoch[0] Batch [350-400] Speed: 16.49 samples/sec Accuracy=0.000000
-
2019-05-04 22:00:03,961 Epoch[0] Batch [400-450] Speed: 21.49 samples/sec Accuracy=0.000000
-
-
……
-
-
2019-05-04 22:46:30,698 Epoch[0] Batch [7050-7100] Speed: 19.49 samples/sec Accuracy=0.000000
-
2019-05-04 22:46:50,442 Epoch[0] Batch [7100-7150] Speed: 20.26 samples/sec Accuracy=0.000000
-
2019-05-04 22:47:13,577 Epoch[0] Batch [7150-7200] Speed: 17.29 samples/sec Accuracy=0.000000
-
2019-05-04 22:47:35,495 Epoch[0] Batch [7200-7250] Speed: 18.25 samples/sec Accuracy=0.000000
-
2019-05-04 22:47:58,486 Epoch[0] Batch [7250-7300] Speed: 17.40 samples/sec Accuracy=0.000000
-
2019-05-04 22:48:22,143 Epoch[0] Batch [7300-7350] Speed: 16.91 samples/sec Accuracy=0.000000
-
2019-05-04 22:48:43,430 Epoch[0] Batch [7350-7400] Speed: 18.79 samples/sec Accuracy=0.000000
-
2019-05-04 22:49:03,882 Epoch[0] Batch [7400-7450] Speed: 19.56 samples/sec Accuracy=0.000000
-
-
……
-
-
2019-05-05 03:45:30,533 Epoch[0] Batch [62100-62150] Speed: 25.21 samples/sec Accuracy=0.000000
-
2019-05-05 03:45:46,024 Epoch[0] Batch [62150-62200] Speed: 25.82 samples/sec Accuracy=0.000000
-
2019-05-05 03:46:01,867 Epoch[0] Batch [62200-62250] Speed: 25.25 samples/sec Accuracy=0.000000
-
2019-05-05 03:46:17,135 Epoch[0] Batch [62250-62300] Speed: 26.20 samples/sec Accuracy=0.000000
-
2019-05-05 03:46:33,650 Epoch[0] Batch [62300-62350] Speed: 24.22 samples/sec Accuracy=0.000000
-
2019-05-05 03:46:49,428 Epoch[0] Batch [62350-62400] Speed: 25.35 samples/sec Accuracy=0.000000
-
2019-05-05 03:47:05,570 Epoch[0] Batch [62400-62450] Speed: 24.78 samples/sec Accuracy=0.000000
-
2019-05-05 03:47:21,043 Epoch[0] Batch [62450-62500] Speed: 25.85 samples/sec Accuracy=0.000000
-
2019-05-05 03:47:21,043 Epoch[0] Resetting Data Iterator
-
2019-05-05 03:47:21,046 Epoch[0] Time cost=21053.006
-
2019-05-05 03:47:43,604 Epoch[0] Validation-Accuracy=0.000000
-
2019-05-05 03:47:43,885 Saved checkpoint to "cnn-ocr-0001.params"
-
('浙CUR7QJ', [11, 43, 59, 56, 38, 55, 49])
-
-
相关文章
CV:设计自动生成汽车车牌图片算法(cv2+PIL)根据指定七个字符自动生成逼真车牌图片数据集(带各种噪声效果)
MXNet之CNN:自定义CNN-OCR算法训练车牌数据集(umpy.ndarray格式数据)实现车牌照片字符识别并评估模型
MXNet之CNN:自定义CNN-OCR算法训练车牌数据集(umpy.ndarray格式数据)实现车牌照片字符识别并进行新车牌照片字符预测
文章来源: yunyaniu.blog.csdn.net,作者:一个处女座的程序猿,版权归原作者所有,如需转载,请联系作者。
原文链接:yunyaniu.blog.csdn.net/article/details/89819311
- 点赞
- 收藏
- 关注作者
评论(0)