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

Any plan to optimize the decoding time? #9

Closed
heurainbow opened this issue Sep 14, 2020 · 1 comment
Closed

Any plan to optimize the decoding time? #9

heurainbow opened this issue Sep 14, 2020 · 1 comment

Comments

@heurainbow
Copy link

Great work! However, the decoding time is about 12s for a 1080p image. The bottleneck lies in calling Hyperprior.decompress_forward, especially in prior_entropy_model.decompress (~10s).

Is there any plan to optimize the decoding time?

@Justin-Tan
Copy link
Owner

Justin-Tan commented Sep 14, 2020

Yes, that definitely needs to be optimized for practical purposes. Do you have a detailed profile of the execution times for the decoding process?

The model architecture should be reasonably well optimized already, assuming you are running on GPU. Using torchscript to JIT functions in the forward pass should result in a small improvement.

The bottleneck probably lies in the actual entropy coding/decoding process. The current implementation is a vectorized rANS encoder written in numpy - which also has a small bit overhead in addition to being relatively slow, as the vectorized 'heads' must be initialized to some default value - which takes extra bits to store. Rewriting this in a lower-level language (which TF Compression and Fabian Mentzer's torchac do) would definitely improve encoding/decoding times significantly. This is something I'd like to get working eventually if I can find the time to.

@Justin-Tan Justin-Tan pinned this issue Sep 15, 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

2 participants