© 1999-2048 dssz.net 粤ICP备11031372号
[其它] pytorch实现focal loss的两种方式小结
说明:我就废话不多说了,直接上代码吧! import torch import torch.nn.functional as F import numpy as np from torch.autograd import Variable ''' pytorch实现focal loss的两种方式(现在讨论的是基于分割任务) 在计算损失函数的过程中考虑到类别不平衡的问题,假设加上背景类别共有6个类别 ''' def compute_class_weights(histogram): classWe<weixin_38593723> 上传 | 大小:49kb