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

正能量不良网站直接进入免费上海整站seo

正能量不良网站直接进入免费,上海整站seo,广西区党风廉洁建设网站,怎么看商标有没有注册最后一节作业是水果分类的任务,一共6类,使用之前学习的知识在代码段上进行填空。 加载ImageNet预训练的基础模型 from tensorflow import kerasbase_model keras.applications.VGG16(weights"imagenet",input_shape(224, 224, 3),include_t…

最后一节作业是水果分类的任务,一共6类,使用之前学习的知识在代码段上进行填空。
在这里插入图片描述
加载ImageNet预训练的基础模型

from tensorflow import kerasbase_model = keras.applications.VGG16(weights="imagenet",input_shape=(224, 224, 3),include_top=False)

冻结基础模型

# Freeze base model
base_model.trainable = False

向模型添加新层

# Create inputs with correct shape
inputs = keras.Input(shape=(224, 224, 3))x = base_model(inputs, training=False)# Add pooling layer or flatten layer
x = keras.layers.GlobalAveragePooling2D()(x)# Add final dense layer
outputs = keras.layers.Dense(6, activation = 'softmax')(x)# Combine inputs and outputs to create model
model = keras.Model(inputs, outputs)
model.summary()

编译模型

model.compile(loss='categorical_crossentropy', optimizer='adam',  metrics=['accuracy'])

扩充数据

from tensorflow.keras.preprocessing.image import ImageDataGeneratordatagen_train = ImageDataGenerator(featurewise_center=True,  # set input mean to 0 over the datasetsamplewise_center=True,  # set each sample mean to 0rotation_range=10,  # randomly rotate images in the range (degrees, 0 to 180)zoom_range = 0.1, # Randomly zoom image width_shift_range=0.1,  # randomly shift images horizontally (fraction of total width)height_shift_range=0.1,  # randomly shift images vertically (fraction of total height)horizontal_flip=True,  # randomly flip imagesvertical_flip=False)
datagen_valid = ImageDataGenerator(featurewise_center=True,  # set input mean to 0 over the datasetsamplewise_center=True,  # set each sample mean to 0rotation_range=10,  # randomly rotate images in the range (degrees, 0 to 180)zoom_range = 0.1, # Randomly zoom image width_shift_range=0.1,  # randomly shift images horizontally (fraction of total width)height_shift_range=0.1,  # randomly shift images vertically (fraction of total height)horizontal_flip=True,  # randomly flip imagesvertical_flip=False)

加载数据集

# load and iterate training dataset
train_it = datagen_train.flow_from_directory("data/fruits/train", target_size=(224, 224), color_mode="rgb",class_mode="categorical",
)# load and iterate validation dataset
valid_it = datagen_valid.flow_from_directory("data/fruits/valid",                                     target_size=(224, 224), color_mode="rgb",class_mode="categorical",
)

训练模型
现在开始训练模型!将训练和测试数据集传递给fit函数,并设置所需的训练次数(epochs)


model.fit(train_it,validation_data=valid_it,steps_per_epoch=train_it.samples/train_it.batch_size,validation_steps=valid_it.samples/valid_it.batch_size,epochs=10)

在这里插入图片描述
其实到这里已经满足了评估需求,达到了92%以上的准确率
所以可以不进行微调的部分,直接运行后边的代码
在这里插入图片描述
就可以生成证书了

http://www.hkea.cn/news/914861/

相关文章:

  • 自己做网站是否要买云主机西安百度提升优化
  • 成都注册公司哪个区好分析网站推广和优化的原因
  • 模板建站杭州seo泽成
  • 济南网站建设公司川芎网络怎么注册自己的网址
  • linux下安装wordpress关键词优化排名查询
  • wordpress手机网站怎么做中央电视台一套广告价目表
  • 百家号如何给网站做推广推广方案是什么
  • 西安三网合一网站建设产品线上推广方案
  • 2023年免费b站入口百度网站优化
  • 响应式网站建设有利于seo网站发布与推广方案
  • 网页制作教程课件seo推广排名重要吗
  • 小规模纳税人企业所得税怎么征收广州seo招聘
  • 济南企业自助建站网络营销策划公司
  • iis 新建网站 要登录温州seo推广外包
  • 个人想做企业网站备案惠州seo代理商
  • 做公务员题的网站口红的推广软文
  • 福州网站建设 联系yanktcn 04上海百网优seo优化公司
  • 网站备案号如何获得网站建设营销推广
  • 物流网站开发公司西安 做网站
  • 商务信息网站怎么做网络视频营销策略有哪些
  • 社交做的最好的网站怎么开发一个网站
  • 教育品牌网站建设百度搜索推广和信息流推广
  • 虎门专业做网站对网络营销的认识有哪些
  • 投资理财培训网站建设抖音引流推广一个30元
  • 做景观设施的网站网络营销推广要求
  • 携程网站建设进度及实施过程网络营销的缺点及建议
  • 石家庄网站建设哪家专业中国联通腾讯
  • 能访问各种网站的浏览器百度一下网页搜索
  • 自己做网站花多少钱雅虎搜索
  • 哈尔滨招标信息网网站推广优化排名教程