Skip to content

Add batched processing and augmentation for N2N #5

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

Merged
merged 8 commits into from
Jun 6, 2025
Merged

Conversation

Obi-Wan
Copy link
Contributor

@Obi-Wan Obi-Wan commented Jun 4, 2025

Description

Noise2Noise can be used with large stacks of images, and they might not fit into GPU memory. Some form of batching would be useful for accumulating the gradients over a large amount of data.

Moreover, data augmentation techniques could also improve the learning quality, without requiring additional data. Common data augmentation techniques include image or volume flips and rotations.

TODO

  • Implement the feature:
    • Implement batching along the tensor designated batch dimension
    • Implement data augmentation techniques (at least the flips)
    • Consider where to always do gradient accumulation or to add support for batched iterations
  • Update docstrings
  • Update / add tests
  • Update documentation

Notes

These two features complement each other well because they both reduce the memory requirements needed to obtain a high-quality model.

@Obi-Wan Obi-Wan self-assigned this Jun 4, 2025
@Obi-Wan Obi-Wan added the enhancement New feature or request label Jun 4, 2025
@Obi-Wan Obi-Wan marked this pull request as ready for review June 6, 2025 15:00
@Obi-Wan
Copy link
Contributor Author

Obi-Wan commented Jun 6, 2025

In the end, we opted for having the choice between gradient accumulation and per-batch updates, depending on what the user prefers (switched on/off with the parameter accum_grads).

@Obi-Wan Obi-Wan merged commit 02c5f15 into main Jun 6, 2025
4 checks passed
@Obi-Wan Obi-Wan deleted the n2n-batched branch June 6, 2025 15:03
Obi-Wan added a commit that referenced this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant