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

add ROF ADMM solver #238

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

add ROF ADMM solver #238

wants to merge 2 commits into from

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Nov 6, 2021

This is currently incomplete, the benchmark shows that it's already faster than the MATLAB equivalent version. Yet I think we still have more room for optimization wrt the FFT-related operations, so I opened this draft to see if there are any suggestions on this.

using ImageFiltering, ImageCore, TestImages, ImageShow
using ImageFiltering.Models

img = Float32.(testimage("cameraman"))
noisy_img = img .+ 0.25 .* randn(size(img))

@btime solve_ROF_ADMM($noisy_img, 0.25, 0.02; num_iters=100);
# julia + FFTW v1.1.1: 856.001 ms (104403 allocations: 639.15 MiB)
# julia + FFTW v1.4.5: 1.275 s (8316 allocations: 632.49 MiB)
# matlab: 1.851779s

FFTW has some performance regression here: JuliaMath/FFTW.jl#224

Comment on lines +269 to +271
# TODO(johnnychen94): optimize the memory allocation
fft_tmp .= μ .* fft(RHS)./LHS
u .= real.(ifft(fft_tmp))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the performance hot spot:

preview.png

I guess we can use in-place version fft! or real version rfft to boost it.

@codecov
Copy link

codecov bot commented Nov 6, 2021

Codecov Report

Merging #238 (68cbe6d) into master (424523c) will decrease coverage by 2.72%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   92.14%   89.42%   -2.73%     
==========================================
  Files          12       12              
  Lines        1642     1692      +50     
==========================================
  Hits         1513     1513              
- Misses        129      179      +50     
Impacted Files Coverage Δ
src/models.jl 43.82% <0.00%> (-56.18%) ⬇️

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 424523c...68cbe6d. Read the comment docs.

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

Successfully merging this pull request may close these issues.

1 participant