我正在尝试将我的 PB 模型转换为 Tenrorrt uff 模型以使其在 tx2 上工作。
我使用了来自 Nvidia 论坛的示例代码并尝试执行它。我知道这是一些与 python 包相关的问题,但我无法解决它
我收到以下代码的以下错误
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import tensorrt as trt
from tensorrt.parsers import uffparser
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
from random import randint # generate a random test case
from PIL import Image
from matplotlib.pyplot import imshow #to show test case
import time #import system tools
import os
import uff
uff_model = uff.from_tensorflow_frozen_model('./rcnn_3chan.pb', ['image_tensor','detection_scores','detection_boxes' ,'detection_classes' ,'num_detections'])
parser.register_output("image_tensor")
parser.register_output("detection_scores")
parser.register_output("detection_boxes")
parser.register_output("detection_classes")
parser.register_output("num_detections")
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Traceback (most recent call last):
File "uff.py", line 5, in <module>
import tensorrt as trt
File "/usr/local/lib/python2.7/dist-packages/tensorrt/__init__.py", line 77, in <module>
from tensorrt import infer, parsers, utils, lite, plugins
File "/usr/local/lib/python2.7/dist-packages/tensorrt/utils/__init__.py", line 53, in <module>
from ._utils import *
File "/usr/local/lib/python2.7/dist-packages/tensorrt/utils/_utils.py", line 59, in <module>
import uff
File "/home/fts/Downloads/Amruta/uff.py", line 20, in <module>
uff_model = uff.from_tensorflow_frozen_model('./rcnn_3chan.pb', ['image_tensor','detection_scores','detection_boxes' ,'detection_classes' ,'num_detections'])
AttributeError: 'module' object has no attribute 'from_tensorflow_frozen_model'
我的环境变量:
export PATH=$PATH:/usr/local/cuda-9.0/bin/:/home/fts/Downloads/TensorRT-3.0.4/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fts/Downloads/TensorRT-3.0.4/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:/usr/local/lib/x86_64-linux-gnu:/usr/local/cuda-9.0/lib64:/usr/local/lib/x86_64-linux-gnu
export CUDA_ROOT=/usr/local/cuda-9.0
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-9.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64