国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Opencv交通標(biāo)志識(shí)別

這篇具有很好參考價(jià)值的文章主要介紹了Opencv交通標(biāo)志識(shí)別。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

前言

本文使用的數(shù)據(jù)集包含43種交通標(biāo)志,使用opencv以及卷積神經(jīng)網(wǎng)絡(luò)訓(xùn)練模型,識(shí)別交通標(biāo)志,使用pyqt5制作交通標(biāo)志識(shí)別GUI的界面。

效果預(yù)覽

如視頻中所示,可以選擇交通標(biāo)志,然后可以進(jìn)行圖像預(yù)處理操作,如灰度化,邊緣檢測(cè)等,最后可以點(diǎn)擊識(shí)別按鈕進(jìn)行識(shí)別。

交通標(biāo)志識(shí)別

數(shù)據(jù)集下載地址

數(shù)據(jù)集中共包含43種交通標(biāo)志!
數(shù)據(jù)集下載地址:https://pan.baidu.com/wap/init?surl=5v14ieSPZntBTDzKVckEgA
提取碼:39q4

訓(xùn)練模型

下面是訓(xùn)練模型的代碼文章來源地址http://www.zghlxwxcb.cn/news/detail-509897.html

import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import Adam
from tensorflow.python.keras.utils.np_utils import to_categorical
from tensorflow.keras.layers import Dropout, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
import cv2
from sklearn.model_selection import train_test_split
import pickle
import os
import pandas as pd
import random
from tensorflow.keras.preprocessing.image import ImageDataGenerator
################# Parameters #####################

path = "./data/myData"  # folder with all the class folders
labelFile = './data/labels.csv'  # file with all names of classes
batch_size_val = 50  # how many to process together
steps_per_epoch_val = 446  # 迭代次數(shù)
epochs_val = 10  # 整個(gè)訓(xùn)練集訓(xùn)練次數(shù)
imageDimesions = (32, 32, 3)  # 32*32的彩色圖
testRatio = 0.2  # if 1000 images split will 200 for testing 測(cè)試集占比
validationRatio = 0.2  # if 1000 images 20% of remaining 800 will be 160 for validation 驗(yàn)證機(jī)占比
###################################################


############################### Importing of the Images 加載圖像與標(biāo)簽
count = 0
images = []
classNo = []
myList = os.listdir(path)
print("Total Classes Detected:", len(myList))
noOfClasses = len(myList)
print("Importing Classes.....")
for x in range(0, len(myList)):
    myPicList = os.listdir(path + "/" + str(count))
    for y in myPicList:
        curImg = cv2.imread(path + "/" + str(count) + "/" + y)
        images.append(curImg)
        classNo.append(count)
    print(count, end=" ")
    count += 1
print(" ")
# 存著對(duì)應(yīng)的圖片信息和標(biāo)簽
images = np.array(images)
classNo = np.array(classNo)

############################### Split Data 分割test集和驗(yàn)證集
X_train, X_test, y_train, y_test = train_test_split(images, classNo, test_size=testRatio)
X_train, X_validation, y_train, y_validation = train_test_split(X_train, y_train, test_size=validationRatio)

# X_train = ARRAY OF IMAGES TO TRAIN
# y_train = CORRESPONDING CLASS ID

############################### TO CHECK IF NUMBER OF IMAGES MATCHES TO NUMBER OF LABELS FOR EACH DATA SET
print("Data Shapes")
print("Train", end="");
print(X_train.shape, y_train.shape)
print("Validation", end="");
print(X_validation.shape, y_validation.shape)
print("Test", end="");
print(X_test.shape, y_test.shape)
assert (X_train.shape[0] == y_train.shape[
    0]), "The number of images in not equal to the number of lables in training set"
assert (X_validation.shape[0] == y_validation.shape[
    0]), "The number of images in not equal to the number of lables in validation set"
assert (X_test.shape[0] == y_test.shape[0]), "The number of images in not equal to the number of lables in test set"
assert (X_train.shape[1:] == (imageDimesions

到了這里,關(guān)于Opencv交通標(biāo)志識(shí)別的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包