使用深度學(xué)習(xí)進(jìn)行自動(dòng)車牌檢測(cè)和識(shí)別
時(shí)間:2021-10-14 17:06:32
手機(jī)看文章
掃描二維碼
隨時(shí)隨地手機(jī)看文章
[導(dǎo)讀]作者|小白來(lái)源|小白學(xué)視覺(jué)介紹在現(xiàn)代世界的不同方面,信息技術(shù)的大規(guī)模集成導(dǎo)致了將車輛視為信息系統(tǒng)中的概念資源。由于沒(méi)有任何數(shù)據(jù),自主信息系統(tǒng)就沒(méi)有任何意義,因此需要在現(xiàn)實(shí)和信息系統(tǒng)之間改革車輛信息。這可以通過(guò)人工代理或特殊智能設(shè)備實(shí)現(xiàn),這些設(shè)備將允許在真實(shí)環(huán)境中通過(guò)車輛牌照識(shí)別車...

在現(xiàn)代世界的不同方面,信息技術(shù)的大規(guī)模集成導(dǎo)致了將車輛視為信息系統(tǒng)中的概念資源。由于沒(méi)有任何數(shù)據(jù),自主信息系統(tǒng)就沒(méi)有任何意義,因此需要在現(xiàn)實(shí)和信息系統(tǒng)之間改革車輛信息。這可以通過(guò)人工代理或特殊智能設(shè)備實(shí)現(xiàn),這些設(shè)備將允許在真實(shí)環(huán)境中通過(guò)車輛牌照識(shí)別車輛。在智能設(shè)備中,,提到了車輛牌照檢測(cè)和識(shí)別系統(tǒng)。車輛牌照檢測(cè)和識(shí)別系統(tǒng)用于檢測(cè)車牌,然后識(shí)別車牌,即從圖像中提取文本,所有這一切都?xì)w功于使用定位算法的計(jì)算模塊,車牌分割和字符識(shí)別。車牌檢測(cè)和讀取是一種智能系統(tǒng),由于其在以下幾個(gè)領(lǐng)域的潛在應(yīng)用,因此具有相當(dāng)大的潛力:
1.指揮部隊(duì):該系統(tǒng)用于檢測(cè)被盜和搜查的車輛,將檢測(cè)到的車牌與報(bào)告車輛的車牌進(jìn)行比較。2.道路安全:該系統(tǒng)用于檢測(cè)超過(guò)一定速度的車牌,將車牌讀取系統(tǒng)與道路雷達(dá)耦合。3.停車管理:車輛進(jìn)出口的管理。
step1:車牌檢測(cè)
為了檢測(cè)許可證,我們將使用基于卷積神經(jīng)網(wǎng)絡(luò)的Yolo(You Only Look One)深度學(xué)習(xí)對(duì)象檢測(cè)體系結(jié)構(gòu)。該體系結(jié)構(gòu)是由Joseph Redmon、Ali Farhadi、Ross Girshick和Santosh Divvala于2015年推出的第一個(gè)版本,以及更高版本2和3。
論文鏈接:
Yolo v1:https://arxiv.org/pdf/1506.02640.pdfYolo v2:https://arxiv.org/pdf/1612.08242.pdfYolo v3:https://arxiv.org/pdf/1804.02767.pdf
Yolo是一個(gè)經(jīng)過(guò)端到端訓(xùn)練的單一網(wǎng)絡(luò),用于執(zhí)行預(yù)測(cè)對(duì)象邊界框和對(duì)象類的回歸任務(wù)。這個(gè)網(wǎng)絡(luò)速度非常快,它以每秒45幀的速度實(shí)時(shí)處理圖像。一個(gè)較小的網(wǎng)絡(luò)版本Fast YOLO每秒處理155幀,速度驚人。
實(shí)現(xiàn)YOLO V3:首先,我們準(zhǔn)備了一個(gè)由700張包含突尼斯車牌的汽車圖像組成的數(shù)據(jù)集,對(duì)于每張圖像,我們使用一個(gè)名為L(zhǎng)abelImg的桌面應(yīng)用程序創(chuàng)建一個(gè)xml文件(之后更改為文本文件,其中包含與Darknet配置文件輸入兼容的坐標(biāo)。Darknet:project用于重新培訓(xùn)YOLO預(yù)訓(xùn)練模型)。
# First download Darknet project
$ git clone https://github.com/pjreddie/darknet.git
# in "darknet/Makefile" put affect 1 to OpenCV, CUDNN and GPU if you # want to train with you GPU then time thos two commands
$ cd darknet
$ make
# Load convert.py to change labels (xml files) into the appropriate # format that darknet understand and past it under darknet/
https://github.com/GuiltyNeuron/ANPR
# Unzip the dataset
$ unzip dataset.zip
# Create two folders, one for the images and the other for labels
$ mkdir darknet/images
$ mkdir darknet/labels
# Convert labels format and create files with location of images
# for the test and the training
$ python convert.py
# Create a folder under darknet/ that will contain your data
$ mkdir darknet/custom
# Move files train.txt and test.txt that contains data path to
# custom folder
$ mv train.txt custom/
$ mv test.txt custom/
# Create file to put licence plate class name "LP"
$ touch darknet/custom/classes.names
$ echo LP > classes.names
# Create Backup folder to save weights
$ mkdir custom/weights
# Create a file contains information about data and cfg
# files locations
$ touch darknet/custom/darknet.data
# in darknet/custom/darknet.data file paste those informations
classes = 1
train = custom/train.txt
valid = custom/test.txt
names = custom/classes.names
backup = custom/weights/
# Copy and paste yolo config file in "darknet/custom"
$ cp darknet/cfg/yolov3.cfg darknet/custom
# Open yolov3.cfg and change :
# " filters=(classes 5)*3" just the ones before "Yolo"
# in our case classes=1, so filters=18
# change classes=... to classes=1
# Download pretrained model
$ wget https://pjreddie.com/media/files/darknet53.conv.74 -O ~/darknet/darknet53.conv.74
# Let's train our model !!!!!!!!!!!!!!!!!!!!!
$ ./darknet detector train custom/darknet.data custom/yolov3.cfg darknet53.conv.74
完成訓(xùn)練后,要從圖像中檢測(cè)發(fā)光板,請(qǐng)從darknet/custom/weights中選擇最新的模型,并將其路徑或名稱放入object_detection_yolo.py文件中,我們還將使用yolov3.cfg文件,僅在該文件中,在訓(xùn)練前放入,以便我們可以先刪除訓(xùn)練,然后運(yùn)行:python object-detection_yolo.py --image= image.jpg
運(yùn)行結(jié)果:
Step2:車牌檢測(cè)
現(xiàn)在我們必須分段我們的車牌號(hào),輸入是板的圖像,我們必須能夠提取單字符圖像。這一步驟的結(jié)果作為識(shí)別階段的輸入非常重要。在自動(dòng)讀取車牌的系統(tǒng)中。分割是車牌自動(dòng)識(shí)別最重要的過(guò)程之一,因?yàn)槿魏纹渌襟E都是基于分割的。如果分割失敗,識(shí)別階段將不正確。為確保正確分割,必須執(zhí)行初步處理。


