mobilenetv2 tflite 没有预期的 python3 输出大小

罗姆齐

我的 mobilenetV2 SSD 型号遇到了问题。我使用此处详述的步骤对其进行了转换,但我tflite_convert在相关步骤中使用了 CLI 工具

这工作正常,我能够执行推理,但输出大小不是我所期望的。

下面的python代码行

interpreter.get_output_details()

告诉我我要找回 10 个检测盒:

[{'shape': array([ 1, 10,  4], dtype=int32), 'index': 252, 'name': 'TFLite_Detection_PostProcess', 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>}, {'shape': array([ 1, 10], dtype=int32), 'index': 253, 'name': 'TFLite_Detection_PostProcess:1', 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>}, {'shape': array([ 1, 10], dtype=int32), 'index': 254, 'name': 'TFLite_Detection_PostProcess:2', 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>}, {'shape': array([1], dtype=int32), 'index': 255, 'name': 'TFLite_Detection_PostProcess:3', 'quantization': (0.0, 0), 'dtype': <class 'numpy.float32'>}]

到目前为止pipeline.config一切顺利,但在我的文件中,我指定了以下 post_processing 设置

post_processing {
    batch_non_max_suppression {
        score_threshold: 9.99999993922529e-09
        iou_threshold: 0.6000000238418579
        max_detections_per_class: 100                                                            
        max_total_detections: 100
    }
    score_converter: SIGMOID
}

所以我希望检测的输出数量为 100,因为在经典 tensorflow 中运行相同的模型会给我 100 个盒子。

有没有办法改变输出张量的大小?在转换或运行时?

我在经典 tensorflow 中的张量输出详细信息下方添加:

[<tf.Tensor 'prefix/detection_boxes:0' shape=<unknown> dtype=float32>, <tf.Tensor 'prefix/detection_scores:0' shape=<unknown> dtype=float32>, <tf.Tensor 'prefix/detection_classes:0' shape=<unknown> dtype=float32>, <tf.Tensor 'prefix/num_detections:0' shape=<unknown> dtype=float32>]

形状未知的地方,这是有道理的,因为我们可以有 100 个或更少的盒子......

对此给予任何启示将不胜感激。

如果已经有人问过类似的问题,但我显然没有找到,请原谅。谢谢。

罗姆齐

重新阅读export_tflite_ssd_graph.py脚本后,似乎有一个选项可以设置保留的最大检测数。

将此设置为 100 解决了我的问题。我心情不好。

对于那些感兴趣的人,我将导出命令从

python3 object_detection/export_tflite_ssd_graph.py \                                            
    --pipeline_config_path=$model_dir/pipeline.config \                                          
    --trained_checkpoint_prefix=$model_dir/model.ckpt \                                          
    --output_directory=$output_dir \                                                             
    --add_post_processing_op=true

python3 object_detection/export_tflite_ssd_graph.py \                                            
    --pipeline_config_path=$model_dir/pipeline.config \                                          
    --trained_checkpoint_prefix=$model_dir/model.ckpt \                                          
    --output_directory=$output_dir \                                                             
    --add_post_processing_op=true \                                                              
    --max_detections=100

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Python readline 没有给出预期的输出

来自分类Dev

python3:没有足够的值来解包(预期为 2,得到 0)

来自分类Dev

Matlab-Hist3没有返回预期的输出

来自分类Dev

python strip函数没有给出预期的输出

来自分类Dev

python中的dir(sys)没有给出预期的输出

来自分类Dev

没有获得预期的输出

来自分类Dev

奇怪的输出,没有预期的

来自分类Dev

Spirit X3,语义操作使编译失败,原因是:属性没有预期的大小

来自分类Dev

Spirit X3,语义操作使编译失败,原因是:属性没有预期的大小

来自分类Dev

Python ValueError:没有足够的值可解包(预期3,得到2)

来自分类Dev

试图在python中做一个余弦规则公式,但是没有给出预期的输出

来自分类Dev

差异,.diff()没有给出预期的输出

来自分类Dev

jq没有得到预期的输出

来自分类Dev

预期没有触发器的输出

来自分类Dev

没有获得正确的预期输出

来自分类Dev

该程序没有给出预期的输出

来自分类Dev

pytorch 没有给出预期的输出

来自分类Dev

Pytesseract 没有给出预期的输出

来自分类Dev

pthread 没有给出预期的输出

来自分类Dev

Keras和TensorFlow Hub版本的MobileNetV2之间的区别

来自分类Dev

如何解决此“ ValueError:没有足够的值要解压(预期3,得到2)”?

来自分类Dev

cv.findContours()-ValueError:没有足够的值可解包(预期3,得到2)

来自分类Dev

orderByChild 查询在 ionic 3、angularfire 2 中没有按预期工作

来自分类Dev

python的棉花糖给出ValueError:没有足够的值要解压(预期2,得到1)

来自分类Dev

如何修复 Python 错误:没有足够的值来解包(预期 2,得到 1)

来自分类Dev

Python Selenium没有给出预期的结果

来自分类Dev

以与python2和python3兼容的方式将字节写入标准输出

来自分类Dev

捕获标准输出时python2和python3之间的StringIO可移植性

来自分类Dev

Keras:为什么Conv2D图层的输出大小与要素图的预期形状不匹配?

Related 相关文章

  1. 1

    Python readline 没有给出预期的输出

  2. 2

    python3:没有足够的值来解包(预期为 2,得到 0)

  3. 3

    Matlab-Hist3没有返回预期的输出

  4. 4

    python strip函数没有给出预期的输出

  5. 5

    python中的dir(sys)没有给出预期的输出

  6. 6

    没有获得预期的输出

  7. 7

    奇怪的输出,没有预期的

  8. 8

    Spirit X3,语义操作使编译失败,原因是:属性没有预期的大小

  9. 9

    Spirit X3,语义操作使编译失败,原因是:属性没有预期的大小

  10. 10

    Python ValueError:没有足够的值可解包(预期3,得到2)

  11. 11

    试图在python中做一个余弦规则公式,但是没有给出预期的输出

  12. 12

    差异,.diff()没有给出预期的输出

  13. 13

    jq没有得到预期的输出

  14. 14

    预期没有触发器的输出

  15. 15

    没有获得正确的预期输出

  16. 16

    该程序没有给出预期的输出

  17. 17

    pytorch 没有给出预期的输出

  18. 18

    Pytesseract 没有给出预期的输出

  19. 19

    pthread 没有给出预期的输出

  20. 20

    Keras和TensorFlow Hub版本的MobileNetV2之间的区别

  21. 21

    如何解决此“ ValueError:没有足够的值要解压(预期3,得到2)”?

  22. 22

    cv.findContours()-ValueError:没有足够的值可解包(预期3,得到2)

  23. 23

    orderByChild 查询在 ionic 3、angularfire 2 中没有按预期工作

  24. 24

    python的棉花糖给出ValueError:没有足够的值要解压(预期2,得到1)

  25. 25

    如何修复 Python 错误:没有足够的值来解包(预期 2,得到 1)

  26. 26

    Python Selenium没有给出预期的结果

  27. 27

    以与python2和python3兼容的方式将字节写入标准输出

  28. 28

    捕获标准输出时python2和python3之间的StringIO可移植性

  29. 29

    Keras:为什么Conv2D图层的输出大小与要素图的预期形状不匹配?

热门标签

归档