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

[Future Request] 5D Transpose support in the edgetpu compiler #274

Closed
PINTO0309 opened this issue Dec 5, 2020 · 6 comments
Closed

[Future Request] 5D Transpose support in the edgetpu compiler #274

PINTO0309 opened this issue Dec 5, 2020 · 6 comments
Assignees
Labels
comp:compiler Compiler related issues type:feature Feature requests

Comments

@PINTO0309
Copy link

1. Overview

There are many good quality models nowadays, including the 5D Transpose. For example, YOLOv4, YOLOv5, NanoDet, and so on. Currently, EdgeTPU Compiler does not support 5D transpose, so being able to do the transformations will benefit many engineers as it will allow them to generate very high performance edgetpu tflite models.

2. Details

2-1. Environment

  • Ubuntu 18.04
  • Edge TPU Compiler version 15.0.340273435
  • TensorFlow version tf-nightly==2.5.0-dev20201204
  • NanoDet (Super fast and lightweight anchor-free object detection model. Real-time on mobile devices)

2-2. NanoDet repository of citations

https://github.com/RangiLyu/nanodet.git

2-3. NanoDet Full Integer Quant tflite:

tflite: https://drive.google.com/file/d/1CXWOabh2Kml-0hAZrDg2fhqaUeOJ4JaL/view?usp=sharing

Model structure diagram of NanoDet Full Integer Quant tflite

nanodet_416x416_full_integer_quant tflite (1)

This includes the 5D Transpose OP, which is not supported by the EdgeTPU Compiler.

Screenshot 2020-12-05 16:03:00

2-4. NanoDet EdgetTPU tflite

tflite: https://drive.google.com/file/d/1qqtj-DndmFTIJBl4tDkuZPeBwA-eHV7T/view?usp=sharing

5D Transpose and later are ignored for conversion to custom op.

Model structure diagram of NanoDet EdgetTPU tflite

nanodet_416x416_full_integer_quant_edgetpu tflite

3. Benchmarks

Performance is measured on Kirin 980(4xA76+4xA55) ARM CPU based on ncnn. There is no doubt that if we were able to convert this model perfectly in EdgeTPU, the performance would be much higher than the benchmark using NCNN.

Model Resolution COCO mAP Latency(ARM 4xCore) FLOPS Params Model Size(ncnn bin)
NanoDet-m 320*320 20.6 10.23ms 0.72B 0.95M 1.8mb
NanoDet-m 416*416 21.7 16.44ms 1.2B 0.95M 1.8mb
YoloV3-Tiny 416*416 16.6 37.6ms 5.62B 8.86M 33.7mb
YoloV4-Tiny 416*416 21.7 32.81ms 6.96B 6.06M 23.0mb

4. Appendix

I have already been able to convert all OPs except 5D Transpose into OPs supported by the edgetpu compiler.

4-1. PyTorch -> ONNX -> OpenVINO -> TFLite, Conversion Tools

openvino2tensorflow: https://github.com/PINTO0309/openvino2tensorflow.git

4-2. The various models generated by the conversion work are committed to

https://github.com/PINTO0309/PINTO_model_zoo/tree/master/072_NanoDet

@PINTO0309
Copy link
Author

EdgeTPU Compiler v16
A lot more layers have been converted than when I posted the issue, but 5D Reshape and Transpose are still not converted.
Screenshot 2021-08-11 23:24:45

@hjonnala hjonnala added stat:awaiting Coral team Status - Awaiting response from Coral team and removed stat:awaiting Coral team Status - Awaiting response from Coral team labels Oct 14, 2021
@hjonnala hjonnala assigned hjonnala and unassigned manoj7410 May 3, 2022
@hjonnala hjonnala removed the stat:awaiting Coral team Status - Awaiting response from Coral team label May 13, 2022
@HeywardLiu
Copy link

HeywardLiu commented Jul 15, 2022

@PINTO0309
Hi, Is 5D-transpose still unsupport in the edgetpu compiler?
I'm trying to convert a model from pytroch -> onnx -> tensorflow -> tflite,
but I found there's additional 5D transpose ops have been added during conversion.

So, If edgetpu compiler still not support 5D-transpose operation,
I guess it is impossible to run my model on coral tpu?

Thank you for your attention and patience!

@hjonnala
Copy link
Contributor

@HeywardLiu @PINTO0309
Tensors have to be either 1-, 2-, or 3-dimensional. If a tensor has more than 3 dimensions, then only the 3 innermost dimensions may have a size greater than 1.

For example:
(1,320,320,3) and (1,3,320,320,1) --> supported
(320,1,320, 3) and (3,320,1,320) --> unsupported.

We don't have any plans to support tensors with more than 3 innermost dimensions.

Thanks!

@HeywardLiu
Copy link

@hjonnala
I appreciate your message.
Thank you for your quick reply!

@google-coral-bot
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@PINTO0309
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:compiler Compiler related issues type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

5 participants