Step3:車牌識(shí)別
識(shí)別階段是自動(dòng)車牌閱讀器系統(tǒng)開(kāi)發(fā)的最后一步。因此,它關(guān)閉圖像采集過(guò)程中經(jīng)過(guò)的所有過(guò)程,然后是板的位置,直到分割。識(shí)別必須從分割階段結(jié)束時(shí)獲得的圖像中提取字符。用于此識(shí)別的學(xué)習(xí)模型必須能夠讀取圖像并渲染相應(yīng)的字符。
為了最大限度地利用可用于學(xué)習(xí)的數(shù)據(jù),我們?cè)趹?yīng)用車牌分割之前使用的相同圖像處理步驟后,通過(guò)在正方形中調(diào)整每個(gè)字符的大小來(lái)單獨(dú)切割每個(gè)字符。結(jié)果,我們獲得了一組由11個(gè)類組成的數(shù)據(jù),對(duì)于每個(gè)類,我們有30-40張28X28像素尺寸的PNG格式的圖像;從0到9的數(shù)字和阿拉伯語(yǔ)單詞(突尼斯)。
然后,我們?cè)诳茖W(xué)論文的基礎(chǔ)上對(duì)多層感知器(MLP)和分類器K近鄰(KNN)進(jìn)行了比較研究。結(jié)果我們發(fā)現(xiàn):如果使用MLP分類器時(shí)隱層神經(jīng)元的數(shù)量也增加,并且如果使用KNN時(shí)最近鄰數(shù)也增加,則性能會(huì)提高。在這里,調(diào)整k-NN分類器性能的能力非常有限。但是,可調(diào)整的隱藏層數(shù)量和可調(diào)整的MLP連接權(quán)重為細(xì)化決策區(qū)域提供了更大的機(jī)會(huì)。因此,我們將在此階段選擇多層感知器。



機(jī)器人越像人越好?資訊機(jī)器人能幫助縫制T恤嗎?



