【问题标题】:Post process of tf2 SSD detection modelstf2 SSD检测模型的后期处理
【发布时间】:2021-08-24 08:41:32
【问题描述】:

我需要在ios上使用一个tensorflow的检测模型。 1 中可用的 tflite 模型文件是 uint8 格式,不能很好地与 CoreML 配合使用,所以我决定下载一个完整的模型并自己将其转换为 tflite。

TF zoo 中的所有 SSD 模型都包含非极大值抑制算法,由于 NMS 不能很好地与 tflite 配合使用,所以我删除了 export_tflite_graph_lib_tf2 代码中的后处理功能,以便创建没有 NMS 的 tflite 模型。

所以现在我有一个工作检测模型(确切地说是 ssd mobilenetv2),它输出(box_encodings、class_predictions、anchors)而不是(boxes、classes、scores、num_detections)

如何从每个 box_encoding、anchors 中创建一个 bbox?

我在2找到了这个公式:

ycenter = y / y_scale * anchor.h + anchor.y;  
xcenter = x / x_scale * anchor.w + anchor.x;  
half_h = 0.5*exp(h/ h_scale)) * anchor.h;  
half_w = 0.5*exp(w / w_scale)) * anchor.w;  
ymin = ycenter - half_h; 
ymax = ycenter + half_h; 
xmin = xcenter - half_w; 
xmax = xcenter + half_w;

但我不确定什么是 y_scale、x_scale 等。它是图像大小吗? (320*320)。如果是这样,数字不匹配。

例如,(0.425, 0.225, 0.399, 0.200) 的框编码和 (0.958, 1.315, 1.437, 0.938) 的锚点创建 (0.496, 0.953, 2.641, 2.099) 的 bbox。这些数字对我来说没有意义(我希望所有四个数字(bbox 的角)都在 [0,1] 范围内)。 任何人都可以澄清这一点吗? 谢谢

【问题讨论】:

    标签: tensorflow object-detection bounding-box post-processing single-shot-detector


    【解决方案1】:

    发现了答案:

    1. 我的 box_encodings,锚点混在一起了。
    2. 比例因子为:x,y: 10; w,h:5(而不是 320)

    现在创建的盒子已经正确创建了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-09
      • 1970-01-01
      • 2018-03-07
      • 2019-09-28
      • 2014-06-15
      • 1970-01-01
      • 2021-10-14
      • 1970-01-01
      相关资源
      最近更新 更多