当前位置: 首页 > news >正文

企业网站开发介绍关键词优化怎么优化

企业网站开发介绍,关键词优化怎么优化,宁波个人做网站,dreamwaver做网站温馨提示:文末有 CSDN 平台官方提供的学长 QQ 名片 :) 1. 项目简介 本文详细探讨了一基于深度学习的交通标志图像识别系统。采用TensorFlow和Keras框架,利用卷积神经网络(CNN)进行模型训练和预测,并引入VGG16迁移学习…

温馨提示:文末有 CSDN 平台官方提供的学长 QQ 名片 :) 

1. 项目简介

        本文详细探讨了一基于深度学习的交通标志图像识别系统。采用TensorFlow和Keras框架,利用卷积神经网络(CNN)进行模型训练和预测,并引入VGG16迁移学习模型,取得96%的高准确率。通过搭建Web系统,用户能上传交通标志图片,系统实现了自动实时的交通标志分类识别。该系统不仅展示了深度学习在交通领域的实际应用,同时为用户提供了一种高效、准确的交通标志识别服务。

2. 交通标志数据集读取

        数据集里面的图像具有不同大小,光照条件,遮挡情况下的43种不同交通标志符号,图像的成像情况与你实际在真实环境中不同时间路边开车走路时看到的交通标志的情形非常相似。训练集包括大约39,000个图像,而测试集大约有12,000个图像。图像不能保证是固定 的尺寸,标志不一定在每个图像中都是居中。每个图像包含实际交通标志周围10%左右的边界。

folders = os.listdir(train_path)train_number = []
class_num = []for folder in folders:train_files = os.listdir(train_path + '/' + folder)train_number.append(len(train_files))class_num.append(classes[int(folder)])# 不同类别交通标志数量,并进行排序
zipped_lists = zip(train_number, class_num)
sorted_pairs = sorted(zipped_lists)
tuples = zip(*sorted_pairs)
train_number, class_num = [ list(t) for t in  tuples]# 绘制不同类别交通标志数量分布柱状图
plt.figure(figsize=(21,10))  
plt.bar(class_num, train_number)
plt.xticks(class_num, rotation='vertical', fontsize=16)
plt.title('不同类别交通标志数量分布柱状图', fontsize=20)
plt.show()

         划分训练集、验证集:

X_train, X_val, y_train, y_val = train_test_split(image_data, image_labels, test_size=0.3, random_state=42, shuffle=True)X_train = X_train/255 
X_val = X_val/255print("X_train.shape", X_train.shape)
print("X_valid.shape", X_val.shape)
print("y_train.shape", y_train.shape)
print("y_valid.shape", y_val.shape)

        类别标签进行 One-hot 编码:

y_train = keras.utils.to_categorical(y_train, NUM_CATEGORIES)
y_val = keras.utils.to_categorical(y_val, NUM_CATEGORIES)print(y_train.shape)
print(y_val.shape)

3. 卷积神经网络模型构建

model = keras.models.Sequential([    keras.layers.Conv2D(filters=16, kernel_size=(3,3), activation='relu', input_shape=(IMG_HEIGHT,IMG_WIDTH,channels)),keras.layers.Conv2D(filters=32, kernel_size=(3,3), activation='relu'),# ......keras.layers.Conv2D(filters=64, kernel_size=(3,3), activation='relu'),# ......keras.layers.Flatten(),keras.layers.Dense(512, activation='relu'),keras.layers.BatchNormalization(),keras.layers.Dropout(rate=0.5),keras.layers.Dense(43, activation='softmax')
])

4. 模型训练与性能评估

        设置模型训练参数:

epochs = 20initial_learning_rate = 5e-5lr_schedule = tf.keras.optimizers.schedules.ExponentialDecay(initial_learning_rate, #设置初始学习率decay_steps=64,      #每隔多少个step衰减一次decay_rate=0.98,     #衰减系数staircase=True)# 将指数衰减学习率送入优化器
optimizer = tf.keras.optimizers.Adam(learning_rate=lr_schedule)model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])history = model.fit(X_train, y_train, batch_size=32, epochs=epochs, validation_data=(X_val, y_val))

        加载测试集进行模型评估: 

# 计算测试集准确率
pred = model.predict(X_test)
pred_labels = np.argmax(pred, 1)print('测试集准确率: ',accuracy_score(labels, pred_labels)*100)
测试集准确率:  93.24623911322249

5. 基于迁移学习的交通标志识别

from tensorflow.keras.applications import VGG16height = 32
width = 32vgg_base_model = VGG16(weights='imagenet', include_top=False, input_shape=(height,width,3))
vgg_base_model.trainable=Truevgg_model = tf.keras.Sequential([vgg_base_model,keras.layers.BatchNormalization(),keras.layers.Flatten(),keras.layers.Dense(512, activation='relu'),keras.layers.BatchNormalization(),keras.layers.Dropout(rate=0.5),keras.layers.Dense(43, activation='softmax')])vgg_model.summary()

