0.按照:https://blog.csdn.net/Darlingqiang/article/details/103889245步骤训练自己的模型
1.下载[data.zip]:链接: https://pan.baidu.com/s/1NahLmB5YajUJT_Gk1OgN7A 提取码: xre1
2.进入data/voc目录下运行voc_label.bat重新生成2019_train.txt, 2019_val.txt.
3.修改cfg/lpr.cfg。如下:
[net]
# Testing
batch=1
subdivisions=1
# Training
#batch=64
#subdivisions=8
#train width, height
#width=416
#height=416
#test width, height
width=608
height=608
channels=3
momentum=0.9
decay=0.0005
angle=5
saturation = 1.5
exposure = 1.5
hue=.1
learning_rate=0.001
burn_in=1000
max_batches = 220000
policy=steps
steps=70000,200000
scales=.1,.1
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=1
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
###########
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=225
activation=linear
#k-mean anchors
#12,27, 15,34, 18,46, 23,62, 30,85, 198,140
#12,28, 16,39, 21,55, 28,79 152,101, 241,186
#12,27, 15,34, 17,45, 23,61, 30,84, 198,140
#12,28, 14,49, 16,37, 21,55, 28,79, 198,140
#原anchors
#10,14, 23,27, 37,58, 81,82, 135,169, 344,319
[yolo]
mask = 3,4,5
#train anchors
#anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
#test anchors
anchors = 10,14, 23,27, 37,58, 81,82, 190,240, 500,465
classes=70
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
[route]
layers = -4
[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky
[upsample]
stride=2
[route]
layers = -1, 8
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=225
activation=linear
[yolo]
mask = 0,1,2
#train anchors
#anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
#test anchors
anchors = 10,14, 23,27, 37,58, 81,82, 190,240, 500,465
classes=70
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
lpr.names
plate
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
澳
川
鄂
甘
赣
港
贵
桂
黑
沪
吉
冀
津
晋
京
警
辽
鲁
蒙
闽
宁
青
琼
陕
苏
皖
湘
新
学
渝
豫
粤
云
浙
藏
lpr.data
classes= 70
train = ../data_lpr/voc/2019_train.txt
valid = ../data_lpr/voc/2009_val.txt
names = ../data_lpr/lpr.names
#backup = plate_0.01
backup = backup/
4. 执行
darknet.exe detector train data/lpr.data cfg/lpr.cfg
5.训练过程(以其中一次过程为例)
https://github.com/Feeyao/License-plate-recognition/blob/master/image/chart-iter_34900_42700_65000_74700_149000.png
6.测试
./darknet detector test data_lpr/lpr.data data_lpr/lpr.cfg yolov3-tiny_140000.weights /home/sun/yolo/darknet/data_lpr/voc/VOCdevkit/VOC2019/Test/苏E38MH8.jpg
summary:
yolov3识别虽然针对小目标进行了针对行的改进,但是这里的检测效果及其容易收到外界的影响,改进思路;
1.改进整个网络框架,使得yolov3变成针对小目标检测的网络,加入FPN更加深层次的网络结构。
2.仅使用yolov3做车牌检测与定位,然后针对检测区域,采用GAN网络做增强处理,再接着使用ocr识别字符,可有效的增加精度和鲁棒性。
3.。。。。。。一些思考,欢迎留言讨论。