如何为Edge TPU板转换在自定义数据集上训练的模型? [英] How to convert model trained on custom data-set for the Edge TPU board?

查看:335
本文介绍了如何为Edge TPU板转换在自定义数据集上训练的模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Tensor Flow Object Detection API训练了自定义数据集.我运行预测"脚本,它在GPU上运行良好.现在,我想将模型转换为精简版,然后在Google Coral Edge TPU板上运行以检测我的自定义对象.我浏览了Google Coral Board网站提供的文档,但发现它很混乱. 如何在Google Coral Edge TPU板上转换和运行它? 谢谢

I have trained my custom data-set using the Tensor Flow Object Detection API. I run my "prediction" script and it works fine on the GPU. Now , I want to convert the model to lite and run it on the Google Coral Edge TPU Board to detect my custom objects. I have gone through the documentation that Google Coral Board Website provides but I found it very confusing. How to convert and run it on the Google Coral Edge TPU Board? Thanks

推荐答案

上一个答案适用于常规分类模型,但不适用于受TF对象检测API训练的模型.

The previous answer works with general classification models, but not with TF object detection API trained models.

您无法在TF对象检测API模型上使用TF Lite转换器进行训练后量化.

You cannot do post-training quantization with TF Lite converter on TF object detection API models.

为了在EdgeTPU-s上运行对象检测模型:

In order to run object detection models on EdgeTPU-s:

  1. 您必须在模型配置中添加以下内容以量化的感知训练模式训练模型:

graph_rewriter { 量化{ 延误:48000 重量位:8 activation_bits:8 } }

graph_rewriter { quantization { delay: 48000 weight_bits: 8 activation_bits: 8 } }

这可能不适用于model-zoo中提供的所有模型,请首先尝试量化模型.

This might not work with all the models provided in the model-zoo, try a quantized model first.

  1. 训练后,使用以下命令导出冻结的图形:object_detection/export_tflite_ssd_graph.py

  1. After training, export the frozen graph with: object_detection/export_tflite_ssd_graph.py

在冻结的图形上运行tensorflow/lite/toco工具以使其与TFLite兼容

Run tensorflow/lite/toco tool on the frozen graph to make it TFLite compatible

您可以在此处找到更多深入的指南: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_mobile_tensorflowlite.md

You can find more in-depth guide here: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_on_mobile_tensorflowlite.md

这篇关于如何为Edge TPU板转换在自定义数据集上训练的模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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