zwx8981 / LIQE

[CVPR2023] Blind Image Quality Assessment via Vision-Language Correspondence: A Multitask Learning Perspective
MIT License
197 stars 11 forks source link

How to reduce the evaluation time. #5

Closed Mapzzone closed 1 year ago

Mapzzone commented 1 year ago

Hi, I tested the quality evaluation of a single image using the demo2. py, and it took more than 5 seconds. How to reduce the evaluation time. I only need the quality score.

zwx8981 commented 1 year ago

@Mapzzone Hi, thanks for your question. Did you run the code in CPU or GPU mode ? In addition, what's the resolution of your test image? In general, the most straightforward way to reduce inference time is reduce the number of patch (L10 in demo2.py). By default, we randomly crop 15 patches with a size of 224 x 224 during inference. Empirically, I think 5 patches would also be good.

zwx8981 commented 1 year ago

@Mapzzone Hi, I just think of that if you directly count the running time of executing the entire demo2.py, most the of the time is actucally used for importing modules, loading weights, and initializing the GPU, corresponding to Line 1 to Line 20 of demo2.py. If you want to test multiple images, it's better to write a loop on top of the image reading and model inference, corresponding to Line 22 to Line 36 of demo2.py.

Hope this answers your question well, feel free to contact me if you have futher question :)