【问题标题】:CNN Semantic segmentation network (UNET) performing poorly when tested with imagesCNN 语义分割网络 (UNET) 在用图像进行测试时表现不佳
【发布时间】:2020-07-12 12:18:48
【问题描述】:

我正在构建一个 UNET 语义分割网络,以检测眼睛图像中的虹膜,我们使用 DICE 损失函数,我们实现了超过 90% 的训练平均 IOU 和大约 87% 的验证数据,但验证损失和平均 IOU在 200 个 epoch 中显示出波动,当我们测试我们的网络时,它显示出非常糟糕的结果,即使我们使用来自训练集的图像,输出图像也没有接近真实情况,它仍然表现不佳,任何关于我们可以做什么的建议克服这一点。

【问题讨论】:

标签: python keras computer-vision


【解决方案1】:

数据集是公开的吗?你可以在这里找到一些很好的资源和指导:https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow2/Segmentation/UNet_Medical 你还会发现基准测试结果。我认为他们是使用 0.0001 学习率的 ADAM 优化器。培训过程部分中的更多详细信息。

【讨论】:

  • 我们用 0.0001 的学习率进行了测试,但它给了我们非常糟糕的结果,即使 mean_iou 很高
【解决方案2】:

您的 DSC 损失实现是什么样的?你使用的激活函数是什么?我个人使用过:

def dice_coef(y_true, y_pred, smooth=1e-3):
    y_true_f = K.flatten(y_true)
    y_pred_f = K.flatten(y_pred)
    intersection = K.sum(y_true_f * y_pred_f)
    dice = (2. * intersection + smooth) / (K.sum(y_true_f) + K.sum(y_pred_f) + smooth)
    return dice

def dice_coef_loss(y_true, y_pred):
    return 1 - dice_coef(y_true, y_pred)

作为几个 U-Net 分割架构中的损失函数和度量,以及 sigmoid 作为激活函数(假设它是一个二元分类问题)。此外,如果您正在针对 IOU 进行优化,您可能希望将损失更改为 IOU 损失 - 类似于以下内容:

def iou(y_true, y_pred, smooth=1e-3):
    intersection = K.sum(K.abs(y_true * y_pred), axis=-1)
    union = K.sum((y_true,-1) + K.sum(y_pred,-1) - intersection
    return (intersection + smooth) / ( union + smooth)

def iou_loss(y_true, y_pred):
    return -iou_coef(y_true, y_pred)

希望这会有所帮助!

【讨论】:

  • 这是我用于骰子的:def dice_coeff(y_true, y_pred, smooth=1): intersection = k.sum(k.abs(y_true * y_pred), axis=-1) return (2. * 交点 + 平滑) / (k.sum(k.square(y_true),-1) + k.sum(k.square(y_pred),-1) + 平滑) def dice_loss(y_true, y_pred): return 1-dice_coeff(y_true, y_pred) 所以你认为我应该使用 mean_IOU 作为损失函数和度量
  • 是的 - 如果您想针对 IOU 进行优化,那么您的模型将配置一个基于 IOU 的损失函数是有意义的。是多类分割问题还是二元类?
  • 这是一个二元类问题
  • 还有可能是网络太深了,我们也在用dropouts和batchnorm,你觉得还有哪些参数可以调整
猜你喜欢
  • 1970-01-01
  • 2020-05-03
  • 2019-01-31
  • 2020-04-08
  • 2015-05-22
  • 2018-12-22
  • 2018-05-18
  • 2018-07-25
  • 1970-01-01
相关资源
最近更新 更多