Created
May 9, 2020 11:55
-
-
Save iwatake2222/f1b86b4eefeffdb36ecc9789cc23a5c1 to your computer and use it in GitHub Desktop.
EdgeTPUCompile.ipynb
This file contains 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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "EdgeTPUCompile.ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"authorship_tag": "ABX9TyOEH2mIXMcLWC61qwJnjZ1H", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/iwatake2222/f1b86b4eefeffdb36ecc9789cc23a5c1/edgetpucompile.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "MV4vxSpK2OvA", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"# Install EdgeTPU compiler\n", | |
"!curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -\n", | |
"!echo \"deb https://packages.cloud.google.com/apt coral-edgetpu-stable main\" | sudo tee /etc/apt/sources.list.d/coral-edgetpu.list\n", | |
"!sudo apt-get update\n", | |
"!sudo apt-get install edgetpu-compiler" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "1n3zuQ-82Wyw", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"from google.colab import files\n", | |
"uploaded = files.upload()\n", | |
"file_name = list(uploaded.keys())[0]" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "F5mrTI-Y3Uqz", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!edgetpu_compiler $file_name\n", | |
"!ls -la" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "1RsmUfD93_rV", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!edgetpu_compiler --num_segments=3 $file_name\n", | |
"!ls -la" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "gJA_4b9N2Xkb", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"!zip -r tflite.zip *.tflite\n", | |
"\n", | |
"from google.colab import files\n", | |
"files.download( \"./tflite.zip\")" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment