微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用单个类重新训练 ssd_inception_v2 模型成功,但在某些步骤后使用两个类失败

如何解决使用单个类重新训练 ssd_inception_v2 模型成功,但在某些步骤后使用两个类失败

我有一项任务是训练对象检测模型来检测单个类)并将模型转换为 edgetpu 模型以在 RaspBerry Pi 上运行珊瑚附。最初我使用 ssd_mobilenet_v2_quantized_coco 模型,然后使用 ssd_inception_v2_coco 模型(均来自 tensorflow model zoo)作为重新训练的基础模型。两者都经过重新训练、转换并部署在 RaspBerry Pi 中以成功进行图像检测。

在 docker 中运行的 Ubuntu 18.04 和 TensorFlow 1.14 (tensorflow:1.14.0-gpu-py3)

当需要第二个类(计算机)时,我尝试重新训练ssd_inception_v2作为具有两个类(人和计算机)。观察结果:

model-ckpt-18000(18000步后创建的checkpoint)成功转换为edgetpu模型

Edge TPU Compiler version 15.0.340273435

Model compiled successfully in 1755 ms.

Input model: <input_model>
Input size: 12.80MiB
Output model: <output_model>
Output size: 14.46MiB
On-chip memory used for caching model parameters: 5.51MiB
On-chip memory remaining for caching model parameters: 1.00KiB
Off-chip memory used for streaming uncached model parameters: 8.94MiB
Number of Edge TPU subgraphs: 1
Total number of operations: 129
Operation log: <log_file>

Model successfully compiled but not all operations are supported by the Edge TPU. A percentage of the model will instead run on the cpu,which is slower. If possible,consider updating your model to use only operations supported by the Edge TPU. For details,visit g.co/coral/model-reqs.
Number of operations that will run on Edge TPU: 128
Number of operations that will run on cpu: 1
See the operation log file for individual operation details.

但是 model-ckpt-20000(20,000 步后创建的检查点)失败并出现错误

Edge TPU Compiler version 15.0.340273435

ERROR: :309 scale_diff / output_scale <= 0.02 was not true.
ERROR: Node number 89 (CONV_2D) Failed to prepare.

ERROR: :309 scale_diff / output_scale <= 0.02 was not true.
ERROR: Node number 89 (CONV_2D) Failed to prepare.

Compilation Failed: Internal error

Internal compiler error. Aborting!

我使用相同的步骤来编译 ssd_mobilenet_v2_quantized_coco 模型并且该过程成功且没有任何错误

涉及的步骤:

  1. 重新训练模型
python3 model_main.py \
--model_dir=<model_dir> \
--pipeline_config_path=<pipeline_config_path>

如有必要,我将共享 ssd_mobilenet_v2_quantized_coco 和 ssd_inception_v2_coco 的 pipeline.config 文件。因为帖子已经很长了,所以我放弃了。

  1. 将检查点转换为冻结图:
python3 export_tflite_ssd_graph.py \
--pipeline_config_path=<pipeline_config_path> \
--trained_checkpoint_prefix=<trained_checkpoint_prefix> \
--output_directory=<output_directory> \
--add_postprocessing_op=true
  1. 将冻结图转换为 tflite
tflite_convert \
--output_file=<output_file> \
--graph_def_file=<graph_def_file> \
--inference_type=QUANTIZED_UINT8 \
--input_arrays=normalized_input_image_tensor \
--output_arrays=TFLite_Detection_PostProcess,TFLite_Detection_PostProcess:1,TFLite_Detection_PostProcess:2,TFLite_Detection_PostProcess:3 \
--mean_values=128 \
--std_dev_values=128 \
--input_shapes=1,300,3 \
--change_concat_input_ranges=false \
--allow_nudging_weights_to_use_fast_gemm_kernel=true \
--allow_custom_ops \
--default_ranges_min=0 \
--default_ranges_max=255
  1. 编译 tflite 模型
edgetpu_compiler \
-o <output_folder> \
<tflite_file>

搜索了与此类似的错误,但大多数帖子都与此场景无关。使用 ssd_inception_v2_coco 时,训练单个类的过程成功,但训练两个类的过程产生了错误。请问有人指出这个过程中的错误吗?如果需要更多信息,请告诉我。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?