no image
[TensorRT] TF-TRT vs TRT
TensorFlow에 내장되어있는 TensorRT, 일명 TF-TRT 와 그냥 TensorRT 즉 TRT 와의 성능 차이를 비교하는 벤치마크는 현재 시점(2019.08.03)에 나와있지 않다고 한다. 엔비디아에서 TRT vs TFTRT 에 대한 비교 자료를 만들고 있다고 한다. 참고자료 https://devtalk.nvidia.com/default/topic/1044901/tensorrt/performance-using-the-integration-tensorflow-tensorrt-vs-direct-tensorrt/ https://devtalk.nvidia.com/default/topic/1044901/tensorrt/performance-using-the-integration-tensorflow-te..
2019.08.03
[TensorFlow] 함수 내부에서 TensorFlow Graph 실행하기
텐서플로우 내부에서 코드를 예쁘게 구조화 하여 그래프(Graph)를 실행할 수 있다. 구현할 때, 몇가지 방법이 있다. 1. Tensor 이름 전달하기 with tf.Session(graph=graph) as sess: feed = {"Placeholder:0": 3} print(sess.run("Add:0", feed_dict=feed)) 위와 같이 Placeholder:0 이라는 텐서 자체를 feed 에 넘겨주는 것 대신, def build_graph(): g = tf.Graph() with g.as_default(): a = tf.placeholder(tf.int8, name="a") b = tf.add(a, tf.constant(1, dtype=tf.int8), name="b") return g ..
2019.08.03
[TensorRT] TensorRT custom layer
예를 들어, "ResizeBilinear" 레이어는 TensorRT 에서 지원하지 않는 레이어이다. TensorRT에서 지원되지 않는 레이어 목록 : https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#support_op TensorRT Developer Guide :: Deep Learning SDK Documentation NVIDIA DLA (Deep Learning Accelerator) is a fixed function accelerator engine targeted for deep learning operations. DLA is designed to do full hardware acceleration ..
2019.06.13
[TensorRT] ImportError: No module named 'tensorrt.parsers'; 'tensorrt' is not a package
아래와 같은 에러는 ImportError: No module named 'tensorrt.parsers'; 'tensorrt' is not a package TensorRT 예제에서 아래코드와 같이 tensorrt.parsers 의 uffparser를 import 하여 uff 파일을 로드하고 builder 를 생성하였을 때 나는 에러이다. import tensorflow as tf import tensorrt as trt from tensorrt.parsers import uffparser uff_model = uff.from_tensorflow(tf_model, ["fc2/Relu"]) G_LOGGER = trt.infer.ConsoleLogger(trt.infer.LogSeverity.ERROR) p..
2019.06.10
no image
[TensorFlow] pb 파일 TensorBoard에 띄우기 (TF 1.x 버전용)
import_pb_to_tensorboard.py # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distribute..
2019.05.31
no image
[TensorRT] TensorRT를 이용한 ResNet 예제
TensorRT는 추론 최적화 도구이다. 미리 만들어져있는 실행 그래프 파일 (.pb) 을 이용하여 추론을 수행한다. https://github.com/tensorflow/models/tree/master/research/tensorrt tensorflow/models Models and examples built with TensorFlow. Contribute to tensorflow/models development by creating an account on GitHub. github.com TensorFlow 에 내장되어있는 tensorrt 모델을 이용하여 간단한 예제를 실행 할 수 있다. 미리 트레이닝된 TensorFlow SavedModel 을 Frozen Graph로 변환 추론을 위해 F..
2019.04.12
[TensorRT] TensorRT support Python2.7, 3.5
TensorRT 는 현재까지 Python 2.7, Python 3.5 만을 지원한다. https://devtalk.nvidia.com/default/topic/1043215/tensorrt/tensorrt-import-undefined-symbol/ https://devtalk.nvidia.com/default/topic/1043215/tensorrt/tensorrt-import-undefined-symbol/ devtalk.nvidia.com https://devtalk.nvidia.com/default/topic/1035558/tensorrt/tensorrt-for-python-3-6-/ https://devtalk.nvidia.com/default/topic/1035558/tensorrt/tenso..
2019.04.12
no image
[TensorRT] Docker Container를 이용한 TensorRT 설치
TensorRT 레퍼런스에 나와있는대로 Root에 설치했으나 python dependency 문제로 인해 실행되지 않았다. TensorRT 5.0.2.6 (CUDA 10.0) 버전을 설치했는데 자꾸 아래와 같이 CUDA 9.0를 찾지를 않나 ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory TensorRT를 못찾는 에러가 나와서 NVIDIA 답변을 보니 Container를 사용하라고 한다. ImportError: /usr/local/anaconda3/lib/python3.6/site-packages/tensorrt/tensorrt.so: undefined symbol: _Py_ZeroStruct ..
2019.04.10
[TensorRT] TensorRT 5.0.2 Compatibility
TensorRT 5.0.2의 Python Sample 은 yolov3_onnx, uff_ssd 가 있다고 한다. 제일 중요한 Compatibility 는 다음과 같다. TensorRT 5.0.2.6 Compatibility TensorRT 5.0.2 has been tested with cuDNN 7.3.1. TensorRT 5.0.2 has been tested with TensorFlow 1.9. This TensorRT release supports CUDA 10.0 and CUDA 9.0. CUDA 8.0 and CUDA 9.2 are no longer supported. On Windows only, CUDA 10.0 is supported for TensorRT 5.0.1 RC. 원문은 아래와..
2019.04.09
[TensorRT] Object Detection With The ONNX TensorRT Backend In Python
TensorRT 샘플인 yolov3_onnx 를 돌려보았다. 샘플 파일 위치 : .........../TensorRT-5.0.2.6/samples/python/yolov3_onnx 이 샘플은 python 3 와 Ubuntu14.04 이전 버전을 지원하지 않음 주의 1. TensorRT 설치 2019/04/09 - [Deep Learning/TensorRT] - [TensorRT] TensorRT 설치 2. Onnx 설치 (필자는 루트환경에 설치했으므로 sudo 를 사용) python2 -m pip install onnx==1.2.2 3. requirements.txt 설치 python2 -m pip install -r requirements.txt 4. yolov3_to_onnx.py 코드 실행 (한번만..
2019.04.09
[TensorRT] TensorRT 설치
Nvidia TensorRT 는 GPU에서 고성능 추론을 용이하게 해주는 C++ 라이브러리이다. TensorRT는 일련의 네트워크 및 매개변수 들로 구성된 네트워크를 사용하여 기존에 존재하는 네트워크를 고도로 최적화 시킬 수 있다. 현재 TensorRT는 CUDA 9.0, 10.0, 10.1 을 지원할 수 있고 TensorFlow에서 TensorRT 모델로 변환하려면 TensorFlow 1.12.0 버전이 필요하다고 한다. 또한 TesnorRT 는 sudo나 root 에 설치해야하며 anaconda 와 같은 가상환경을 사용할 경우 tensorRT가 설치된 곳을 제어 할 수 없다고 한다. anaconda + python 2.7 을 이용하면 될 수 도 있다고 하는데 시도해보니 실패 1. TensorRT 파일..
2019.04.09
[TensorFlow] Anaconda 가상환경 이용하여 TensorFlow GPU 설치
아나콘다 설치 후 1. 가상환경 생성conda create -n 가상환경이름 python=3.6 2. 가상환경 Activationsource activate 가상환경이름 3. TensorFlow GPU 설치conda install -c anaconda tensorflow-gpu (2019년 3월 5일 기준 )이렇게 설치하면 현재 아나콘다 패키지에 나와있는 최신 버전인 TensorFlow 1.12 버전으로 설치되며CUDA 9.2, cuDNN 7.2.1 로 설정된다.필자는 CUDA 10.0 버전이 설치된 상태에서 가상환경을 위와 같이 설정하였다. 텐서플로우 GPU 버전 패키지 확인 https://anaconda.org/anaconda/tensorflow-gpu/files 3-1. TensorFlow GPU ..
2019.03.05