Skip to content

TF2onnx exported custom trained Object Detection model from model zoo fails check_model #1443

@bdnkth

Description

@bdnkth

Describe the bug
Exporting a pretrained object detection model from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md to onnx passes the check_model test.
However, if the same pretrained model is trained on custom data with the object detection api from TensorFlow and afterwards saved and then exported to onnx with tf2onx, the onnx model fails the check_model test with a ValidationError. There is no difference in the layout between both models. The only difference, which I've found so far, is, if the model is viewed in Netron, the pretrained model has graph def version v456 and the custom trained model has the graph def version according to the TensorFlow version, so either v440 for TF 2.3.1 or v651 for TF 2.4.1. I do not know where the v456 comes from, it is not from an officially released TensorFlow version. However, that model is officially from TensorFlow.
This happens with several models, it is not exclusively to the EfficientDet.

System information

  • OS Platform and Distribution: Windows 10
  • Tensorflow Version: 2.4.1 and 2.3.1
  • Python version: 3.8.8
  • Onnx version: 1.8.1
  • tf2onnx version: 1.8.4

To Reproduce
Download a model from https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md. Export it to onnx with tf2onnx, load it into onnx and perform the check_model test. Test passes.
Use the same model, train it on custom data, save it, export it to onnx with tf2onnx. Check_model test fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions