Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inference time is too long 3s/img at example/classification/classification.ipynb #73

Open
biyuehuang opened this issue Apr 8, 2020 · 0 comments

Comments

@biyuehuang
Copy link

biyuehuang commented Apr 8, 2020

Hi, I use example/classification/classification.ipynb by inceptionV3 model on Jetson AGX Xavier. I modify it to print inference time by "import datetime" as following:

......
tf.import_graph_def(trt_graph, name='')
tf_input = tf_sess.graph.get_tensor_by_name(input_names[0] + ':0')
tf_output = tf_sess.graph.get_tensor_by_name(output_names[0] + ':0')

import datetime
start = datetime.datetime.now()

image = Image.open(IMAGE_PATH)
width = int(tf_input.shape.as_list()[1])
height = int(tf_input.shape.as_list()[2])
image = np.array(image.resize((width, height)))

output = tf_sess.run(tf_output, feed_dict={
    tf_input: image[None, ...]
})
scores = output[0]
end=datetime.datetime.now()
print("Took time = ",(end-start))

with open(LABELS_PATH, 'r') as f:
    labels = f.readlines()
top5_idx = scores.argsort()[::-1][0:5]
for i in top5_idx:
    print('(%3f) %s' % (scores[i], labels[i]))
tf_sess.close()

Took time = 0:00:03.205719
Why it took 3 s/img? on Jetson AGX Xavier? it's too far way from benchmark TF-TRT 20ms.

@biyuehuang biyuehuang changed the title inference time is too long 1.3s/img at example/classification/classification.ipynb inference time is too long 3s/img at example/classification/classification.ipynb Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant