当前位置:网站首页>Keras 模型多输出 loss weight metrics 设置
Keras 模型多输出 loss weight metrics 设置
2022-08-05 11:34:00 【为为为什么】
keras支持模型多输入多输出,本文记录多输出时loss、loss weight和metrics的设置方式。
模型输出
假设模型具有多个输出
- classify: 二维数组,分类softmax输出,需要配置交叉熵损失
- segmentation:与输入同尺寸map,sigmoid输出,需要配置二分类损失
- others:自定义其他输出,需要自定义损失
具体配置
model
- 变量均为模型中网络层
inputs = [input_1 , input_2]
outputs = [classify, segmentation, others]
model = keras.models.Model(inputs, outputs)loss
my_loss = {
'classify': 'categorical_crossentropy',\
'segmentation':'binary_crossentropy',\
'others':my_loss_fun}loss weight
my_loss_weights = {
'classify':1,\
'segmentation':1,\
'others':10}metrics
my_metrics ={
'classify':'acc',\
'segmentation':[mean_iou,'acc'],\
'others':['mse','acc']
}编译
model.compile(optimizer=Adam(lr=config.LEARNING_RATE), loss=my_loss, loss_weights= my_loss_weights, metrics= my_metrics)边栏推荐
- The fuse: OAuth 2.0 four authorized login methods must read
- 5G NR 系统消息
- 女人是这个世界上最美丽的生命
- 【深度学习】mmclassification mmcls 实战多标签分类任务教程,分类任务
- sqlserver编写通用脚本实现获取一年前日期的方法
- MMDetection in action: MMDetection training and testing
- 自定义过滤器和拦截器实现ThreadLocal线程封闭
- Machine Learning - Ensemble Learning
- WPF开发随笔收录-WriteableBitmap绘制高性能曲线图
- #yyds干货盘点#JS数组和树相互转化
猜你喜欢
随机推荐
LeetCode刷题(8)
Android 开发用 Kotlin 编程语言 二 条件控制
PostgreSQL 2022 Report: Rising popularity, open source, reliability and scaling key
如何用Golang来手写一个Blog - Milu.blog 开发总结
shell编程流程控制练习
knife4j
知乎提问:中国是否还能实现伟大民族复兴
2022技能大赛训练题:交换机snmp配置
莅临GOPS大会龙智展位,获取Forrester最新报告:《Forrester Wave:2021年第四季度企业服务管理报告》
学生信息管理系统(第一次.....)
发现C语言的乐趣
我要抓狂了。。又回到了几天不能A一道题的时候
Flink Yarn Per Job - JobManger 申请 Slot
Google启动通用图像嵌入挑战赛
结合“xPlus”探讨软件架构的创新与变革
How about Ping An Mengwa Card Insurance?Let parents read a few ways to identify products
sqlserver编写通用脚本实现获取一年前日期的方法
Http-Sumggling Cache Vulnerability Analysis
金融业“限薪令”出台/ 软银出售过半阿里持仓/ DeepMind新实验室成立... 今日更多新鲜事在此...
图像分割模型——segmentation_models_pytorch和albumentations 组合实现多类别分割








