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

Tv warmstart #1493

Merged
merged 50 commits into from
Sep 18, 2023
Merged

Conversation

MargaretDuff
Copy link
Member

@MargaretDuff MargaretDuff commented Aug 3, 2023

Describe your changes

Added warm start functionality to the CIL total variation function

Describe any testing you have performed

Please add any demo scripts to CIL-Demos/misc/

Testing script added here https://github.com/TomographicImaging/CIL-Demos/blob/main/misc/testing_TV_warmstart.ipynb
Here you can see that:

  • Using TV with a warm start led to a speed-up in performing implicit PDHG with TV regularisation due to reduced inner iterations required.

  • PDHG regularised TV with and without warm start converged to a similar reconstructed image.
    image

  • PDHG regularised by TV with warm start was able to converge to a lower objective function value than without warm start (see e.g. https://link.springer.com/article/10.1007/s10589-022-00410-x)
    image

  • Changing the number of warm start iterations changes the speed of convergence:
    image

  • Over the iterations of PDHG, the calculated proximal by TV warm start converges to that of the calculated proximal by the CCPi regulariser
    image

Link relevant issues

supersedes #1201
closes #1200

Checklist when you are ready to request a review

  • I have performed a self-review of my code
  • I have added docstrings in line with the guidance in the developer guide
  • I have implemented unit tests that cover any new or modified functionality
  • CHANGELOG.md has been updated with any functionality change
  • Request review from all relevant developers
  • Change pull request label to 'Waiting for review'

Contribution Notes

Please read and adhere to the developer guide and local patterns and conventions.

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in CIL (the Work) under the terms and conditions of the Apache-2.0 License.
  • I confirm that the contribution does not violate any intellectual property rights of third parties

@MargaretDuff
Copy link
Member Author

Thanks for your comments @paskino, I have updated the PR and the experiments are still giving similar results.

Also for smaller regularisation parameter and more realistic solutions:
image

Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Copy link
Contributor

@paskino paskino left a comment

Choose a reason for hiding this comment

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

It looks good, however the setter for self.p2 should be changed. This should be discussed with @gfardell

Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
@MargaretDuff
Copy link
Member Author

Thanks @paskino! I will make those changes and we can chat with @gfardell.

@paskino
Copy link
Contributor

paskino commented Aug 8, 2023

@MargaretDuff can you comment about the speed of convergence in terms of wall clock?

@MargaretDuff
Copy link
Member Author

Without warm start (100 inner iterations):
image
With warm start (5 inner iterations):
image
Using the CCPi TV regulariser (100 inner iterations):
image

Copy link
Member

@gfardell gfardell left a comment

Choose a reason for hiding this comment

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

It's looking good. Can you remove the comments referencing the lines in the algorithm from the paper. It's useful to include the link to the paper in the docstring but the code may not always line for line reflect the paper. Comments are much less likely to be updated when we do make code changes so could end up confusing things more as they get out of date.

Edo and I chatted, and I've made some changes and scrapped the property and setter and incorporated the changes in to the code. Properties have their place, but I would avoid using them when the call is a much higher cost than the user would expect. I think the user shouldn't be surprised by unintended consequences when from their pov they are just accessing a class member.

Lastly, we need to implement some unit tests and we're good to go!

MargaretDuff and others added 8 commits September 13, 2023 15:46
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Gemma Fardell <47746591+gfardell@users.noreply.github.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Copy link
Contributor

@paskino paskino left a comment

Choose a reason for hiding this comment

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

Please update warmstart to warm_start.

Wrappers/Python/test/test_functions.py Outdated Show resolved Hide resolved
Wrappers/Python/test/test_functions.py Outdated Show resolved Hide resolved
Wrappers/Python/test/test_functions.py Outdated Show resolved Hide resolved
MargaretDuff and others added 9 commits September 14, 2023 10:02
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
Co-authored-by: Edoardo Pasca <edo.paskino@gmail.com>
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
@MargaretDuff
Copy link
Member Author

Please update warmstart to warm_start.

Done!

@MargaretDuff MargaretDuff removed the request for review from epapoutsellis September 14, 2023 09:29
@MargaretDuff
Copy link
Member Author

@paskino and @gfardell: Thanks for all your comments, think that I have resolved everything and the documentation looks like it has rendered properly

@MargaretDuff MargaretDuff merged commit a3c5823 into TomographicImaging:master Sep 18, 2023
3 checks passed
@MargaretDuff MargaretDuff deleted the tv_warmstart branch September 28, 2023 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge pending jenkins Once jenkins is happy with can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use warm-start in proximal of Total Variation
4 participants