由于该项目是针对中小学生竞赛并且是第一次举行,所以识别的目标交通标志仅仅只有直行、右转、左转和停车让行。
数据集:https://pan.baidu.com/s/1sLl0CadEutv3PQXhmqpCXw 提取码:mp2x
源代码:https://github.com/ccxiao5/Traffic_sign_recognition
整体流程如下:
数据集收集(包括训练集和测试集的分类)
图像预处理
图像标注
根据标注分割得到目标图像
HOG特征提取
训练得到模型
将模型带入识别算法进行识别
我的数据目录树。其中test_images/train_images是收集得到原始数据集。realTest/realTrain是预处理后的图像。dataTest/dataTrain是经过分类处理得到的图像,HogTest/HogTrain是通过XML标注后裁剪得到的图像。HogTest_affine/HogTrain_affine是经过仿射变换处理扩充的训练集和测试集。imgTest_hog.txt/imgTrain_hog.txt是测试集和训练集的Hog特征
一、图像处理
由于得到的数据集图像大小不一(如下),我们首先从中心区域裁剪并调整正方形图像的大小,然后将处理后的图像保存到realTrain和realTest里面。
图片名称对应关系如下:
img_label ={"000":"Speed_limit_5","001":"Speed_limit_15","002":"Speed_limit_30","003":"Speed_limit_40","004":"Speed_limit_50","005":"Speed_limit_60","006":"Speed_limit_70","007":"Speed_limit_80","008":"No straight or right turn","009":"No straight or left turn","010":"No straight","011":"No left turn","012":"Do not turn left and right","013":"No right turn","014":"No Overhead","015":"No U-turn","016":"No Motor vehicle","017":"No whistle","018":"Unrestricted speed_40","019":"Unrestricted speed_50","020":"Straight or turn right","021":"Straight","022":"Turn left","023":"Turn left or turn right","024":"Turn right","025":"Drive on the left side of the road","026":"Drive on the right side of the road","027":"Driving around the island","028":"Motor vehicle driving","029":"Whistle","030":"Non-motorized","031":"U-turn","032":"Left-right detour","033":"traffic light","034":"Drive cautiously","035":"Caution Pedestrians","036":"Attention non-motor vehicle","037":"Mind the children","038":"Sharp turn to the right","039":"Sharp turn to the left","040":"Downhill steep slope","041":"Uphill steep slope","042":"Go slow","044":"Right T-shaped cross","043":"Left T-shaped cross","045":"villa