Created
April 17, 2020 10:46
-
-
Save pra-dan/a216b5e6b38ad677afc249656efddcdb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: The author has kept the weights and cfg files strictly in their respective directories. | |
# If you add yours, do place them in the same folders | |
!pip install onnx==1.6.0 onnx-tf==1.5.0 | |
!pip install tensorflow-gpu==1.15.0 | |
%cd repo | |
!wget "https://pjreddie.com/media/files/yolov3-tiny.weights" -O "/weights/" | |
# The cfg file is already present in the repo. | |
# Convert DarkNet -> ONNX | |
!python3 detect.py --cfg /content/repo/cfg/yolov3-tiny.cfg --weights /content/repo/weights/yolov3-tiny.weights | |
# The output ONNX file is weights/export.onnx | |
# Convert ONNX model to TensorFlow (.pb) model | |
!python3 onnx2tf.py | |
# The output file is weights/yolov3-tiny.pb | |
# Convert TensorFlow to TFLite | |
## optional: Preprocess pb file to avoid NCHW conv, 5-D ops, and Int64 ops | |
!python3 prep.py | |
# Proceed to next section to convert to TFLite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment