Replies: 2 comments
-
It's slow because the way you've written the code, every time you blur it compiles the Halide code from scratch. Define the pipeline once, using ImageParams for the inputs (not Buffers), and then call realize on it multiple times, swapping out the input buffer using ImageParam::set. Also, defining blur and threshold as two separate pipelines and then calling them one after the other defeats one of the main ways Halide beats libraries like OpenCV, which is by fusing computation down long imaging pipelines for better locality. If you want to blur then threshold, you should define a single Halide pipeline that blurs then thresholds, so that you can fuse the blur into the thresholding operation. |
Beta Was this translation helpful? Give feedback.
-
much faster. i should learn it step by step. anyway, thanks, |
Beta Was this translation helpful? Give feedback.
-
loop 30 times, compare infos output:
image channel: 1
Halide Elapsed time: 7274 ms
Opencv Elapsed time: 23 ms
Halide: Done
someone can help me to explain it?
I am first time to coding halide program. thanks.
I had try some schedule to speed up, but halide is slower than opencv, it is so weird.
if I want to speed up, how can I modify these codes to get good result.
Beta Was this translation helpful? Give feedback.
All reactions