[TensorFlow Lite] MobileNet v1 모델의 tflite 파일 구조
https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md
GitHub - tensorflow/models: Models and examples built with TensorFlow
Models and examples built with TensorFlow. Contribute to tensorflow/models development by creating an account on GitHub.
github.com
위 GitHub 에서 다운 받은 mobilenet_v1_1.0_224_quantized_1_metadata_1.tflite 을 netron 에서 확인해보았다.
아래와 같이 구성되어 있으며, type이 uint8로 되어있다. quantization 된 값도 명시되어있다.
MobileNet v1 모델은 int8로 양자화 하여 tflite 파일로 변환 할 때 아래와 같은 성능 손실이 존재한다고 한다.
참고자료 : https://github.com/tensorflow/tensorflow/tree/r1.15/tensorflow/contrib/quantize
GitHub - tensorflow/tensorflow: An Open Source Machine Learning Framework for Everyone
An Open Source Machine Learning Framework for Everyone - GitHub - tensorflow/tensorflow: An Open Source Machine Learning Framework for Everyone
github.com
Model | Top-1 Accuracy : Floating point |
Top-1 Accuracy: Fixed point: 8 bit weights and activations |
Mobilenet-v1-128-0.25 | 0.415 | 0.399 |
Mobilenet-v1-128-0.5 | 0.563 | 0.549 |
Mobilenet-v1-128-0.75 | 0.621 | 0.598 |
Mobilenet-v1-128-1 | 0.652 | 0.64 |
Mobilenet-v1-160-0.25 | 0.455 | 0.435 |
Mobilenet-v1-160-0.5 | 0.591 | 0.577 |
Mobilenet-v1-160-0.75 | 0.653 | 0.639 |
Mobilenet-v1-160-1 | 0.68 | 0.673 |
Mobilenet-v1-192-0.25 | 0.477 | 0.458 |
Mobilenet-v1-192-0.5 | 0.617 | 0.604 |
Mobilenet-v1-192-0.75 | 0.672 | 0.662 |
Mobilenet-v1-192-1 | 0.7 | 0.69 |
Mobilenet-v1-224-0.25 | 0.498 | 0.482 |
Mobilenet-v1-224-0.5 | 0.633 | 0.622 |
Mobilenet-v1-224-0.75 | 0.684 | 0.679 |
Mobilenet-v1-224-1 | 0.709 | 0.697 |
Mobilenet-v2-224-1 | 0.718 | 0.708 |
Inception_v3 | 0.78 | 0.775 |
양자화 하는 과정은 TensorFlow 의 pb 파일과 ckpt 파일을 가지고 graph 를 freeze 한 pb 를 생성한 후
그 pb 파일을 가지고 여러 옵션을 주어 tflite 파일을 생성한다고 한다.