mAP随着训练张量流对象检测SSD而减少 [英] mAP decreasing with training tensorflow object detection SSD

查看:182
本文介绍了mAP随着训练张量流对象检测SSD而减少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试训练一个 SSD mobilenet 检测器,用于检测显微图像中的细胞核.我在 Ubuntu 16.04 上使用 tensorflow 对象检测 API 和 tensorflow(版本 1.4)的 GPU 实现.我的输入图像是带有注释细胞核的 256x256 RGB jpg 图块.

I'm trying to train a SSD mobilenet detector for detecting cell nuclei in microscopic images. I'm using the tensorflow object detection API on Ubuntu 16.04 with the GPU implementation of tensorflow (version 1.4). My input images are 256x256 RGB jpg tiles with annotated cell nuclei.

当我开始训练时,我看到 mAP 有很大的增加,并且在大约 6k 全局步长(批量大小 12)时,我可以检测到大多数细胞核,但对同一细胞核进行了一些多次检测.

When I start training I see a nice increase in mAP and at about 6k global steps (batch size 12) I can detect most cell nuclei, but with some multiple detections of the same cell nuclei.

奇怪的是,在这一点之后,mAP 开始下降,即使 TotalLoss 继续下降,模型检测到的细胞核也越来越少.在 100k 步时,几乎没有检测到原子核.

Weirdly, after this point mAP starts decreasing and the model detects less and less cell nuclei even though the TotalLoss continues to decrease. At 100k steps, almost no nuclei are detected.

我使用 SSD 的标准配置文件,但我降低了匹配/不匹配框的截止值.如果我不使用这种修改,模型将难以检测任何细胞核,因为它们是小物体,并且与它们重叠的框太少.

I use the standard config file for SSD except that I've decreased the cutoff for matched/unmatched boxes. If I don't use this modification the model has difficulties detecting any cell nuclei because they are smallish objects and too few boxes overlap them.

matcher {
  argmax_matcher {
    matched_threshold: 0.3
    unmatched_threshold: 0.3
    ignore_thresholds: false
    negatives_lower_than_unmatched: true
    force_match_for_each_row: true
  }

为什么尽管 TotalLoss 有所提高,但 mAP 和检测准确度会随着时间的推移而降低?我对结果的直觉是,检测模型越来越准确(从来没有误报),但敏感度越来越低(很多误报).

Why is it that mAP and detection accuracy decrease over time even though TotalLoss improves? My intuition of the results is that the detection model is getting more and more accurate (never a false positive) but less and less sensitive (lots of false negatives).

非常感谢任何建议!

(这里有一些来自 tensorboard 的示例图片)

(here are some example images from tensorboard)

0 步

1241 步

53024 步

92176 步

推荐答案

好的,所以在对配置文件进行一些实验(=盲目猜测)之后,我想我找到了我问题的答案 - 我把它放在这里希望其他人可以受益.

ok, so after some experimentation (=blind guessing) with the config file I think I found the answer to my question - I'm putting it here hoping that someone else can benefit.

首先,mAP下降的原因可能是设置:

First, the reason for mAP decreasing was probably the setting:

matched_threshold: 0.3
unmatched_threshold: 0.3

根据我的实验,将此设置(就像我所做的那样)降低到 0.5 以下似乎会使模型不稳定并使其在训练过程中崩溃(随着时间的推移 mAP 会降低).

From my experimentation, lowering this setting (like I did) below 0.5 seems to destabilise the model and make it break during training (with decreasing mAP over time).

第二,当试图检测显微图像中的细胞核时(这可能也适用于其他已知尺寸的小物体),SSD 似乎对锚生成器中的最小/最大设置非常敏感.

Second, when trying to detect cell nuclei in a microscopic image (this probably applies to other small objects with a known size as well), the SSD seems to be VERY sensitive to the min/max-setting in the anchor generator.

anchor_generator {
  ssd_anchor_generator {
    num_layers: 6
    min_scale: 0.2
    max_scale: 0.95

当我开始(并且经常失败)时,我对这个设置使用了一个棒球场估计,当使用不同的图像尺寸等时,突然在 128x128 像素时,模型变得非常好,mAP 0.9 或多或少地检测到每个细胞.当试图弄清楚它为什么突然起作用时,我在图像中注释对象的相对大小上打印了直方图,我意识到我很幸运使用 128x128 模型配置文件并精确地达到了范围.

When I started out (and constantly failed) I used a ball park estimate for this setting, and when playing around with different image sizes and such, suddenly at 128x128 pixels the model got really good with mAP 0.9 detecting more or less every cell. When trying to figure out why it suddenly worked I printed histograms over the relative sizes of the annotated objects in the images I realised that I got lucky with the 128x128 models config file and hit the range precisely.

然后我回到所有其他模型和尺寸,当在特定图像尺寸中使用细胞核的确切尺寸范围时,模型表现完美,即使在细胞核较大的图像尺寸(例如 512px)下仅占图像宽度的 3-15%.即使在 1024px 下采样到 512 并且核仅覆盖图像宽度的 1-7% 时,只要精确指定尺寸范围,该模型也能正常运行.

I then went back to all the other models and sizes, and when using the exact range of sizes of the cell nuclei in a certain image size, the model performs perfect, even at larger images sizes (e.g. 512px) where the nuclei only take up 3-15% of the image width. Even at 1024px with downsampling to 512 and the nuclei only covering 1-7% of image width, the model performs ok as long as the size range is precisely specified.

对于我的应用程序,这实际上不是问题,因为我事先知道期望的功能大小,但是对于更一般的问题,我猜这是一个弱点..

For my application this is actually not a problem since I know beforehand what sizes of features to expect, but with a more general problem I'm guessing it's a weakness..

这篇关于mAP随着训练张量流对象检测SSD而减少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