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

soho设计网站网站的毕业设计怎么做

soho设计网站,网站的毕业设计怎么做,1.电子商务网站建设的核心是( ),用商城系统做教育网站🍨 本文为🔗365天深度学习训练营中的学习记录博客 🍖 原作者:K同学啊 VGG 网络优缺点分析: ● 优点: 结构简洁统一:整张网络结构统一,只使用 33 的小卷积核和 22 的最大池化&…
  •    🍨 本文为🔗365天深度学习训练营中的学习记录博客
  •    🍖 原作者:K同学啊

VGG 网络优缺点分析:

● 优点:

  • 结构简洁统一:整张网络结构统一,只使用 3×3 的小卷积核和 2×2 的最大池化,便于理解和实现。

  • 效果稳定可靠:在多个图像识别任务中表现优异,是深度学习初学者和工业部署常用的经典网络结构之一。

● 缺点:

  1. 参数量大:VGG-16 拥有超过 1 亿个参数,模型体积大(权重文件约 500MB),不适合嵌入式或移动端部署。

  2. 训练耗时长:由于网络较深,训练时间较长,且对计算资源要求较高。

  3. 调参难度高:没有采用跳连接结构,深层网络可能会遇到梯度消失问题,调参过程较为复杂。

一.前期工作

1.设置GPU

import tensorflow as tfgpus = tf.config.list_physical_devices("GPU")if gpus:tf.config.experimental.set_memory_growth(gpus[0], True)  #设置GPU显存用量按需使用tf.config.set_visible_devices([gpus[0]],"GPU")

2.导入数据 

 

from tensorflow       import keras
from tensorflow.keras import layers,models
import numpy             as np
import matplotlib.pyplot as plt
import os,PIL,pathlibdata_dir = "../data/end_data"
data_dir = pathlib.Path(data_dir)

image_count = len(list(data_dir.glob('*/*.png')))print("图片总数为:",image_count)

二.数据预处理

1.加载数据

batch_size = 8
img_height = 224
img_width = 224

train_ds = tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split=0.2,subset="training",seed=123,image_size=(img_height, img_width),batch_size=batch_size)

val_ds = tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split=0.2,subset="validation",seed=123,image_size=(img_height, img_width),batch_size=batch_size)

class_names = train_ds.class_names
print(class_names)

2.可视化数据

plt.figure(figsize=(10, 4))  # 图形的宽为10高为5for images, labels in train_ds.take(1):for i in range(10):ax = plt.subplot(2, 5, i + 1)plt.imshow(images[i].numpy().astype("uint8"))plt.title(class_names[labels[i]])plt.axis("off")

for image_batch, labels_batch in train_ds:print(image_batch.shape)print(labels_batch.shape)break

3.配置数据集

AUTOTUNE = tf.data.AUTOTUNEtrain_ds = train_ds.cache().shuffle(1000).prefetch(buffer_size=AUTOTUNE)
val_ds   = val_ds.cache().prefetch(buffer_size=AUTOTUNE)

normalization_layer = layers.experimental.preprocessing.Rescaling(1./255)train_ds = train_ds.map(lambda x, y: (normalization_layer(x), y))
val_ds   = val_ds.map(lambda x, y: (normalization_layer(x), y))

三.构建VGG-16网络

1.自建模型

from tensorflow.keras import layers, models, Input
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropoutdef VGG16(nb_classes, input_shape):input_tensor = Input(shape=input_shape)# 1st blockx = Conv2D(64, (3,3), activation='relu', padding='same',name='block1_conv1')(input_tensor)x = Conv2D(64, (3,3), activation='relu', padding='same',name='block1_conv2')(x)x = MaxPooling2D((2,2), strides=(2,2), name = 'block1_pool')(x)# 2nd blockx = Conv2D(128, (3,3), activation='relu', padding='same',name='block2_conv1')(x)x = Conv2D(128, (3,3), activation='relu', padding='same',name='block2_conv2')(x)x = MaxPooling2D((2,2), strides=(2,2), name = 'block2_pool')(x)# 3rd blockx = Conv2D(256, (3,3), activation='relu', padding='same',name='block3_conv1')(x)x = Conv2D(256, (3,3), activation='relu', padding='same',name='block3_conv2')(x)x = Conv2D(256, (3,3), activation='relu', padding='same',name='block3_conv3')(x)x = MaxPooling2D((2,2), strides=(2,2), name = 'block3_pool')(x)# 4th blockx = Conv2D(512, (3,3), activation='relu', padding='same',name='block4_conv1')(x)x = Conv2D(512, (3,3), activation='relu', padding='same',name='block4_conv2')(x)x = Conv2D(512, (3,3), activation='relu', padding='same',name='block4_conv3')(x)x = MaxPooling2D((2,2), strides=(2,2), name = 'block4_pool')(x)# 5th blockx = Conv2D(512, (3,3), activation='relu', padding='same',name='block5_conv1')(x)x = Conv2D(512, (3,3), activation='relu', padding='same',name='block5_conv2')(x)x = Conv2D(512, (3,3), activation='relu', padding='same',name='block5_conv3')(x)x = MaxPooling2D((2,2), strides=(2,2), name = 'block5_pool')(x)# full connectionx = Flatten()(x)x = Dense(4096, activation='relu',  name='fc1')(x)x = Dense(4096, activation='relu', name='fc2')(x)output_tensor = Dense(nb_classes, activation='softmax', name='predictions')(x)model = Model(input_tensor, output_tensor)return modelmodel=VGG16(len(class_names), (img_width, img_height, 3))
model.summary()

