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
adb shell /data/local/tmp/benchmark_model | |
--graph=/data/local/tmp/selfie2anime.tflite | |
--num_threads=4 |
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
adb install -r -d -g bazel-bin/tensorflow/lite/tools/benchmark/android/benchmark_model.apk | |
adb push selfie2anime.tflite /data/local/tmp |
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
bazel build -c opt \ | |
--config=android_arm64 \ | |
//tensorflow/lite/tools/benchmark:benchmark_model |
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
metadata_writer_for_selfie2anime.py | |
|-- model_without_metadata | |
| |--selfie2anime.tflite | |
|-- model_with_metadata | |
| |--selfie2anime.tflite | |
| |--selfie2anime.json |
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
metadata_writer_for_selfie2anime.py | |
|-- model_without_metadata | |
| |--selfie2anime.tflite | |
|-- model_with_metadata |
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
python ./metadata_writer_for_selfie2anime.py \ | |
--model_file=./model_without_metadata/selfie2anime.tflite \ | |
--export_directory=model_with_metadata |
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
converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_func]) | |
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE] | |
tflite_model = converter.convert() |
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
concrete_func.inputs[0].set_shape([1, 256, 256, 3]) | |
concrete_func.outputs[0].set_shape([1, 256, 256, 3]) |
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
model = tf.saved_model.load(saved_model_path) | |
concrete_func = model.signatures[ tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY] |
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
tf.saved_model.simple_save( | |
sess, | |
saved_model_dir, | |
inputs={gan.test_domain_A.name: gan.test_domain_A}, | |
outputs={gan.test_fake_B.name: gan.test_fake_B} | |
) |
NewerOlder