Epoch 1/20
858/858 [==============================] - ETA: 0s - loss: 0.9774 - accuracy: 0.7366
Epoch 1: val_accuracy improved from -inf to 0.94806, saving model to best_model.h5
858/858 [==============================] - 334s 387ms/step - loss: 0.9774 - accuracy: 0.7366 - val_loss: 0.1651 - val_accuracy: 0.9481
Epoch 2/20
858/858 [==============================] - ETA: 0s - loss: 0.0737 - accuracy: 0.9804
Epoch 2: val_accuracy improved from 0.94806 to 0.97866, saving model to best_model.h5
858/858 [==============================] - 350s 408ms/step - loss: 0.0737 - accuracy: 0.9804 - val_loss: 0.0750 - val_accuracy: 0.9787
Epoch 3/20
858/858 [==============================] - ETA: 0s - loss: 0.0274 - accuracy: 0.9926
Epoch 3: val_accuracy improved from 0.97866 to 0.98266, saving model to best_model.h5
858/858 [==============================] - 351s 409ms/step - loss: 0.0274 - accuracy: 0.9926 - val_loss: 0.0681 - val_accuracy: 0.9827
Epoch 4/20
858/858 [==============================] - ETA: 0s - loss: 0.0197 - accuracy: 0.9946
Epoch 4: val_accuracy improved from 0.98266 to 0.99779, saving model to best_model.h5
858/858 [==============================] - 339s 395ms/step - loss: 0.0197 - accuracy: 0.9946 - val_loss: 0.0085 - val_accuracy: 0.9978
Epoch 5/20
858/858 [==============================] - ETA: 0s - loss: 0.0081 - accuracy: 0.9982
Epoch 5: val_accuracy improved from 0.99779 to 0.99830, saving model to best_model.h5
858/858 [==============================] - 364s 424ms/step - loss: 0.0081 - accuracy: 0.9982 - val_loss: 0.0067 - val_accuracy: 0.9983
Epoch 6/20
858/858 [==============================] - ETA: 0s - loss: 0.0025 - accuracy: 0.9995
Epoch 6: val_accuracy improved from 0.99830 to 0.99855, saving model to best_model.h5
858/858 [==============================] - 354s 413ms/step - loss: 0.0025 - accuracy: 0.9995 - val_loss: 0.0053 - val_accuracy: 0.9986
Epoch 7/20
858/858 [==============================] - ETA: 0s - loss: 0.0030 - accuracy: 0.9992
Epoch 7: val_accuracy did not improve from 0.99855
858/858 [==============================] - 333s 389ms/step - loss: 0.0030 - accuracy: 0.9992 - val_loss: 0.0126 - val_accuracy: 0.9969
Epoch 7: early stopping 

         模型评估:

# 计算测试集准确率
pred = vgg_model.predict(X_test)
pred_labels = np.argmax(pred, 1)print('测试集准确率: ',accuracy_score(labels, pred_labels)*100)

         测试集准确率: 96.02533650039588

6. 测试集预测结果可视化

plt.figure(figsize = (25, 25))start_index = 0
for i in range(25):plt.subplot(5, 5, i + 1)plt.grid(False)plt.xticks([])plt.yticks([])prediction = pred_labels[start_index + i]actual = labels[start_index + i]col = 'g'if prediction != actual:col = 'r'plt.xlabel('实际类别:{}\n预测类别:{}'.format(classes[actual], classes[prediction]), color = col, fontsize=18)plt.imshow(X_test[start_index + i])
plt.show()

7. 交通标志分类识别系统

7.1 首页

7.2 交通标志在线识别

8. 结论

        本文详细探讨了一基于深度学习的交通标志图像识别系统。采用TensorFlow和Keras框架,利用卷积神经网络(CNN)进行模型训练和预测,并引入VGG16迁移学习模型,取得96%的高准确率。通过搭建Web系统,用户能上传交通标志图片,系统实现了自动实时的交通标志分类识别。该系统不仅展示了深度学习在交通领域的实际应用,同时为用户提供了一种高效、准确的交通标志识别服务。

欢迎大家点赞、收藏、关注、评论啦 ,由于篇幅有限,只展示了部分核心代码。技术交流、源码获取认准下方 CSDN 官方提供的学长 QQ 名片 :)

精彩专栏推荐订阅:

1. Python数据挖掘精品实战案例

2. 计算机视觉 CV 精品实战案例

3. 自然语言处理 NLP 精品实战案例

http://www.zhongyajixie.com/news/36252.html

相关文章:

  • 做网站用什么开发语言seo优化教程下载
  • 网站单页模板下载百度竞价关键词查询
  • 苹果app如何做ppt模板下载网站宁波seo排名优化哪家好
  • 商用自适应网站建设郑州厉害的seo优化顾问
  • 佛山门户网站建设如何优化关键词搜索排名
  • phpcms 网站打不开网络软文营销的案例
  • 网站建设公司成都重庆森林经典台词 凤梨罐头
  • 网页浏览器如何放大关键词排名优化如何
  • wordpress 访问速度正安县网站seo优化排名
  • 网站建设面试题互联网品牌的快速推广
  • 手机微网站第二年续费吗2024年疫情还会封控吗
  • 网站建设公司是什么金华seo扣费
  • 网站界面要素广州网络营销选择
  • 贵州城乡建设厅官网如何做网站搜索引擎优化
  • 做二手的网站有哪些站长seo推广
  • 响水做网站的网络营销技巧
  • 合肥做网站工作室深圳互联网公司排行榜
  • 网站 可以做无形资产吗品牌推广的三个阶段
  • 网站做优化有效吗移动营销
  • 做网站大型引流推广方案
  • 如何自己做直播网站营销技巧第三季
  • 做更好的自己 网站seo优化 搜 盈seo公司
  • 广州化妆品网站建设公司排名免费建网站的步骤
  • 中山市做网站实力网店产品seo如何优化
  • 北京公司网站制作费用男生最喜欢的浏览器
  • 岳池住房和城乡建设厅网站网站seo设计方案案例
  • 网站客服系统源码seo型网站
  • 便宜的网站空间网络工具
  • 新手做淘宝哪个网站比较好关键字
  • 大良制作网站湖北seo整站优化