ICNet-tensorflow icon indicating copy to clipboard operation
ICNet-tensorflow copied to clipboard

inference times too large

Open Anubhav7 opened this issue 7 years ago • 12 comments

hi

I am getting an inference time of around .8s on GTX 1070 (8GB). The image sizes are 1080x1920. Cuda version is 9.0. What may I be doing wrong?

Anubhav7 avatar Nov 17 '17 07:11 Anubhav7

Hey, it will initialize the model at first iteration, so the time you calculated contain the time of initialization. You can try to run more images and calculate like following:

for i in range(10):
     start_time = time.time()
     preds = sess.run(pred, feed_dict={x: img})
     end_time = time.time()
     
    print('time: ', end_time - start_time)

hellochick avatar Nov 17 '17 09:11 hellochick

Hey,

Thanks for the quick reply. I tried your suggestion and now it reports .06s per frame. My analysis says that the function decode_labels is taking the rest of the time. I am thinking of ways to speed that up.. do you have any suggestions?

Anubhav7 avatar Nov 21 '17 10:11 Anubhav7

Hey @Anubhav7 , I will fix this bottleneck tomorrow, just wait for me, thanks.

hellochick avatar Nov 22 '17 17:11 hellochick

I just resize the cityscapes dataset into 512*1024,I record the time that the network processed the data,the average time is 0.02s,but when it loads the checkpoint flie,the first iteration takes about 0.04s. Anyway,thanks for your amazing job~ @hellochick

Fengmoon93 avatar Nov 23 '17 02:11 Fengmoon93

@Anubhav7, I have change the decode_label function. Can you test on it again?

hellochick avatar Nov 23 '17 06:11 hellochick

You beat me to the fix :). Thanks for the help, really appreciate it. I am getting inference times of around .07s now

Anubhav7 avatar Nov 23 '17 09:11 Anubhav7

Hi, thanks for your excellent work at first.There is one thing confuses me that inference time doesn't include interp layer only when testing.In the official code or paper, it looks like inference time includes this part and it costs only 0.5ms in caffe.

StOnEGiggity avatar Dec 01 '17 06:12 StOnEGiggity

Hey @StOnEGiggity. My way to calculate inference time is to subtract the time of processing input data, so it contains interp layer. Does this confuse you, or something else?

Btw, it seems that caffe use caffe time to calculate, and it only contains the time of forwarding in the network.

hellochick avatar Dec 01 '17 06:12 hellochick

Sorry for my unsuitable expression. I mean that the time may contain this line https://github.com/hellochick/ICNet-tensorflow/blob/4aeb4005a2c25636d4d9bb4914f1d641f591d7cf/evaluate.py#L100

StOnEGiggity avatar Dec 01 '17 09:12 StOnEGiggity

@StOnEGiggity , Ohhh!!!!! I got it, this is my fault. I forgot to calculate this time at evaluate.py, now i understand what you mean. Thanks for your reply, I have just fixed it .

hellochick avatar Dec 01 '17 10:12 hellochick

Hi, I am interested in your new inference time.I have larger one than paper refers to due to GPUs.Would you mind updating it somewhere?Thanks a lot:) @hellochick

StOnEGiggity avatar Dec 06 '17 06:12 StOnEGiggity

Hey @StOnEGiggity , the new inference time test on GTX 1080ti shown below: Inference time excluding loading data ( Calculated as described in paper ): ~0.03s Inference time including loading data : ~0.04s

hellochick avatar Dec 06 '17 09:12 hellochick