-
Notifications
You must be signed in to change notification settings - Fork 296
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
Googlenet running very slow #271
Comments
Does your time (0.95s) include the init part |
No, the time of 0.95 seconds is only for the statement |
So, how should I proceed? Sorry, I don't have a lot of background with the technicalities in tensorflow. What I need to do is classify about 350 images. How do I keep a single tensorflow session while looping over the image set? Thanks. |
Please bear with my ignorance but why is 0.95s not good enough? 350*0.95s is barely 6 min. If you really want, try increase the batch size dimension when you export the model from matlab and then batch the images together into a large mini-batch of size 350. |
6 min for 350 images would be really bad for my specific application. The classification task isn't too demanding computationally, and I would like to keep the time taken at a minimum. I will try what you suggested. But still. I would really like to know how I can do consecutive runs of the Googlenet with the same tensorflow session. Thanks! |
It's not possible with the current onnx_tf API, I basically modified tf_rep to test out my hypothesis that most of the time is wasted in GPU setup. To allow persistent tf session across multiple runs, we would need to update our API. This is not very difficult, but may take some time for us to think through the consequences and implications (e.g., how to test this new API is also a bit of a headache, since our current test suite is already huge...). |
Thank you for your inputs. Would it be possible to share the modified API that you created for testing out your hypothesis? Even if it isn't fully tested, it would be of great help to me and I can work on it further. |
@vibhuagrawal14 |
@vibhuagrawal14 Try refed PR. |
@vibhuagrawal14 Any updates? |
Hey. Sorry for the late reply. I tried the changes you suggested and the performance improved considerably. I am down from ~300 seconds to ~50 seconds. This is still 10x slower than what I get in MATLAB (4-5 seconds) but I think I can manage. Do you have any more ideas about further improving the performance? |
@vibhuagrawal14 ref: https://arxiv.org/pdf/1605.07678.pdf |
Quick update. Running the network from the exported graph (using tf_rep.export_graph) is very efficient. Takes about 7 seconds. |
@vibhuagrawal14 hey, I am facing an issue that when I call |
Maybe out of topic, but you could export the onnx model to the tensorflow pb file and load it as you would do it with normal model. I was able to convert Pytorch model and run it in TF as fast as native one. |
@batrlatom can u share your code? with tf.Session(graph=tf_graph, config=config) as sess:
for _ in range(100):
s = time.time()
output = sess.run(output_tensor, feed_dict={
input_tensor: inputs,
condition_tensor: conditions
})
print('real time: {}'.format(output.shape[-1] / (hparams.sample_rate * (time.time() - s)))) this runs about 4 times slower than pytorch... |
An implementation of GoogLeNet which takes about 0.05 seconds in MATLAB to classify an image, is taking about 0.95 seconds in onnx-tf. As mentioned in issue #254 , I have tried strict=False, but there was no change in performance.
To Reproduce
Attaching code here:
.mat file here: https://drive.google.com/open?id=1P5LpxosVRwbz4bGe4oBZflPYDzB9RD0z
onnx model file here: https://drive.google.com/open?id=1XTFLNQgg7gPeWYBxUa_dmTHrjvvlpdLF
get_version.py
from util folder gives an error sayingUsing pip freeze for versions:
Am I missing anything?
The text was updated successfully, but these errors were encountered: