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
!pip install tensorflow-gpu==1.15.0 | |
# Convert | |
!toco --graph_def_file /content/yolo-v2-tiny-coco.pb \ | |
--output_file yolo-v2-tiny-coco.tflite \ | |
--output_format TFLITE \ | |
--inference_type FLOAT \ | |
--inference_input_type FLOAT \ | |
--input_arrays input \ | |
--output_arrays output |
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
# This script will help print the inputs and output layer names of Tensorflow graph files (.pb) | |
import tensorflow as tf | |
gf = tf.GraphDef() | |
m_file = open('/content/frozen_darknet_yolov3_model.pb','rb') | |
gf.ParseFromString(m_file.read()) | |
with open('somefile.txt', 'a') as the_file: | |
for n in gf.node: | |
the_file.write(n.name+'\n') |
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
# Obtain frozen graph of mobilenet v1 | |
!wget "http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224.tgz" | |
!tar -xf mobilenet_v1_1.0_224.tgz | |
# Get TensorFlow source code repo | |
!git clone "https://github.com/tensorflow/tensorflow.git" | |
# Optimize graph using TensorFlow tool | |
!python "/content/tensorflow/tensorflow/python/tools/optimize_for_inference.py" --input=mobilenet_v1_1.0_224_frozen.pb --output=mobilenet_v1_1.0_224_final.pb --input_names=input --output_names="MobilenetV1/Predictions/Softmax" |
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
//Tencent is pleased to support the open source community by making FeatherCNN available. | |
//Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved. | |
//Licensed under the BSD 3-Clause License (the "License"); you may not use this file except | |
//in compliance with the License. You may obtain a copy of the License at | |
// | |
//https://opensource.org/licenses/BSD-3-Clause | |
// | |
//Unless required by applicable law or agreed to in writing, software distributed |
NewerOlder