MiguelMonteiro / CRFasRNNLayer

Conditional Random Fields as Recurrent Neural Networks (Tensorflow)
MIT License
82 stars 20 forks source link

About the code's running time #4

Closed zheng-xing closed 6 years ago

zheng-xing commented 6 years ago

Hi Miguel,

Thanks very much for sharing this code. I've tried to add this CRFas RNN layer after an UNET for 2d semantic segmentation problems. And I found this layer is very time consuming (training time increases almost 4 times long). Is it kind of the same to you too? I just want to make sure there's no major mistakes I made in the code.

Thanks very much.

Zheng

MiguelMonteiro commented 6 years ago

The CPU version is very time consuming. The GPU version is significantly faster but obviously still increases running time. 4 times slower seems to much for the GPU version, however, this will depend on the number of reference channels, input channels and spatial dimensions as well as the benchmark you are comparing to.

zheng-xing commented 6 years ago

Thanks for your reply. I am using the GPU version for input gray images of size 1024*1024 and 5 different class labels. I'll check more about it and see how it goes.

MiguelMonteiro commented 6 years ago

What I think is happening is that 2D convolutions are super well optimised and your network already runs very fast and so the percentage increase is big when you use this layer. When I was using it for 3D images the increase in running time was about 1.5x.