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
import tensorflow as tf | |
import tensorflow.contrib.tensorrt as trt | |
import numpy as np | |
import PIL | |
from timeit import default_timer as timer | |
from tqdm import tqdm | |
''' | |
This script benchmarks how long it takes to run perform inference on a pure Tensorflow (TF) model vs a converted TensorRT model |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# SSDLite with Mobilenet v2 configuration for SANATA dataset. | |
# Users should configure the fine_tune_checkpoint field in the train config as | |
# well as the label_map_path and input_path fields in the train_input_reader and | |
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that | |
# should be configured. | |
model { | |
ssd { | |
# PATH_TO_BE_CONFIGURED | |
num_classes: 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
# SSDLite with Mobilenet v2 configuration for SANATA dataset. | |
# Users should configure the fine_tune_checkpoint field in the train config as | |
# well as the label_map_path and input_path fields in the train_input_reader and | |
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that | |
# should be configured. | |
model { | |
ssd { | |
# PATH_TO_BE_CONFIGURED | |
num_classes: 6 |
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
isi@nano:~/Emulsefai$ python tst.py | |
2019-11-14 11:18:08.090728: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 | |
2019-11-14 11:18:16.575729: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 | |
WARNING:tensorflow:From tst.py:6: The name tf.enable_eager_execution is deprecated. Please use tf.compat.v1.enable_eager_execution instead. | |
2019-11-14 11:18:21.897651: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1 | |
2019-11-14 11:18:21.910336: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:972] ARM64 does not support NUMA - returning NUMA node zero | |
2019-11-14 11:18:21.910489: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: | |
name: NVIDIA Tegra X1 major: 5 minor: 3 memoryClockRate(GHz): 0.9216 | |
pciBusID: 0000:00:00.0 |
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
isi@nano:~/Emulsefai$ python tst.py | |
2019-11-14 16:51:49.211844: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 | |
2019-11-14 16:52:01.519426: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 | |
WARNING:tensorflow:From tst.py:6: The name tf.enable_eager_execution is deprecated. Please use tf.compat.v1.enable_eager_execution instead. | |
2019-11-14 16:52:05.991091: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1 | |
2019-11-14 16:52:06.003322: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:972] ARM64 does not support NUMA - returning NUMA node zero | |
2019-11-14 16:52:06.003476: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: | |
name: NVIDIA Tegra X1 major: 5 minor: 3 memoryClockRate(GHz): 0.9216 | |
pciBusID: 0000:00:00.0 |
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
import numpy as np | |
import tensorflow as tf | |
from ipdb import set_trace | |
from tensorflow.python.compiler.tensorrt import trt_convert as trt | |
tf.enable_eager_execution() | |
INPUT_SAVED_MODEL_DIR = 'tst' | |
OUTPUT_SAVED_MODEL_DIR = 'tst_out' |