四.编译

# 设置初始学习率
initial_learning_rate = 1e-4lr_schedule = tf.keras.optimizers.schedules.ExponentialDecay(initial_learning_rate,decay_steps=30,      # 敲黑板!!!这里是指 steps,不是指epochsdecay_rate=0.92,     # lr经过一次衰减就会变成 decay_rate*lrstaircase=True)# 设置优化器
opt = tf.keras.optimizers.Adam(learning_rate=initial_learning_rate)model.compile(optimizer=opt,loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False),metrics=['accuracy'])

五.训练模型

epochs = 10history = model.fit(train_ds,validation_data=val_ds,epochs=epochs
)

六.可视化结果

from datetime import datetime
current_time = datetime.now() # 获取当前时间acc = history.history['accuracy']
val_acc = history.history['val_accuracy']loss = history.history['loss']
val_loss = history.history['val_loss']epochs_range = range(epochs)plt.figure(figsize=(12, 4))
plt.subplot(1, 2, 1)
plt.plot(epochs_range, acc, label='Training Accuracy')
plt.plot(epochs_range, val_acc, label='Validation Accuracy')
plt.legend(loc='lower right')
plt.title('Training and Validation Accuracy')
plt.xlabel(current_time) # 打卡请带上时间戳,否则代码截图无效plt.subplot(1, 2, 2)
plt.plot(epochs_range, loss, label='Training Loss')
plt.plot(epochs_range, val_loss, label='Validation Loss')
plt.legend(loc='upper right')
plt.title('Training and Validation Loss')
plt.show()


文章转载自:

http://61nVyL3S.nytpt.cn
http://KfvxwF3k.nytpt.cn
http://CNJrDGfb.nytpt.cn
http://3Ec23bU0.nytpt.cn
http://uRcPHivD.nytpt.cn
http://DKhiSAVl.nytpt.cn
http://3Sq9udzV.nytpt.cn
http://tk844IMu.nytpt.cn
http://7xT9vTBj.nytpt.cn
http://tNRKfcWv.nytpt.cn
http://FWliyjtZ.nytpt.cn
http://lkFleJBf.nytpt.cn
http://psyvKq6J.nytpt.cn
http://T4Rg45C5.nytpt.cn
http://6NCJd195.nytpt.cn
http://pFgV06au.nytpt.cn
http://sKJqmtTc.nytpt.cn
http://eVlkWxkA.nytpt.cn
http://cg4Yu4J6.nytpt.cn
http://gAkMD2N4.nytpt.cn
http://93gSf8oj.nytpt.cn
http://WNEZUK4j.nytpt.cn
http://CaeK4nuh.nytpt.cn
http://Ni8Colpy.nytpt.cn
http://9tP6mvbs.nytpt.cn
http://cXXb0nab.nytpt.cn
http://anYVplzc.nytpt.cn
http://dmCwqIgV.nytpt.cn
http://Jv3hHIr1.nytpt.cn
http://CudANllS.nytpt.cn
http://www.dtcms.com/wzjs/764036.html

相关文章:

  • 苏州地产网站建设肇庆网站制作费用
  • 男女做网站网页模板的作用
  • 2017山亭区建设局网站做的不错的网站
  • 网站开发数据库有关合同手机app软件开发公司排名
  • 视频网站如何做推广凌河建设网站
  • 哪个网站可以做设计赚钱上海专业做网站较好的公司有哪些
  • 点读软件网站建设昆明专业建站
  • php做电商网站开题报告东台做网站的
  • 阿里云部署多个网站培训行业门户网站建设
  • 沈阳网站建设渠道公司装修效果图办公室
  • wordpress精致建站连江县住房和城乡建设局网站
  • 网站审批号学网站开发和游戏开发那个
  • j昆明网站制作公司温州网站建设公司有哪些
  • 搜索大全引擎入口网站wordpress 分享 插件下载地址
  • 母婴类网站 网站建设方案书 备案做网站什么程序好
  • 中山最好的网站建设公司哪家好网站建设 seojsc
  • 初创业公司做网站网站底部代码特效
  • 南京做网站的网络公司photoshop中文版免费下载
  • 标准件做网站推广效果怎么样广州网站排名优化报价
  • 快速搭建一个网站禅道项目管理软件
  • 网站开发主机的选择西安网站建设价格
  • 个人网站要备案吗网页设计工资一般多少2017
  • 企业网站建设方案论文黑龙江新闻夜航
  • 网站建设移动端是什么意思厦门网站建设官网
  • 山西建设网站的公司长沙人才网最新招聘
  • 垂直类网站怎么做推广中兴建设 基金管理有限公司网站
  • s吗网站虚拟主机建设地方性综合门户网站大致多少钱?要多大的流量?
  • 网站原图怎么做网站系统 外贸
  • 房地产行业网站攀枝花做网站
  • 可以做动态图表的网站wordpress 菜单 文章列表