Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'NonMaxSuppression not implemented yet' (YOLOv7 tiny onnx to tflite) #43

Closed
kizmoya opened this issue May 8, 2023 · 2 comments

Comments

@kizmoya
Copy link

kizmoya commented May 8, 2023

Hello,
I tried to convert YOLOv7 ONNX model to tflite.
When I tried in Intel Macbook, I got some error message.

$ python converter.py --weights "../yolov7-tiny.onnx" --outpath "./" --formats "tflite"
2023-05-08 19:48:50.472025: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Checking 0/1...
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
INFO:deformation_layers ::Transpose will process tensor after change back to NCHW format.
Traceback (most recent call last):
File "/onnx2tflite/converter.py", line 108, in
run()
File "
/onnx2tflite/converter.py", line 92, in run
onnx_converter(
File "/onnx2tflite/converter.py", line 21, in onnx_converter
keras_model = keras_builder(model_proto, native_groupconv)
File "
/onnx2tflite/utils/builder.py", line 75, in keras_builder
raise KeyError(f"{op_name} not implemented yet")
KeyError: 'NonMaxSuppression not implemented yet'

Is there something I can do to fix this?
Looking forward to your reply.

@MPolaris
Copy link
Owner

MPolaris commented May 8, 2023

Hello, it's seems the post-process operation is exported with model, you may check how to remove it.

# without `--end2end`
python export.py --weights yolov7-tiny.pt --simplify --img-size 640 640 --max-wh 640

@MPolaris
Copy link
Owner

MPolaris commented May 8, 2023

NonMaxSuppression op is a typical dynamic operator, tflite is not friendly to it as my known.
So we always make model graph is static, not dynamic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants