JuliaImages / ImageSmooth.jl

Image smoothing algorithms
MIT License
7 stars 1 forks source link

using ImageBase.fdiff and some other pre-allocation to improve the performance #6

Closed JKay0327 closed 3 years ago

JKay0327 commented 3 years ago

Some improvement

Previous performance is as follow:

julia> img_gray = testimage("cameraman");

julia> img_rgb = testimage("lena_color_512");

julia> fₛ = L0Smooth()
L0Smooth(0.02, 2.0, 100000.0)

julia> @btime smooth(img_gray, fₛ)
  418.836 ms (1712 allocations: 316.75 MiB)
julia> @btime smooth(img_rgb, fₛ)
  1.155 s (1934 allocations: 1.03 GiB)

Current performance is as follow:

julia> img_gray = testimage("cameraman");

julia> img_rgb = testimage("lena_color_512");

julia> f = L0Smooth()
L0Smooth(0.02, 2.0, 100000.0)

julia> @btime smooth(img_gray, f)
  393.819 ms (1449 allocations: 138.77 MiB)

julia> @btime smooth(img_rgb, f)
  1.013 s (1627 allocations: 387.81 MiB)

We can see that the allocations are extremely reduced, however, the improvement of running time is not as remarkable as the allocations.

Maybe we can do some further improvement, or the main time-consuming factor is the process of fft! and ifft! so that the performance of this algorithm stay at this level.

codecov[bot] commented 3 years ago

Codecov Report

Merging #6 (7741140) into master (500f97c) will increase coverage by 22.52%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           master        #6       +/-   ##
============================================
+ Coverage   77.47%   100.00%   +22.52%     
============================================
  Files           4         2        -2     
  Lines         111        69       -42     
============================================
- Hits           86        69       -17     
+ Misses         25         0       -25     
Impacted Files Coverage Δ
src/SmoothAPI/smooth.jl 100.00% <100.00%> (ø)
src/algorithms/l0_smooth.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 500f97c...7741140. Read the comment docs.

johnnychen94 commented 3 years ago

Use squash and merge when you're ready.