简体   繁体   English

无法导出 TensorFlow Object 检测 API

[英]Can't export TensorFlow Object Detection API

So, I followed the instructions and ran the script to export my model after training was done.因此,我按照说明运行脚本,在训练完成后导出我的 model。 Now, I don't know why, but I keep getting this error:现在,我不知道为什么,但我不断收到此错误:

 > ValueError: Tensor's shape (3, 3, 256, 12) is not compatible with > supplied shape (3, 3, 256, 546)

What could be the issue?可能是什么问题?

I had the same issue trying to export a model with the Object Detection API, in my case I was using the model "ssd_resnet50_v1_fpn_640x640_coco17_tpu-8" from Model Zoo. I had the same issue trying to export a model with the Object Detection API, in my case I was using the model "ssd_resnet50_v1_fpn_640x640_coco17_tpu-8" from Model Zoo.

Basically, you have to:基本上,您必须:

  1. Save checkpoints of your fine-tuned model.保存微调后的 model 的检查点。

  2. Modify the "pipeline.config" file of the model you retrained in order to match the number of classes of your custom dataset;修改您重新训练的 model 的“pipeline.config”文件,以匹配您自定义数据集的类数; ie, changing the value of "num_classes" properly (If the number of classes is not properly set, then the shapes of the graph won't match)即,正确更改“num_classes”的值(如果未正确设置类数,则图形的形状将不匹配)

  3. Use the exporter_main_v2 helper function to export the model for inference with the files you generated in steps 1 and 2.使用exporter_main_v2帮助程序 function 导出 model 以推断您在步骤 1 和 2 中生成的文件。

I guess that you did steps 1 and 3, but not step 2.我猜你做了第 1 步和第 3 步,但没有第 2 步。

I provide a detailed explanation of this solution in this notebook , where few shot fine-tuning on a custom dataset is performed and the resulting model is exported, loaded and tested.我在此笔记本中提供了此解决方案的详细说明,其中对自定义数据集执行了少量镜头微调,并导出、加载和测试了生成的 model。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM