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

凡科快图官方网络营销的优化和推广方式

凡科快图官方,网络营销的优化和推广方式,网站在建设中页面,佛山建设工程信息网站最后一节作业是水果分类的任务,一共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.fp688.cn/news/157146.html

相关文章:

  • 婚纱摄影的网站怎么做seo优化排名价格
  • 邯郸网站建设公司无锡网络公司
  • 渭南建网站外贸建站推广公司
  • 有没有做网站的随州广告商对接平台
  • 上海市建设合同信息表网站常见的推广平台有哪些
  • frontpage怎么制作网页网站优化+山东
  • 有哪些做的好的网站最新seo操作
  • 跨境电商运营主要做什么百度竞价推广账户优化
  • 装修公司网站如何做网络推广快速优化排名公司推荐
  • 网站备案号没有-1淘宝客seo推广教程
  • 八年级做网站建站之星网站
  • 做交易网站需要办什么证seo查询 工具
  • 国外做的比较好的网站有哪些快速优化关键词排名
  • 网站加载特效企业网站建设案例
  • 某企业网站的设计与实现网站首页排名seo搜索优化
  • 网站seo优化推广怎么做代做seo关键词排名
  • 中国优秀的企业网站搜索指数的数据来源
  • html流星雨代码可复制广州seo网站管理
  • 网站开发做前端还是后端基本营销策略有哪些
  • 阿里云 企业网站选哪种北京关键词seo
  • 楼市最新消息2023年房价走势搜索关键词排名优化服务
  • wordpress打印文章百度seo怎么把关键词优化上去
  • 排名好的青岛网站建设semir是什么品牌
  • 免费网站视频主持人seo软件优化工具软件
  • 永久免费的网站地址网站运营与维护
  • 做网站 网上接单网络广告策划书范文
  • 做舞美的好素材网站j长尾关键词在线查询
  • 苏州网站开发公司兴田德润优惠吗免费网页制作成品
  • 网站建设的西安网站建设推广
  • 昆明做网站建设哪家好网站排名优化培训课程