Skip to content

TensorFlow Lite --int8 export failure: EndVector() takes 1 positional argument but 2 were given #5707

@phodgers

Description

@phodgers

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

Export

Bug

Using https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb below export fails

!git clone https://github.com/ultralytics/yolov5  # clone
%cd yolov5
%pip install -qr requirements.txt  # install

from yolov5 import utils
display = utils.notebook_init()  # checks

!python export.py --weights yolov5s.pt --include tflite --int8

At the end of export, the following message is displayed

TensorFlow Lite: export failure: EndVector() takes 1 positional argument but 2 were given

image

According to tensorflow/tensorflow#52954 there is some issue with flatbuffers library. Workaround is to downgrade flatbuffers.

The following code therefore works as expected.

!git clone https://github.com/ultralytics/yolov5  # clone
%cd yolov5
%pip install -qr requirements.txt  # install

from yolov5 import utils
display = utils.notebook_init()  # checks

%pip install --upgrade flatbuffers==1.12 # downgrade from v2 to v1.12
!python export.py --weights yolov5s.pt --include tflite --int8

Environment

Ultralytics colab environment https://colab.research.google.com/github/ultralytics/yolov5/blob/master/tutorial.ipynb

Minimal Reproducible Example

!git clone https://github.com/ultralytics/yolov5  # clone
%cd yolov5
%pip install -qr requirements.txt  # install

from yolov5 import utils
display = utils.notebook_init()  # checks

!python export.py --weights yolov5s.pt --include tflite --int8

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleStale and schedule for closing soonbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions