neuronflow / blob_loss

blob loss example implementation
https://arxiv.org/abs/2205.08209
MIT License
35 stars 2 forks source link

Optimised code for compute_blob_loss_multi and style change in compute_compound_loss #6

Open aymuos15 opened 1 week ago

aymuos15 commented 1 week ago

What Changed: Mostly associated with batch processing and vectorisation. The unit test notebook has the code commented well highlighting the changes.

Sanity Checks (Turn on GPU on colab other wise it throws an error): Unit Test for the function Change: https://colab.research.google.com/drive/1RWlZ2xGq_5AAhvt-nO02Bqbg3fjetH2r?usp=sharing

Comparing Speed in 3d: https://colab.research.google.com/drive/18WRo84ONO06FkRQX5PSSuBzg0RlVqAPL?usp=sharing

Comparing Speed in 2d: https://colab.research.google.com/drive/1-I-2X_29Hula7UfCIgAGSJnOV_IpVqEP?usp=sharing

Just run all in each notebook.

TLDR Improvements: In 2D: Main Improvement comes from larger batches and images sizes > 32 For smaller batches, and size upto 32 or so, there isnt improvement.

In 3D: Generally 1.8x - 2.2x Faster (considering a batch size of 2; I imagine bigger batches will lead to more improvement)

Do let me know if there are more tests which need to be run of if something is faulty.