我正在尝试将我的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'
我的env变量:
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
答案 0 :(得分:0)
仅供记录(Python新手) 我把我的py文件名命名为uff