WongKinYiu / yolov9

Implementation of paper - YOLOv9: Learning What You Want to Learn Using Programmable Gradient Information
GNU General Public License v3.0
8.64k stars 1.32k forks source link

Converting to TFLite model fails #513

Open aayushb-95 opened 3 weeks ago

aayushb-95 commented 3 weeks ago

Hi, I am trying to convert the Pytorch model to TFLite model. However I am getting the following error

TensorFlow SavedModel: export failure ❌ 13.7s: cannot import name 'C3' from 'models.common' 

TensorFlow Lite: starting export with tensorflow 2.16.1...
TensorFlow Lite: export failure ❌ 0.0s: 'NoneType' object has no attribute 'call'
Traceback (most recent call last):
  File "/home/aayush/yolov9/export.py", line 686, in <module>
    main(opt)
  File "/home/aayush/yolov9/export.py", line 681, in main
    run(**vars(opt))
  File "/home/aayush/miniconda3/envs/yolo9s/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/aayush/yolov9/export.py", line 611, in run
    add_tflite_metadata(f[8] or f[7], metadata, num_outputs=len(s_model.outputs))
                                                                ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'outputs'

I tried the Useful Links section where I followed the link on how to convert to TFLite model. However, when i try to convert the TFLite model to a RKNN model format i get the following error which means the conversion tool is not able to read the input layers AttributeError: 'NoneType' object has no attribute 'get_input_layers' I would like to ask when will the export.py file support tflite format ? Thanks in advance

jifeng632 commented 2 weeks ago

same issue here

jifeng632 commented 2 weeks ago

image

MananGandhi1810 commented 2 weeks ago

any updates upon this?