hellochick / ICNet-tensorflow

TensorFlow-based implementation of "ICNet for Real-Time Semantic Segmentation on High-Resolution Images".
406 stars 153 forks source link

Inference time is too high(about 3.5x as supposed to be ~0.04s) #118

Open cobbwho opened 4 years ago

cobbwho commented 4 years ago

Thank you very much for your excellent contribution.

I downloaded the code in October 2019. system:windows1803 Graphics card:1080Ti tensorflow-gpu :1.4.0 (I'm using cuda8.0, but 1.4.0 released in November 2017. I think it's ok) tensorflow-tensorboard :0.4.0 model:icnet_cityscapes_trainval_90k.npy(frome google driver)

I just open demo.ipynb by using jupyter and change nothing. It ran successfully and got the right results. But when I use the code as below:

for i in range(50):
    start_t = time.time()

    _ = net.predict(im1)

    duration = time.time() - start_t

    if i > 0:
        elapsed_times.append(duration)

I got "Average time: 0.1461, about 6.843729 fps". It seems like that the inference time is too high(should be ~0.04s).

First, I thought the function "time.time()" maybe different between win and linux. I ruled out this later. Then, I find some issue mentioned that maybe the first image inference time is right and the others are not. So I add print duration below duration = time.time() - start_t. Disappointingly, first picture is about 1.24 s and the others are around 0.14 s.

But I find something that seem to effect. The information print in the cmd shows that: Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 They all say that it is because the tensorflow version is too low. But I think it may not matter with speed. At least tensorflow-gpu 1.4.0 is appropriate in terms of time.

If there is an omission, the message is not posted. Please understand.