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

Super Slow TFLite YOLOX-Nano (m) inference time speed compared to yolov5 #318

Open
Mkarami3 opened this issue Aug 2, 2021 · 8 comments
Open

Comments

@Mkarami3
Copy link

Mkarami3 commented Aug 2, 2021

Hello,
Many thanks for sharing your code,
I was wondering if a comparison between YOLOV5 (ultralytics) and the present YOLOX about inference time speed has been done?

For yoloV5 (Small) TFLite with 1 thread, I get around 62 FPS.
For YOLOX (nano), the FPS value is around 1 FPS and for YOLOX (Tiny), FPS value is around 6.5 FPS. However, I was expecting to obtain a higher FPS value using YOLOX.

Am I missing something here?
Thanks

@Mkarami3 Mkarami3 changed the title YOLOX-Nano inference time speed compared to yolov5 Super Slow TFLite YOLOX-Nano (m) inference time speed compared to yolov5 Aug 2, 2021
@tucachmo2202
Copy link

How did you get tflite model? And can you tell more detail about your device you use?

@Mkarami3
Copy link
Author

Mkarami3 commented Aug 3, 2021

thank you for your reply.
My CPU information is: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz 3.60 GHz
and I used the following code for conversion to TFLite

#First create the frozen graph using the following command:

onnx-tf convert -i "yolox_s.onnx" -o "yolox_s.pb"
Then run the following python file
converter = tf.lite.TFLiteConverter.from_saved_model('./yolox_s.pb')
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS]
converter.allow_custom_ops = False
converter.experimental_new_converter = True
converter.target_spec.supported_types = [tf.float16]
tf_lite_model = converter.convert()
open('yolox_s.tflite', 'wb').write(tf_lite_model)

@tucachmo2202
Copy link

There are something I think it may be helpful:

  • Your cpu may not support float 16 quantization so if not it will fall back to float 32 when inference.
  • When you convert in this way I see many transpose operation added to graph which cause slow down.

@Mkarami3
Copy link
Author

Mkarami3 commented Aug 3, 2021

Thanks for the notes
One thing that surprised me is that YOLOX_Nano was slower than YOLOX_Tiny.
Is there another recommended way for converting to TFLite?

@tucachmo2202
Copy link

tucachmo2202 commented Aug 3, 2021

Hi,
In my case, yolox-nano is little faster than yolox-tiny.
About convert to tflite you can see this repo and also their script for each model. But with yolox-nano model, I follow their step it still raise this error. If you can convert succesfully, please tell me. Thanks!

@Mkarami3
Copy link
Author

Mkarami3 commented Aug 4, 2021

Thanks for your helps
I will try the new conversion and post my observation here

@ghost
Copy link

ghost commented Sep 7, 2021

@tucachmo2202 In PINTO_model_zoo/132_YOLOX, there is a script called "download_nano.sh". Please launch "download_nano.sh" to download all files then you can find missing "yolox_nano_320x320_tf.xml".

@tucachmo2202
Copy link

@Neo1109-Chang-RTK, Thanks. I fixed my problem!

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