Skip to content

DeGirum/nnexpress

Repository files navigation

nnexpress

Export

This guide explains how to export a trained YOLOv5 and YOLOv7 models from PyTorch to tflite and quantized tflite format. We assume that the models are trained and stored by the YOLOv5 repository or the YOLOv7 repository.

Yolov5 tflite export

export.py from YOLOv5-DG repository is used to export pytorch .pt and .pth to tflite format.

python export.py --include tflite --weights PATH_TO_PT_FILE

In order to export to quantized tflite, add --int8 and --data with the path to representative dataset for quantization. --max-int8-img-cnt is used for limiting the number of images used for quantization.

python export.py --include tflite --weights PATH_TO_PT_FILE --int8 --data PATH_TO_REP_DATASET --max-int8-img-cnt NUM_IMG_USED_FOR_QUANT

Yolov7 tflite export

export_v7.py from YOLOv7-DG repository is used to export pytorch .pt and .pth to tflite format.

python export_v7.py --tflite --weights PATH_TO_PT_FILE

In order to export to quantized tflite, add --int8 and --data with the path to representative dataset for quantization. --max-int8-img-cnt is used for limiting the number of images used for quantization.

python export_v7.py --tflite --weights PATH_TO_PT_FILE --int8 --data PATH_TO_REP_DATASET  --max-int8-img-cnt NUM_IMG_USED_FOR_QUANT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published